diff --git a/home/shell/functions b/home/shell/functions index dc73f79..5b3bd6e 100644 --- a/home/shell/functions +++ b/home/shell/functions @@ -61,10 +61,23 @@ up() { fi cd $d } +# Search inside files for a string # Usage: search search () { grep -r "$1" | fzf } +# Search for a file by its name +# Usage: ff (optional) +ff() { #find file + if [ -z "${2}" ]; then + find . -type f -iname "*${1}*" + else + find . -type f -maxdepth "${2}" -iname "*${1}*" + fi +} +# Search for a file by its name and edit it +# Usage: vf (optional) +vf() { vim "$(ff "$@" | fzf)"; } # Usage: replay to repeat. Blank for 1 replay() { from="${1:-2}" @@ -75,4 +88,4 @@ replay() { done fi $(fc -ln -${to} -${to}) -} \ No newline at end of file +}