aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2023-11-25 09:22:08 +0900
committernsfisis <nsfisis@gmail.com>2024-01-06 21:30:24 +0900
commit2b2100b1c16015f5a7be22d6d58540caf765ae7c (patch)
tree736f8799594162cae7850ae26959b7b9a97a953c
parent4cc86eacd3fa65f29c8af5be6cf04d7c8a416465 (diff)
downloaddotfiles-2b2100b1c16015f5a7be22d6d58540caf765ae7c.tar.gz
dotfiles-2b2100b1c16015f5a7be22d6d58540caf765ae7c.tar.zst
dotfiles-2b2100b1c16015f5a7be22d6d58540caf765ae7c.zip
zsh: allow function "ee" to take search target directory
-rw-r--r--.zshrc16
1 files changed, 14 insertions, 2 deletions
diff --git a/.zshrc b/.zshrc
index 0813b6b..1356d14 100644
--- a/.zshrc
+++ b/.zshrc
@@ -379,9 +379,21 @@ fi
if type fzf >/dev/null 2>&1; then
if type nvim >/dev/null 2>&1; then
- alias ee="fzf --reverse --bind 'enter:become(nvim {})'"
+ function ee() {
+ if [[ -z "$1" ]]; then
+ fzf --reverse --bind 'enter:become(nvim {})'
+ else
+ find "$1" -type f -print0 | fzf --read0 --reverse --bind 'enter:become(nvim {})'
+ fi
+ }
else
- alias ee="fzf --reverse --bind 'enter:become(vim {})'"
+ function ee() {
+ if [[ -z "$1" ]]; then
+ fzf --reverse --bind 'enter:become(vim {})'
+ else
+ find "$1" -type f -print0 | fzf --read0 --reverse --bind 'enter:become(vim {})'
+ fi
+ }
fi
fi