From a5af099628d22557951041d40bc83fed81aa5777 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sun, 9 Jul 2017 13:10:10 +0200 Subject: [PATCH] zsh: add vim-keybindings --- zsh/keybindings.zsh | 12 ++++++++++++ zshrc | 2 ++ 2 files changed, 14 insertions(+) create mode 100644 zsh/keybindings.zsh diff --git a/zsh/keybindings.zsh b/zsh/keybindings.zsh new file mode 100644 index 0000000..5fb1cd7 --- /dev/null +++ b/zsh/keybindings.zsh @@ -0,0 +1,12 @@ +# ===== keybindings +# use Vi(m) style key bindings. +bindkey -v + +# ===== history bindings +# make ^P and ^N behave like arrow keys (scroll through history) +bindkey -a '^P' history-beginning-search-backward +bindkey -a '^N' history-beginning-search-forward + +# re-enable incremental backward search for vim keybindings which is especially +# useful when the string is an argument and not the command. +bindkey '^R' history-incremental-pattern-search-backward diff --git a/zshrc b/zshrc index 5bb20e7..b334108 100644 --- a/zshrc +++ b/zshrc @@ -1,3 +1,5 @@ +# Loading keybindings first because activating Vi-bindings resets all keybinds. +source ~/.zsh/keybindings.zsh source ~/.zsh/setopt.zsh source ~/.zsh/checks.zsh source ~/.zsh/colors.zsh