From f8a2caa5a22a07c4268627f2adc7b2847ab01028 Mon Sep 17 00:00:00 2001 From: oreodave Date: Sun, 12 Apr 2020 01:51:53 +0100 Subject: ~pf_info setting and +vim cursor changes for zsh --- zshrc | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'zshrc') diff --git a/zshrc b/zshrc index e36fe18..a0d6b0c 100644 --- a/zshrc +++ b/zshrc @@ -3,7 +3,7 @@ # Important variables and stuff export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:~/.local/bin:~/Bin/binaries:~/.emacs.d/bin:~/.cargo/bin:~/Scripts export guile=guile2.2 -export PF_INFO="ascii title os memory uptime editor shell" +export PF_INFO="ascii title os memory uptime editor wm shell" export EDITOR="emacs" export SHELL="zsh" alias yapf='python2 -m yapf' @@ -49,7 +49,37 @@ zstyle ':completion:*' verbose true zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,' -# Programming +## Vim binds +bindkey -v +# Cursor +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[5 q' + fi +} + +zle -N zle-keymap-select +zle-line-init() { + zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) + echo -ne "\e[5 q" +} +zle -N zle-line-init +echo -ne '\e[5 q' # Use beam shape cursor on startup. +preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. + +# Menu +bindkey -M menuselect 'h' vi-backward-char +bindkey -M menuselect 'j' vi-up-line-or-history +bindkey -M menuselect 'k' vi-down-line-or-history +bindkey -M menuselect 'l' vi-forward-char + +## Programming editor() { nohup emacs $@ > /dev/null & } -- cgit v1.2.3-13-gbd6f