about summary refs log tree commit diff stats
path: root/modules/by-name/zs/zsh/config/keymaps/vicmd.zsh
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-21 22:39:32 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-21 22:39:32 +0200
commit67fc567939eec10fcea47cd3569d1682698a5724 (patch)
tree5b7e6381822de15020de6cee73969acb630f78a1 /modules/by-name/zs/zsh/config/keymaps/vicmd.zsh
parentbuild(treewide): Update (diff)
downloadnixos-config-67fc567939eec10fcea47cd3569d1682698a5724.tar.gz
nixos-config-67fc567939eec10fcea47cd3569d1682698a5724.zip
feat(modules/zsh): Nearly completely rewrite
New features:
  - The `vi` mode is now actually useful
  - The whole history search/suggestion has been integrated into `atuin`
  - The `edit-command-line` plugin does no longer print useless stuff
  - and miscellaneous other things.
Diffstat (limited to 'modules/by-name/zs/zsh/config/keymaps/vicmd.zsh')
-rw-r--r--modules/by-name/zs/zsh/config/keymaps/vicmd.zsh156
1 files changed, 156 insertions, 0 deletions
diff --git a/modules/by-name/zs/zsh/config/keymaps/vicmd.zsh b/modules/by-name/zs/zsh/config/keymaps/vicmd.zsh
new file mode 100644
index 00000000..ceb4f348
--- /dev/null
+++ b/modules/by-name/zs/zsh/config/keymaps/vicmd.zsh
@@ -0,0 +1,156 @@
+bindkey -N vicmd
+
+# Bind in string to out string
+bindkey -s -M vicmd "gUU" "gUgU"
+bindkey -s -M vicmd "guu" "gugu"
+bindkey -s -M vicmd "g~~" "g~g~"
+
+# Movement
+bindkey -M vicmd "h" vi-backward-char
+bindkey -M vicmd "t" history-substring-search-down
+bindkey -M vicmd "n" history-substring-search-up
+bindkey -M vicmd "s" vi-forward-char
+
+# Search history
+bindkey -M vicmd "/" atuin-up-search-vicmd
+bindkey -M vicmd "?" atuin-down-search-vicmd
+bindkey -M vicmd "l" vi-repeat-search
+bindkey -M vicmd "L" vi-rev-repeat-search
+
+bindkey -M vicmd "f" vi-find-next-char
+bindkey -M vicmd "F" vi-find-prev-char
+
+# Tell the user that more ESC is not possible
+bindkey -M vicmd "^[" beep
+
+
+# > Fetch the history line specified by the numeric argument.
+# > This defaults to the current history line (i.e. the one that isn't history yet).
+bindkey -M vicmd "G" vi-fetch-history
+bindkey -M vicmd "gg" beginning-of-buffer-or-history
+
+bindkey -M vicmd -R "1"-"9" digit-argument
+
+bindkey -M vicmd "^L" clear-screen
+
+bindkey -M vicmd ":" execute-named-cmd
+
+bindkey -M vicmd "=" list-choices
+
+bindkey -M vicmd "^V" vi-quoted-insert
+
+bindkey -M vicmd "#" vi-pound-insert
+bindkey -M vicmd "u" undo
+
+
+bindkey -M vicmd "A" vi-add-eol
+bindkey -M vicmd "i" vi-insert
+bindkey -M vicmd "a" vi-add-next
+bindkey -M vicmd "I" vi-insert-bol
+bindkey -M vicmd "O" vi-open-line-above
+bindkey -M vicmd "o" vi-open-line-below
+
+bindkey -M vicmd "c" vi-change
+bindkey -M vicmd "C" vi-change-eol
+bindkey -M vicmd "S" vi-change-whole-line
+
+
+bindkey -M vicmd "b" vi-backward-word
+bindkey -M vicmd "ge" vi-backward-word-end
+bindkey -M vicmd "B" vi-backward-blank-word
+bindkey -M vicmd "gE" vi-backward-blank-word-end
+
+bindkey -M vicmd "w" vi-forward-word
+bindkey -M vicmd "e" vi-forward-word-end
+bindkey -M vicmd "W" vi-forward-blank-word
+bindkey -M vicmd "E" vi-forward-blank-word-end
+
+
+bindkey -M vicmd "x" vi-delete-char
+bindkey -M vicmd "X" vi-backward-delete-char
+bindkey -M vicmd "d" vi-delete
+bindkey -M vicmd "D" vi-kill-eol
+
+bindkey -M vicmd "y" vi-yank
+bindkey -M vicmd "Y" vi-yank-whole-line
+bindkey -M vicmd "p" vi-put-after
+bindkey -M vicmd "P" vi-put-before
+
+
+bindkey -M vicmd "~" vi-swap-case
+bindkey -M vicmd "g~" vi-oper-swap-case
+bindkey -M vicmd "gU" vi-up-case
+bindkey -M vicmd "gu" vi-down-case
+
+
+bindkey -M vicmd "\^" vi-first-non-blank
+bindkey -M vicmd "\$" vi-end-of-line
+bindkey -M vicmd "0" vi-digit-or-beginning-of-line
+
+bindkey -M vicmd "|" vi-goto-column
+bindkey -M vicmd "\`" vi-goto-mark
+bindkey -M vicmd "'" vi-goto-mark-line
+
+
+bindkey -M vicmd ">" vi-indent
+bindkey -M vicmd "<" vi-unindent
+
+
+bindkey -M vicmd "%" vi-match-bracket
+
+
+bindkey -M vicmd "." vi-repeat-change
+bindkey -M vicmd ";" vi-repeat-find
+bindkey -M vicmd "," vi-rev-repeat-find
+
+
+bindkey -M vicmd "R" vi-replace
+bindkey -M vicmd "r" vi-replace-chars
+# bindkey -M vicmd "s" vi-substitute
+
+
+bindkey -M vicmd "\"" vi-set-buffer
+bindkey -M vicmd "m" vi-set-mark
+
+
+bindkey -M vicmd "ga" what-cursor-position
+
+bindkey -M vicmd "V" visual-line-mode
+bindkey -M vicmd "v" visual-mode
+
+# Selection
+bindkey -M vicmd "aW" select-a-blank-word
+bindkey -M vicmd "aa" select-a-shell-word
+bindkey -M vicmd "aw" select-a-word
+bindkey -M vicmd "iW" select-in-blank-word
+bindkey -M vicmd "ia" select-in-shell-word
+bindkey -M vicmd "iw" select-in-word
+bindkey -M vicmd "a(" select-bracketed
+bindkey -M vicmd "a)" select-bracketed
+bindkey -M vicmd "a<" select-bracketed
+bindkey -M vicmd "a>" select-bracketed
+bindkey -M vicmd "aB" select-bracketed
+bindkey -M vicmd "a[" select-bracketed
+bindkey -M vicmd "a]" select-bracketed
+bindkey -M vicmd "ab" select-bracketed
+bindkey -M vicmd "a{" select-bracketed
+bindkey -M vicmd "a}" select-bracketed
+bindkey -M vicmd "i(" select-bracketed
+bindkey -M vicmd "i)" select-bracketed
+bindkey -M vicmd "i<" select-bracketed
+bindkey -M vicmd "i>" select-bracketed
+bindkey -M vicmd "iB" select-bracketed
+bindkey -M vicmd "i[" select-bracketed
+bindkey -M vicmd "i]" select-bracketed
+bindkey -M vicmd "ib" select-bracketed
+bindkey -M vicmd "i{" select-bracketed
+bindkey -M vicmd "i}" select-bracketed
+bindkey -M vicmd "a'" select-quoted
+bindkey -M vicmd "a\"" select-quoted
+bindkey -M vicmd "a\`" select-quoted
+bindkey -M vicmd "i'" select-quoted
+bindkey -M vicmd "i\"" select-quoted
+bindkey -M vicmd "i\`" select-quoted
+
+# Support pasted text
+bindkey -M vicmd "^[[200~" bracketed-paste