From be46d132e62dee20b95034ddff66e2a8e7ae8d0e Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Wed, 6 Oct 2021 13:23:45 -0400 Subject: [PATCH] Add bat, fzf, and grepi to aliases. --- .shell_aliases | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) 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'