about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2024-09-02 12:24:43 +0100
committerDavid Morgan <djm_uk@protonmail.com>2024-09-02 12:24:43 +0100
commit5c9dab00be507be5bec6a154d2815ad93cde84b1 (patch)
tree25776bd4c45ca487e217001f5ed32507d854e1fc
parentaa8a056f921fd99fd67b1965e7f37e0044134642 (diff)
downloaddotfiles-5c9dab00be507be5bec6a154d2815ad93cde84b1.tar.gz
Add function to edit files from ea output
-rw-r--r--nix-conf/home/includes/zsh.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/nix-conf/home/includes/zsh.nix b/nix-conf/home/includes/zsh.nix
index ae568e4..8f5301f 100644
--- a/nix-conf/home/includes/zsh.nix
+++ b/nix-conf/home/includes/zsh.nix
@@ -162,6 +162,24 @@ in
       # disable flow control (so that fzf-git.sh's ^g^s can work)
       stty -ixon
 
+       function vip () {
+         case $# in
+           0)
+             $EDITOR `ea p 1`
+             ;;
+           1)
+             $EDITOR `ea p $1`
+             ;;
+           2)
+             $EDITOR `ea p $1`/"$2"
+             ;;
+           *)
+             echo "Too many parameters"
+             return 1
+             ;;
+         esac
+      }
+
       function generate () { gopass generate -s -p $1 $((RANDOM % 14 + 45)) }
       function fcd { cd $(fd -L --max-depth=''${1:-4} --type=d 2>/dev/null | fzf-tmux) }