add vi mode to zsh and fzf to vim

This commit is contained in:
CramMK
2020-06-15 12:47:10 +02:00
parent 2c37d21295
commit ac59749c55
6 changed files with 54 additions and 16 deletions

View File

@@ -8,12 +8,19 @@ DISABLE_UNTRACKED_FILES_DIRTY="true"
plugins=(
git
common-aliases
compleat
history
common-aliases
ssh-agent
vi-mode
)
# https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins
# git: git shortcuts
# compleat: complete flags
# common-aliases: the name says it
# ssh-agent: preload ssh-keys
# vi-mode: use vim-bindings in zsh
zstyle :omz:plugins:ssh-agent identities
source $ZSH/oh-my-zsh.sh
@@ -34,13 +41,31 @@ alias fonts="/home/$USER/.local/share/fonts"
alias listfonts="fc-list :scalable=true:spacing=mono: family"
alias cachefonts="fc-cache -f -v"
alias c="clear"
alias v="vim"
alias w="vim ~/vimwiki/index.md"
# change cursor thickness for vi-mode
function zle-keymap-select {
if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = 'block' ]]; then
echo -ne '\e[1 q'
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then
echo -ne '\e[6 q'
fi
}
zle -N zle-keymap-select
_fix_cursor() {
echo -ne '\e[6 q'
}
precmd_functions+=(_fix_cursor)
# fzf
export FZF_DEFAULT_OPTS='--height 40% --preview="head {}" --layout=reverse --bind "enter:execute(vim {})" --bind "tab:down" --bind "btab:up"'
export FZF_DEFAULT_OPTS='--preview="head {}" --layout=reverse'
# Allow local aliases
if [ -f ~/.zshrc_local ]; then