From bef97a0aa0da03c5d84412f1df709033d94cfe27 Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Mon, 28 Jul 2025 09:06:00 -0500 Subject: [PATCH] ZSH: Better vim mode --- config.toml | 2 +- home/.config/zsh/03-plugins.zsh | 4 +++ home/.config/zsh/06-keybinds.zsh | 47 -------------------------------- 3 files changed, 5 insertions(+), 48 deletions(-) diff --git a/config.toml b/config.toml index 44a40c5b..7e8cd4b6 100644 --- a/config.toml +++ b/config.toml @@ -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] diff --git a/home/.config/zsh/03-plugins.zsh b/home/.config/zsh/03-plugins.zsh index 1712bf54..28bd85ad 100644 --- a/home/.config/zsh/03-plugins.zsh +++ b/home/.config/zsh/03-plugins.zsh @@ -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 diff --git a/home/.config/zsh/06-keybinds.zsh b/home/.config/zsh/06-keybinds.zsh index bea3d85a..0247435b 100644 --- a/home/.config/zsh/06-keybinds.zsh +++ b/home/.config/zsh/06-keybinds.zsh @@ -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 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