From b80e40a67fd0141c2690aea4a8305e50270d57cd Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Thu, 25 Jul 2024 16:07:52 +0200 Subject: [PATCH] cool function --- .zshrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.zshrc b/.zshrc index cb0e539..9208d97 100644 --- a/.zshrc +++ b/.zshrc @@ -79,6 +79,9 @@ if __name__ == \"__main__\": 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 ------------------------------------- setopt autocd @@ -197,6 +200,7 @@ fpath=($ZSH/plugins/zsh-completions/src $fpath) ZAQ_PREFIXES+=('git commit( [^ ]##)# -[^ -]#m') ZAQ_PREFIXES_GREEDY+=('py #') +ZAQ_PREFIXES_GREEDY+=('countlines #') ### --- fzf Config ------------------------------------ export FZF_CTRL_T_OPTS="--preview '(highlight -O ansi -l {} 2> /dev/null || cat {} || tree -C {}) 2> /dev/null | head -200'"