aboutsummaryrefslogtreecommitdiff
path: root/.config/zsh/user/bindings.zsh
diff options
context:
space:
mode:
authorsrdusr <trevorgray@srdusr.com>2024-03-07 11:18:46 +0200
committersrdusr <trevorgray@srdusr.com>2024-03-07 11:18:46 +0200
commit7473b17fc7ee8b0ee048cf1187bd989e8f7740ee (patch)
tree290c0a866d62b86454f6b73bd1a02aedd66f7557 /.config/zsh/user/bindings.zsh
parentce54a6047027004ef8700232be589d473a312ffe (diff)
downloaddotfiles-7473b17fc7ee8b0ee048cf1187bd989e8f7740ee.tar.gz
dotfiles-7473b17fc7ee8b0ee048cf1187bd989e8f7740ee.zip
Changed name
Diffstat (limited to '.config/zsh/user/bindings.zsh')
-rw-r--r--.config/zsh/user/bindings.zsh39
1 files changed, 39 insertions, 0 deletions
diff --git a/.config/zsh/user/bindings.zsh b/.config/zsh/user/bindings.zsh
new file mode 100644
index 0000000..ce8451b
--- /dev/null
+++ b/.config/zsh/user/bindings.zsh
@@ -0,0 +1,39 @@
+########## Vi mode ##########
+bindkey -v
+#bindkey -M viins '^?' backward-delete-char
+#local WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
+backward-kill-dir () {
+ local WORDCHARS=${WORDCHARS/\/}
+ zle backward-kill-word
+ zle -f kill
+}
+zle -N backward-kill-dir
+bindkey '^[^?' backward-kill-dir
+bindkey "^W" backward-kill-dir
+bindkey -M viins '^[[3~' delete-char
+bindkey -M vicmd '^[[3~' delete-char
+bindkey -v '^?' backward-delete-char
+bindkey -r '\e/'
+bindkey -s jk '\e'
+#bindkey "^W" backward-kill-word
+bindkey "^H" backward-delete-char # Control-h also deletes the previous char
+bindkey "^U" backward-kill-line
+bindkey "^[j" history-search-forward # or you can bind it to the down key "^[[B"
+bindkey "^[k" history-search-backward # or you can bind it to Up key "^[[A"
+
+# Define the 'autosuggest-execute' and 'autosuggest-accept' ZLE widgets
+autoload -Uz autosuggest-execute autosuggest-accept
+zle -N autosuggest-execute
+zle -N autosuggest-accept
+bindkey '^X' autosuggest-execute
+bindkey '^Y' autosuggest-accept
+
+# Edit line in vim with alt-e
+autoload edit-command-line; zle -N edit-command-line
+bindkey '^e' edit-command-line
+bindkey '^[e' edit-command-line # alt + e
+
+# Allow CTRL+D to exit zsh with partial command line (non empty line)
+exit_zsh() { exit }
+zle -N exit_zsh
+bindkey '^D' exit_zsh