diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-04-30 15:17:21 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-04-30 15:17:21 +0200 |
commit | 0ed78980ef2e82dda50c1d85c094d4cc8638a442 (patch) | |
tree | 914942c8594900f2147285f60c01dedef523516f /config | |
parent | 9971f0f9035103ae12069882e26f6b19cf1c6e3b (diff) |
added nvf function
Diffstat (limited to 'config')
-rw-r--r-- | config/essentials/zsh/functions.zsh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/config/essentials/zsh/functions.zsh b/config/essentials/zsh/functions.zsh index f6169eb..da6df04 100644 --- a/config/essentials/zsh/functions.zsh +++ b/config/essentials/zsh/functions.zsh @@ -13,6 +13,23 @@ vmp() { vimh() { vim -c "help $1" -c 'call feedkeys("\<c-w>o")' } +nvf() { + local cache="$HOME/.cache/nvf" + local match="$(grep -m1 "$1" "$cache" 2> /dev/null)" + if test ! -f "$match" + then + die "resetting cache..." + match="$(goo | tee "$cache" | grep -m 1 "$1" 2> /dev/null)" + # # Alternative: + # match="$(goo | grep -m 1 "$1" 2> /dev/null | tee -a | "$cache")" + fi + if test -f "$match" + then + vim "$match" && return + else + die "no match." && return 1 + fi +} nnn() { test -z "$NNNLVL" && /usr/bin/nnn "$@" || exit } ranger() { test -z "$RANGER_LEVEL" && /usr/bin/ranger "$@" || exit } |