Add zsh-vi-mode
This commit is contained in:
parent
0d4fd035d2
commit
5c1bbc9383
|
@ -0,0 +1,3 @@
|
||||||
|
logits
|
||||||
|
logits
|
||||||
|
OpenSwarm
|
45
zsh/.zshrc
45
zsh/.zshrc
|
@ -22,9 +22,20 @@ setopt autocd
|
||||||
typeset -g -A key
|
typeset -g -A key
|
||||||
|
|
||||||
# Use vi-mode
|
# Use vi-mode
|
||||||
bindkey -v
|
source ${XDG_CONFIG_HOME}/zsh/zsh-vi-mode/zsh-vi-mode.plugin.zsh
|
||||||
bindkey jj vi-cmd-mode
|
ZVM_VI_INSERT_ESCAPE_BINDKEY=jj
|
||||||
|
|
||||||
|
# Finally, make sure the terminal is in application mode, when zle is
|
||||||
|
# active. Only then are the values from $terminfo valid.
|
||||||
|
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
|
||||||
|
autoload -Uz add-zle-hook-widget
|
||||||
|
function zle_application_mode_start { echoti smkx }
|
||||||
|
function zle_application_mode_stop { echoti rmkx }
|
||||||
|
add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
|
||||||
|
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
|
||||||
|
fi
|
||||||
|
|
||||||
|
function zvm_after_init() {
|
||||||
key[Home]="${terminfo[khome]}"
|
key[Home]="${terminfo[khome]}"
|
||||||
key[End]="${terminfo[kend]}"
|
key[End]="${terminfo[kend]}"
|
||||||
key[Insert]="${terminfo[kich1]}"
|
key[Insert]="${terminfo[kich1]}"
|
||||||
|
@ -52,32 +63,13 @@ key[Shift-Tab]="${terminfo[kcbt]}"
|
||||||
[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history
|
[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history
|
||||||
[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete
|
[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete
|
||||||
|
|
||||||
# Finally, make sure the terminal is in application mode, when zle is
|
|
||||||
# active. Only then are the values from $terminfo valid.
|
|
||||||
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
|
|
||||||
autoload -Uz add-zle-hook-widget
|
|
||||||
function zle_application_mode_start { echoti smkx }
|
|
||||||
function zle_application_mode_stop { echoti rmkx }
|
|
||||||
add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
|
|
||||||
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
|
|
||||||
fi
|
|
||||||
|
|
||||||
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
|
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
|
||||||
zle -N up-line-or-beginning-search
|
zle -N up-line-or-beginning-search
|
||||||
zle -N down-line-or-beginning-search
|
zle -N down-line-or-beginning-search
|
||||||
|
|
||||||
[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-beginning-search
|
[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-beginning-search
|
||||||
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-beginning-search
|
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-beginning-search
|
||||||
|
|
||||||
|
|
||||||
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
|
|
||||||
zstyle ':completion::complete:*' gain-privileges 1
|
|
||||||
zstyle ':completion:*' rehash true
|
|
||||||
|
|
||||||
autoload -Uz compinit
|
|
||||||
compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
|
|
||||||
|
|
||||||
|
|
||||||
if [ -f "/usr/share/doc/pkgfile/command-not-found.zsh" ]; then
|
if [ -f "/usr/share/doc/pkgfile/command-not-found.zsh" ]; then
|
||||||
source /usr/share/doc/pkgfile/command-not-found.zsh
|
source /usr/share/doc/pkgfile/command-not-found.zsh
|
||||||
fi
|
fi
|
||||||
|
@ -91,10 +83,19 @@ elif [ -f "/usr/share/fzf/key-bindings.zsh" ]; then
|
||||||
source /usr/share/fzf/completion.zsh
|
source /usr/share/fzf/completion.zsh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Autosuggestions
|
|
||||||
if [ -f "/usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" ]; then
|
if [ -f "/usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" ]; then
|
||||||
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
|
||||||
|
zstyle ':completion::complete:*' gain-privileges 1
|
||||||
|
zstyle ':completion:*' rehash true
|
||||||
|
|
||||||
|
autoload -Uz compinit
|
||||||
|
compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
|
||||||
|
|
||||||
|
|
||||||
export HISTFILE="$XDG_STATE_HOME"/zsh/history
|
export HISTFILE="$XDG_STATE_HOME"/zsh/history
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 1f28e1886dc8e49f41b817634d5c7695b6abb145
|
Loading…
Reference in New Issue