cool function

This commit is contained in:
Christoph J. Scherr 2024-07-25 16:07:52 +02:00
parent 0f329689e6
commit b80e40a67f
1 changed files with 4 additions and 0 deletions

4
.zshrc
View File

@ -79,6 +79,9 @@ if __name__ == \"__main__\":
evaluate_and_print(expr) evaluate_and_print(expr)
" "
} }
function countlines() {
find . -type f -name "$1" -exec wc -l {} \; | awk '{print $0} {total += $1} END {print "Total lines:", total}'
}
### ---- zsh options ------------------------------------- ### ---- zsh options -------------------------------------
setopt autocd setopt autocd
@ -197,6 +200,7 @@ fpath=($ZSH/plugins/zsh-completions/src $fpath)
ZAQ_PREFIXES+=('git commit( [^ ]##)# -[^ -]#m') ZAQ_PREFIXES+=('git commit( [^ ]##)# -[^ -]#m')
ZAQ_PREFIXES_GREEDY+=('py #') ZAQ_PREFIXES_GREEDY+=('py #')
ZAQ_PREFIXES_GREEDY+=('countlines #')
### --- fzf Config ------------------------------------ ### --- fzf Config ------------------------------------
export FZF_CTRL_T_OPTS="--preview '(highlight -O ansi -l {} 2> /dev/null || cat {} || tree -C {}) 2> /dev/null | head -200'" export FZF_CTRL_T_OPTS="--preview '(highlight -O ansi -l {} 2> /dev/null || cat {} || tree -C {}) 2> /dev/null | head -200'"