Improve zsh vi-mode handling
Moved mode indicator to more immediately visible prompt location. Allowed deletions and adding spaces regardless of mode. Allow moving backwards through history and searching through terminal input history.
This commit is contained in:
parent
b76b3ca4ca
commit
a29ce0aabf
2 changed files with 24 additions and 1 deletions
|
@ -39,6 +39,7 @@
|
||||||
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
|
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
|
||||||
# =========================[ Line #1 ]=========================
|
# =========================[ Line #1 ]=========================
|
||||||
# os_icon # os identifier
|
# os_icon # os identifier
|
||||||
|
vi_mode # vi mode (you don't need this if you've enabled prompt_char)
|
||||||
dir # current directory
|
dir # current directory
|
||||||
# =========================[ Line #2 ]=========================
|
# =========================[ Line #2 ]=========================
|
||||||
newline
|
newline
|
||||||
|
@ -87,7 +88,6 @@
|
||||||
vim_shell # vim shell indicator (:sh)
|
vim_shell # vim shell indicator (:sh)
|
||||||
midnight_commander # midnight commander shell (https://midnight-commander.org/)
|
midnight_commander # midnight commander shell (https://midnight-commander.org/)
|
||||||
nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
|
nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
|
||||||
vi_mode # vi mode (you don't need this if you've enabled prompt_char)
|
|
||||||
# vpn_ip # virtual private network indicator
|
# vpn_ip # virtual private network indicator
|
||||||
# load # CPU load
|
# load # CPU load
|
||||||
# disk_usage # disk usage
|
# disk_usage # disk usage
|
||||||
|
|
|
@ -105,6 +105,29 @@ bindkey " " globalias
|
||||||
bindkey "^ " magic-space # control-space to bypass completion
|
bindkey "^ " magic-space # control-space to bypass completion
|
||||||
bindkey -M isearch " " magic-space # normal space during searches
|
bindkey -M isearch " " magic-space # normal space during searches
|
||||||
|
|
||||||
|
# VIM MODE for the shell
|
||||||
|
# enable vim mode on pressing escape
|
||||||
|
bindkey -v
|
||||||
|
# remove the delay for switching modes
|
||||||
|
export KEYTIMEOUT=1
|
||||||
|
# space puts a space, even in cmd mode
|
||||||
|
bindkey -a ' ' magic-space
|
||||||
|
# always allow backspace/delete to remove letters
|
||||||
|
bindkey '^?' backward-delete-char
|
||||||
|
bindkey -a '^?' backward-delete-char
|
||||||
|
bindkey '^h' backward-delete-char
|
||||||
|
bindkey -a '^h' backward-delete-char
|
||||||
|
# and forward with delete
|
||||||
|
bindkey '^[[3~' delete-char
|
||||||
|
bindkey -a '^[[3~' delete-char
|
||||||
|
# always allow removing words with <c-w>
|
||||||
|
bindkey -a '^w' backward-kill-word
|
||||||
|
# enable cycling through previous commands with <c-p/n>
|
||||||
|
bindkey '^P' up-line-or-history
|
||||||
|
bindkey '^N' down-line-or-history
|
||||||
|
# search history backwards <c-r>
|
||||||
|
bindkey '^r' history-incremental-search-backward
|
||||||
|
|
||||||
# Deduplicate PATH - remove any duplicate entries from PATH
|
# Deduplicate PATH - remove any duplicate entries from PATH
|
||||||
# from: https://unix.stackexchange.com/questions/40749/remove-duplicate-path-entries-with-awk-command
|
# from: https://unix.stackexchange.com/questions/40749/remove-duplicate-path-entries-with-awk-command
|
||||||
get_var() {
|
get_var() {
|
||||||
|
|
Loading…
Reference in a new issue