From f6161f2bee7f9d89ae8c2495ef5da703905bc66c Mon Sep 17 00:00:00 2001 From: jc <46619361+juancwu@users.noreply.github.com> Date: Sun, 17 Nov 2024 13:31:03 -0500 Subject: [PATCH] (zsh) add function ed --- zsh/.zshrc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/zsh/.zshrc b/zsh/.zshrc index effef21..5ad5113 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -166,6 +166,21 @@ sngrok() { ngrok http --domain=hyena-merry-literally.ngrok-free.app $1 } +# helper function to fuzzy search files in the current working directory +ed() { + local f="" + + if [ $# -eq 1 ]; then + f=$(find . | grep -Ev "node_modules|\.git" | fzf --filter="$1" --select-1 --exit-0 | head -1) + else + f=$(find . | grep -Ev "node_modules|\.git" | fzf) + fi + + if [ -n "$f" ]; then + nvim "$f" + fi +} + # Load colors if possible autoload -U colors && colors