diff options
-rw-r--r-- | .config/init/funcreqs/f | 2 | ||||
-rwxr-xr-x | .config/init/funcs/f | 13 | ||||
-rw-r--r-- | .zprofile | 2 | ||||
-rw-r--r-- | .zshrc-linux | 15 |
4 files changed, 16 insertions, 16 deletions
diff --git a/.config/init/funcreqs/f b/.config/init/funcreqs/f new file mode 100644 index 0000000..3b0110f --- /dev/null +++ b/.config/init/funcreqs/f @@ -0,0 +1,2 @@ +func_init_prereqs=(fzf) +func_init_checks=() diff --git a/.config/init/funcs/f b/.config/init/funcs/f new file mode 100755 index 0000000..8ca8b94 --- /dev/null +++ b/.config/init/funcs/f @@ -0,0 +1,13 @@ +#!/usr/bin/env zsh +# fuzzy find with fzf + +local file +fzf --color=16 --black \ + --bind=ctrl-b:page-up,ctrl-f:page-down \ + | read file + +[[ -z "$file" ]] && return + +[[ $(xclip -o 2>/dev/null) ]] || { echo "${file:a}"; return } + +echo "${file:a}" | xclip -i -selection clipboard @@ -28,7 +28,7 @@ func_init_checkreq() { } if [[ -d ~/.config/init/funcs/ && -d ~/.config/init/funcreqs ]]; then - rm -r /tmp/funcs + rm -rf /tmp/funcs mkdir -p /tmp/funcs PATH=$PATH:/tmp/funcs for f in $HOME/.config/init/funcreqs/*; do diff --git a/.zshrc-linux b/.zshrc-linux index 16d4add..b5de6cd 100644 --- a/.zshrc-linux +++ b/.zshrc-linux @@ -29,21 +29,6 @@ b2h() { echo "${val}${suffixes[$sindex]}" } -if [[ $(whence fzf) ]]; then - f() { - local file - fzf --color=16 --black \ - --bind=ctrl-b:page-up,ctrl-f:page-down \ - | read file - - [[ -z "$file" ]] && return - - [[ $(xclip -o 2>/dev/null) ]] || { echo "${file:a}"; return } - - echo "${file:a}" | xclip -i -selection clipboard - } -fi - # ignore non-tracked files git() { if [[ $# -gt 0 ]] && [[ "$1" == "status" ]]; then |