From 44934b91a195f654e812a27282f1c173bc472025 Mon Sep 17 00:00:00 2001 From: Hendrik Jaeger Date: Fri, 21 Nov 2014 10:51:38 +0100 Subject: [PATCH] Added vi-mode bindings and set default to vi-mode. Minor cleanup. modified: .zsh_functions deleted: .zshcomprc modified: .zshrc --- .zsh_functions | 5 +++++ .zshcomprc | 6 ------ .zshrc | 24 ++++++++++++++++++++++-- 3 files changed, 27 insertions(+), 8 deletions(-) delete mode 100644 .zshcomprc diff --git a/.zsh_functions b/.zsh_functions index abda777..1d7cc9a 100644 --- a/.zsh_functions +++ b/.zsh_functions @@ -56,3 +56,8 @@ function shufflevideos () { find $@ -type f -iregex ".*\.\(avi\|flv\|mkv\|mpeg\|mpg\|wmv\|wva\|mp4\|webm\|wva\|m4v\|ogm\|mp4\|mov\)" -exec mpv --shuffle $MPVOPTS \{\} + } +function zle-line-init zle-keymap-select { + RPS1="%B${${KEYMAP/vicmd/c}/(main|viins)/}%b" + RPS2=$RPS1 + zle reset-prompt +} diff --git a/.zshcomprc b/.zshcomprc deleted file mode 100644 index 9188550..0000000 --- a/.zshcomprc +++ /dev/null @@ -1,6 +0,0 @@ -# The following lines were added by compinstall -zstyle :compinstall filename '/home/henk/.zshcomprc' - -autoload -Uz compinit -compinit -# End of lines added by compinstall diff --git a/.zshrc b/.zshrc index 57ff152..a575e6c 100644 --- a/.zshrc +++ b/.zshrc @@ -1,10 +1,15 @@ autoload -Uz vcs_info +autoload -U edit-command-line . ~/.zsh_comprc . ~/.zsh_functions . ~/.zsh_aliases . ~/.zsh_local +zle -N zle-line-init +zle -N zle-keymap-select +zle -N edit-command-line + HISTFILE=~/.zsh_history HISTSIZE=5000 SAVEHIST=3000 @@ -44,7 +49,22 @@ setopt AUTO_CONTINUE setopt NO_BG_NICE setopt LONG_LIST_JOBS -bindkey -e +bindkey -v + +# Use vim cli mode +bindkey '^P' up-history +bindkey '^N' down-history + +# backspace and ^h working even after +# returning from command mode +bindkey '^?' backward-delete-char +bindkey '^h' backward-delete-char + +# ctrl-w removed word backwards +bindkey '^w' backward-kill-word -#read -q "REPLY?Exec to fish? " && exec fish -i +# ctrl-r starts searching history backward +bindkey '^r' history-incremental-search-backward +# v in command mode starts editor for current line +bindkey -M vicmd v edit-command-line -- 2.39.2