aboutsummaryrefslogtreecommitdiff
path: root/.config/zsh
diff options
context:
space:
mode:
Diffstat (limited to '.config/zsh')
-rw-r--r--.config/zsh/.zshrc22
1 files changed, 13 insertions, 9 deletions
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc
index 1970fa9..b810854 100644
--- a/.config/zsh/.zshrc
+++ b/.config/zsh/.zshrc
@@ -37,15 +37,6 @@ function zle-keymap-select () {
esac
}
-# Yazi shell wrapper
-function y() {
- local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
- yazi "$@" --cwd-file="$tmp"
- IFS= read -r -d '' cwd < "$tmp"
- [ -n "$cwd" ] && [ "$cwd" != "$PWD" ] && builtin cd -- "$cwd"
- rm -f -- "$tmp"
-}
-
zle -N zle-keymap-select
zle-line-init() {
zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
@@ -55,6 +46,19 @@ zle -N zle-line-init
echo -ne '\e[5 q' # Use beam shape cursor on startup.
preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
+#
+# Use lf to switch directories and bind it to ctrl-o
+lfcd () {
+ tmp="$(mktemp -uq)"
+ trap 'rm -f $tmp >/dev/null 2>&1' HUP INT QUIT TERM PWR EXIT
+ lf -last-dir-path="$tmp" "$@"
+ if [ -f "$tmp" ]; then
+ dir="$(cat "$tmp")"
+ [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
+ fi
+}
+bindkey -s '^o' '^ulfcd\n'
+
# Edit line in vim with ctrl-e:
autoload edit-command-line; zle -N edit-command-line
bindkey '^e' edit-command-line