From 7bb3c1e96ef2e9952fc5768fd1318c49b491febf Mon Sep 17 00:00:00 2001 From: eeleater Date: Fri, 4 Oct 2024 01:46:37 +0200 Subject: [PATCH] added findfile function --- dot_config/zsh/files/aliases.zsh | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/dot_config/zsh/files/aliases.zsh b/dot_config/zsh/files/aliases.zsh index d23562c..62eb2bd 100644 --- a/dot_config/zsh/files/aliases.zsh +++ b/dot_config/zsh/files/aliases.zsh @@ -24,22 +24,22 @@ function prev() { } # select from pet snippets -function pet-select() { +function petselect() { BUFFER=$(pet search --query "$LBUFFER") CURSOR=$#BUFFER zle redisplay } -zle -N pet-select -bindkey '^s' pet-select +zle -N petselect +bindkey '^s' petselect # ranger as cli file manager -run_ranger () { +function runranger() { echo ranger < $TTY zle redisplay } -zle -N run_ranger -bindkey '^f' run_ranger +zle -N runranger +bindkey '^f' runranger function ss() { command grc --colour=auto ss "$@" @@ -48,3 +48,16 @@ function ss() { function gi() { curl -sLw "\n" "https://www.toptal.com/developers/gitignore/api/$@" } + +function findfile() { + local search + if test "$1" = "--update"; then + sudo updatedb + shift + search=$1 + else + search=$1 + fi + + locate "$PWD*$search*" +}