summaryrefslogtreecommitdiff
path: root/config/essentials
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-04-30 15:17:21 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-04-30 15:17:21 +0200
commit0ed78980ef2e82dda50c1d85c094d4cc8638a442 (patch)
tree914942c8594900f2147285f60c01dedef523516f /config/essentials
parent9971f0f9035103ae12069882e26f6b19cf1c6e3b (diff)
added nvf function
Diffstat (limited to 'config/essentials')
-rw-r--r--config/essentials/zsh/functions.zsh17
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 }