summaryrefslogtreecommitdiff
path: root/zsh/zscripts/keybindrc.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'zsh/zscripts/keybindrc.zsh')
-rwxr-xr-xzsh/zscripts/keybindrc.zsh41
1 files changed, 41 insertions, 0 deletions
diff --git a/zsh/zscripts/keybindrc.zsh b/zsh/zscripts/keybindrc.zsh
new file mode 100755
index 0000000..90c1e16
--- /dev/null
+++ b/zsh/zscripts/keybindrc.zsh
@@ -0,0 +1,41 @@
+#!/usr/bin/env zsh
+
+# Vi mode + requirements for ALL keybindings to work correctly
+bindkey -v
+export KEYTIMEOUT=1
+
+# Unbind some default keybindings
+#bindkey -r "^U" "^W" "^G" "^J" "^Q" "^R" "^[[200~"
+
+# Keybindings
+#autoload edit-command-line; zle -N edit-command-line # Edit line in Vim buffer
+#bindkey "^E" edit-command-line # Ctrl-e - edit line in Vim buffer
+bindkey "^[[H" beginning-of-line # Home Key
+bindkey "^[[4~" end-of-line # End Key
+bindkey "^[[P" delete-char # Delete Key
+bindkey "^[[4h" overwrite-mode # Insert Key
+bindkey "^D" kill-whole-line # Ctrl-d - delete line
+bindkey "^X" clear-screen # Ctrl-x - clear screen
+bindkey "^H" backward-delete-word # Ctrl-Backspace - delete entire word behind cursor
+bindkey "^[[M" delete-word # Ctrl-Delete - delete currect word in front of the cursor
+bindkey "^[[1;5D" emacs-backward-word # Ctrl-Right - go back one word
+bindkey "^[[1;3D" emacs-backward-word # Alt-Right - go back one word
+bindkey "^[[1;5C" emacs-forward-word # Ctrl-Left - go forward one word
+bindkey "^[[1;3C" emacs-forward-word # Alt-Left - go forward one word
+
+# Basic auto/tab complete
+autoload -U compinit
+zstyle ':completion:*' menu select
+zmodload zsh/complist
+compinit -d "$XDG_CACHE_HOME/zcompdump" # Change where .zcompdump is stored
+_comp_options+=(globdots) # Include hidden files.
+
+# Use ctrl+vi keys in tab complete menu
+bindkey -M menuselect '^h' vi-backward-char
+bindkey -M menuselect '^k' vi-up-line-or-history
+bindkey -M menuselect '^l' vi-forward-char
+bindkey -M menuselect '^j' vi-down-line-or-history
+bindkey -v '^?' backward-delete-char
+
+# Ignore ctrl-d to exit shell
+setopt ignore_eof