diff --git a/.config/scripts/functions/fzf b/.config/scripts/functions/fzf index e6fcede..b19ec9f 100644 --- a/.config/scripts/functions/fzf +++ b/.config/scripts/functions/fzf @@ -3,8 +3,8 @@ # These are functions related to fzf used to go to locations, edit # configurations, or start a tmux session in common directories. -# Finds within current directory and cd into the location of the file or -# directory. +# Finds recursively within current directory and cd into the location of the +# file or directory. goto() { path=$(find $1 2> /dev/null | fzf) @@ -12,6 +12,14 @@ goto() cd "$path" } +# Finds files recursively within current directory and edits file. +edit() +{ + file=$(find $1 -type f 2> /dev/null | fzf) + [ -z "$file" ] && return + $EDITOR "$file" +} + # Quickly find and edit a file within ~/.config or ~/Documents cfg() {