aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-04-20 16:01:54 +0300
committereug-vs <eugene@eug-vs.xyz>2022-04-20 16:01:54 +0300
commit8cfebb1165d3d74c6e4c96d16030c1a8cd2bfbff (patch)
treef33a3f38b45a6bb2d2174282cf8ef99dee52580f
parentd04a5d5597ea01a051dec8a9c6871cae0dedd7ca (diff)
downloaddotfiles-8cfebb1165d3d74c6e4c96d16030c1a8cd2bfbff.tar.gz
feat(zsh): use vifm for CTRL-O binding
-rw-r--r--vifm/.config/vifm/vifmrc1
-rw-r--r--zsh/.zshrc18
2 files changed, 9 insertions, 10 deletions
diff --git a/vifm/.config/vifm/vifmrc b/vifm/.config/vifm/vifmrc
index a199c8e..314e2ee 100644
--- a/vifm/.config/vifm/vifmrc
+++ b/vifm/.config/vifm/vifmrc
@@ -401,6 +401,7 @@ set vifminfo=dhistory,savedirs,chistory,state,tui,shistory,
" Start shell in current directory
nnoremap s :shell<cr>
+nnoremap q :execute '!echo %d > ~/.config/vifm/lastdir' | quit<cr>
" Display sorting dialog
nnoremap S :sort<cr>
diff --git a/zsh/.zshrc b/zsh/.zshrc
index e98fd80..2bc552c 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -71,17 +71,15 @@ bindkey '^y' fzf-tmux-project
zle -N fzf-kill-tmux-project
bindkey '^x' fzf-kill-tmux-project
-# Use lf to switch directories and bind it to ctrl-o
-function lfcd () {
- tmp="$(mktemp)"
- lf -last-dir-path="$tmp" "$@"
- if [ -f "$tmp" ]; then
- dir="$(cat "$tmp")"
- rm -f "$tmp" >/dev/null
- [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
- fi
+# Use vifm to switch directories and bind it to ctrl-o
+function vifmcd () {
+ vifm .
+
+ if [ -f ~/.config/vifm/lastdir ]; then
+ cd $(cat ~/.config/vifm/lastdir)
+ fi
}
-bindkey -s '^o' 'lfcd\n'
+bindkey -s '^o' 'vifmcd\n'
# Syntax highlighting, must be last