ZSH: Better vim mode
This commit is contained in:
parent
d2d35477dc
commit
bef97a0aa0
3 changed files with 5 additions and 48 deletions
|
@ -1,6 +1,6 @@
|
|||
[actions]
|
||||
dconf_load = "dconf load / < ~/.config/dconf.ini"
|
||||
kanagawa_compile = "vim +KanagawaCompile +qa"
|
||||
kanagawa_compile = "nvim +KanagawaCompile +qa"
|
||||
scripts_chmod = "chmod +x ~/.scripts/*"
|
||||
|
||||
[config]
|
||||
|
|
|
@ -22,6 +22,10 @@ zinit light zsh-users/zsh-history-substring-search
|
|||
zinit ice wait'1' lucid atload'source $HOME/.config/zsh/04-aliases.zsh'
|
||||
zinit light wfxr/forgit
|
||||
|
||||
# better vi mode
|
||||
zinit ice lucid depth=1
|
||||
zinit light jeffreytse/zsh-vi-mode
|
||||
|
||||
# lots of completions
|
||||
zinit ice wait'1' lucid as'completion'
|
||||
zinit light zsh-users/zsh-completions
|
||||
|
|
|
@ -1,50 +1,3 @@
|
|||
# this is from https://github.com/robbyrussell/oh-my-zsh/issues/7330#issuecomment-475844784
|
||||
typeset -A key
|
||||
|
||||
key[Home]=${terminfo[khome]}
|
||||
|
||||
key[End]=${terminfo[kend]}
|
||||
key[Insert]=${terminfo[kich1]}
|
||||
key[Delete]=${terminfo[kdch1]}
|
||||
key[Up]=${terminfo[kcuu1]}
|
||||
key[Down]=${terminfo[kcud1]}
|
||||
key[Left]=${terminfo[kcub1]}
|
||||
key[Right]=${terminfo[kcuf1]}
|
||||
key[PageUp]=${terminfo[kpp]}
|
||||
key[PageDown]=${terminfo[knp]}
|
||||
|
||||
# setup key accordingly
|
||||
[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
|
||||
[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
|
||||
[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
|
||||
[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
|
||||
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" history-substring-search-up
|
||||
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" history-substring-search-down
|
||||
[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
|
||||
[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
|
||||
[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history
|
||||
[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history
|
||||
|
||||
# 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
|
||||
function zle-line-init () {
|
||||
printf '%s' "${terminfo[smkx]}"
|
||||
}
|
||||
function zle-line-finish () {
|
||||
printf '%s' "${terminfo[rmkx]}"
|
||||
}
|
||||
zle -N zle-line-init
|
||||
zle -N zle-line-finish
|
||||
fi
|
||||
|
||||
# use <ESC> e to open command in editor
|
||||
autoload edit-command-line; zle -N edit-command-line
|
||||
bindkey -M vicmd e edit-command-line
|
||||
|
||||
# bind delete in normal mode
|
||||
bindkey -M vicmd '^[[3~' delete-char
|
||||
|
||||
# Rebind fzf to ctrl+f
|
||||
bindkey '^F' fzf-file-widget
|
||||
bindkey '^T' transpose-chars
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue