diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-04-20 16:01:54 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-04-20 16:01:54 +0300 |
commit | 8cfebb1165d3d74c6e4c96d16030c1a8cd2bfbff (patch) | |
tree | f33a3f38b45a6bb2d2174282cf8ef99dee52580f | |
parent | d04a5d5597ea01a051dec8a9c6871cae0dedd7ca (diff) | |
download | dotfiles-8cfebb1165d3d74c6e4c96d16030c1a8cd2bfbff.tar.gz |
feat(zsh): use vifm for CTRL-O binding
-rw-r--r-- | vifm/.config/vifm/vifmrc | 1 | ||||
-rw-r--r-- | zsh/.zshrc | 18 |
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> @@ -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 |