feat: zsh cursor to mimic vim cursor

This commit is contained in:
ziro 2022-12-13 09:48:35 +07:00
parent 209041a90e
commit e4a115c325
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
3 changed files with 23 additions and 2 deletions

View file

@ -23,7 +23,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
elif [[ "$OSTYPE" == "linux-gnu" ]]; then
LOCAL_PATH="$(du "$HOME/.local/bin/" | cut -f2 | paste -sd ':')${PATH:+:${PATH}}"
fi
PATH="$HOME/.local/share/go/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_AVD_HOME:$HOME/.local/share/npm/bin:$HOME/.local/share/cargo/bin:$LOCAL_PATH${PATH:+:${PATH}}"
PATH="$HOME/.pub-cache/bin:$HOME/.local/share/go/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_AVD_HOME:$HOME/.local/share/npm/bin:$HOME/.local/share/cargo/bin:$LOCAL_PATH${PATH:+:${PATH}}"
# export RUST_SRC_PATH=$(rustc --print sysroot)/lib/rustlib/src/rust/library
# -- IBus stuff (IME)

View file

@ -6,6 +6,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
alias brew="sudo -H -u maintenance brew"
fi
alias punten='doas'
#sudo + vim without sacrificing config
alias sudovim='sudoedit'
alias doasvim='doasedit'
@ -128,3 +129,4 @@ alias docx2pdf='lowriter --convert-to pdf'
alias mirror-update='curl -s "https://archlinux.org/mirrorlist/?country=ID&country=SG&country=US&protocol=https&use_mirror_status=on" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 5 -'
alias center-pfetch="printf '\n'; pfetch | sed '\$d' | center -l"
[ "$TERM" = "xterm-kitty" ] && alias ssh="kitty +kitten ssh"

View file

@ -30,12 +30,31 @@ function zle-line-init zle-keymap-select {
PS2="%B%F{blue}?>%f%b "
# RPS1="${${KEYMAP/vicmd/-- NORMAL --}/(main|viins)/-- INSERT --}"
# RPS2=$RPS1
if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = 'block' ]]; then
echo -ne '\e[1 q'
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then
echo -ne '\e[5 q'
fi
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
precmd () { vcs_info }
_fix_cursor() {
echo -ne '\e[5 q'
}
precmd () {
vcs_info
_fix_cursor
}
#RPROMPT=\$vcs_info_msg_0_
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#60C0FF,bold,underline"
ZSH_AUTOSUGGEST_HISTORY_IGNORE="ls *,cd *"