@@ -61,23 +61,45 @@ bindkey -s '^Xgs' 'git status^M' # ^M = Enter (auto-execute)
6161bindkey -s ' ^Xgd' ' git diff '
6262bindkey -s ' ^Xgl' ' git log --oneline -10^M'
6363
64+ # Vi command mode: git shortcuts
65+ # The "x" prefix is a mnemonic for "expansion" (mirroring ^X in emacs mode).
66+ # Simple insertions use 'i' prefix to enter insert mode before the text.
67+ bindkey -M vicmd ' xgc' _hotkey_git_commit
68+ bindkey -M vicmd -s ' xga' ' igit add '
69+ bindkey -M vicmd -s ' xgp' ' igit push'
70+ bindkey -M vicmd -s ' xgP' ' igit push --force-with-lease'
71+ bindkey -M vicmd -s ' xgs' ' igit status^M'
72+ bindkey -M vicmd -s ' xgd' ' igit diff '
73+ bindkey -M vicmd -s ' xgl' ' igit log --oneline -10^M'
74+
6475# Docker shortcuts
6576bindkey -s ' ^Xdc' ' docker compose '
6677bindkey -s ' ^Xdp' ' docker ps'
6778_hotkey_docker_exec () { _insert_with_cursor ' docker exec -it {CURSOR} /bin/bash' }
6879zle -N _hotkey_docker_exec
6980bindkey ' ^Xde' _hotkey_docker_exec
7081
82+ # Vi command mode: docker shortcuts
83+ bindkey -M vicmd -s ' xdc' ' idocker compose '
84+ bindkey -M vicmd -s ' xdp' ' idocker ps'
85+ bindkey -M vicmd ' xde' _hotkey_docker_exec
86+
7187# Common command patterns
7288# bindkey -s '^Xll' 'ls -lah^M'
7389# bindkey -s '^Xcd' 'cd ..^M'
7490bindkey -s ' ^Xmk' ' mkdir -p '
7591
92+ # Vi command mode: common commands
93+ bindkey -M vicmd -s ' xmk' ' imkdir -p '
94+
7695# Date insertion
7796_hotkey_insert_date () { LBUFFER+=$( date ' +%Y-%m-%d' ) }
7897zle -N _hotkey_insert_date
7998bindkey ' ^Xdd' _hotkey_insert_date
8099
100+ # Vi command mode: date insertion
101+ bindkey -M vicmd ' xdd' _hotkey_insert_date
102+
81103# Search patterns
82104_hotkey_find () { _insert_with_cursor ' find . -name "{CURSOR}"' }
83105zle -N _hotkey_find
@@ -87,6 +109,10 @@ _hotkey_rg() { _insert_with_cursor 'rg "{CURSOR}" .' }
87109zle -N _hotkey_rg
88110bindkey ' ^Xrg' _hotkey_rg
89111
112+ # Vi command mode: search patterns
113+ bindkey -M vicmd ' xfg' _hotkey_find
114+ bindkey -M vicmd ' xrg' _hotkey_rg
115+
90116# SSH shortcuts (customize with your common hosts)
91117# bindkey -s '^Xsh' 'ssh user@hostname'
92118
0 commit comments