#!/bin/sh # Generic alias bashreload="source ~/.bashrc" alias zshreload="source ~/.zshrc" alias free="free -ht" alias type="type -a" alias grep='grep --color=auto' alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' alias usersearch="awk -F: '{print \"UserName: \" \$1 \", UserID: \" \$3 \", Home Dir: \" \$6 \", Shell Used: \" \$7}' /etc/passwd | grep" alias untar='tar -zxvf ' alias wget="wget --hsts-file ${WGET_HSTS_FILE}" alias v="${EDITOR}" alias snvim="${HOMEBREW_PREFIX}/bin/nvim" # Stable nvim url_encode(){ python3 -c "import urllib.parse, sys; print(urllib.parse.quote(sys.stdin.read()))" <<< "$1" } # History alias histsearch="history | grep" alias hs="histsearch" alias hsi="histsearch" # Directories and Directory listings alias ~="cd ~" alias ..="cd .." alias ...='cd ../../../' # Go back 3 directory levels alias cd_root='cd $(git rev-parse --show-toplevel 2>/dev/null || echo ".")' alias cd_git_root=cd_root alias cl=clear alias lsc='ls --color=auto --hyperlink=auto' alias ll='lsc -alhF' alias la='lsc -Ah' alias l='lsc -CF' alias lsa="lsc -lAFhZ" alias mkdir="mkdir -pv" alias df="df -h" mkcd () { mkdir "$1" cd "$1" || exit } # Network alias ping="ping -c 10" alias ping8="ping 8.8.8.8" alias ping1="ping 1.1.1.1" alias p8="ping8" alias p1="ping1" alias pubip="curl https://ipinfo.io/ip; echo" alias speedtest="speedtest-cli --secure" geoip () { curl -s https://ipinfo.io | sed '/readme\|loc\|postal\|{\|}\|hostname/d;s/org/ISP/;s/"\|,$//g' | awk -F ':' 'NF { printf("%10s: %s \n", $1, $2)}' } # Git git_push_all_changes(){ git add . && git commit -am "${1}" && git push } alias git_just_push=git_push_all_changes alias ta="tmux a" alias tat="tmux a -t" alias tls="tmux ls" alias tnew="tmux new" alias tnewt="tmux new -t" # Nvim Distro-Switcher alias nvim-lazy="NVIM_APPNAME=nvim-lazy nvim" alias OldConfig="NVIM_APPNAME=oldconfig nvim" nvims() { items=$(find -L "$HOME"/.config -maxdepth 2 -name "init.lua" -type f -execdir sh -c 'pwd | xargs basename' \;) config=$(printf "%s\n" "${items[@]}" | fzf --prompt=" Neovim Config  " --height=~50% --layout=reverse --border --exit-0) if [ -z "$config" ]; then echo "Nothing selected" return 0 elif [ "$config" = "default" ]; then config="" fi NVIM_APPNAME=$config nvim "$@" } op() { local chosen_project chosen_project="$(find -L ~/Code -mindepth 2 -maxdepth 2 -not -path '*/.*' -printf "%T@ %p\n" | sort -nr | cut -d ' ' -f 2- | fzf --border --layout=reverse --height=~50% --prompt='Select a project: ' --preview 'ls -Lltc {1}')" if [ -z "$chosen_project" ]; then return 0 fi cd "$chosen_project" || return nvim } # TODO: Create fuzzy finder for cht.sh & tldr