diff --git a/.shell_aliases b/.shell_aliases index 374da58..075d103 100644 --- a/.shell_aliases +++ b/.shell_aliases @@ -4,6 +4,27 @@ function fin { find -iname "*$@*" } +alias cat="bat" +export FZF_DEFAULT_COMMAND='fd --type f' +alias fzf="fzf --preview 'bat --style=numbers --color=always {}'" + +function vo { + if [[ "$1" == "" ]]; then + local f="$(fzf --preview "bat --style=numbers --color=always {}")" + if [[ "$f" != "" ]]; then + print -s "vim $f" + vim $f + fi + else + local f="$(fzf -1 -q $@ | head -n 1)" + if [[ "$f" != "" ]]; then + print -s "vim $f" + vim $f + fi + fi + echo $f +} + # Mkdir should remind you to use git alias mkdir="echo 'Maybe use git init if this is a new project' && mkdir" @@ -31,7 +52,8 @@ alias termrc='vim ~/.config/xfce4/terminal/terminalrc' # Use `grepr` for a recursive, case-insensitive, and filtered grep # alias grepr="grep -RInsi --color=auto --exclude-dir=.git --exclude=tags" # alias grepr='grep -RInsi --color=auto --exclude-dir=.git --exclude-dir=banana_pi_kernel --exclude-dir={bpi_build_scripts, storm_dox, sam_dox} --exclude=tags --exclude=\*.{ko, o}' -alias grepr='grep -RInsi --color=auto --exclude-dir=.git --exclude=tags' +alias grepr='grep -RIns --color=auto --exclude-dir=.git --exclude-dir=venv --exclude-dir=node_modules --exclude=tags --exclude-dir=build' +alias grepi='grepr -i' alias apt="sudo apt" alias apt-get="sudo apt-get" @@ -62,4 +84,4 @@ alias ls='ls --color=auto -F -w 80' # Using du automatically finds the total alias du='du -sh' -alias tags='ctags -f newtags -R . && mv newtags tags' +alias tags='ctags --exclude=node_modules -f newtags -R . && mv newtags tags'