commit 73ce69ca75bc0c49480d1d59c32d700c94853339
parent 2babf48da155fa5047f8877ab4d2840085cd227e
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Fri, 24 May 2019 11:08:12 +0200
Add nq, attempt to change cursor shape in zsh
Diffstat:
3 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/.gitmodules b/.gitmodules
@@ -22,3 +22,6 @@
[submodule "lib/sent"]
path = lib/sent
url = https://git.suckless.org/sent
+[submodule "lib/nq"]
+ path = lib/nq
+ url = https://github.com/leahneukirchen/nq
diff --git a/.zshrc b/.zshrc
@@ -79,25 +79,25 @@ _editor() {
zle -N _editor
bindkey '^e' _editor
-# launch vim+fzf with Ctrl-f
+# launch $EDITOR+fzf with Ctrl-f
_editor_fuzzy_find() {
- BUFFER="vim -c ':FZF'"
+ BUFFER="$EDITOR -c ':FZF'"
zle accept-line
}
zle -N _editor_fuzzy_find
bindkey '^f' _editor_fuzzy_find
-# launch vim+fzf for recent files with Ctrl-o
+# launch $EDITOR+fzf for recent files with Ctrl-o
_editor_fuzzy_history() {
- BUFFER="vim -c ':History'"
+ BUFFER="$EDITOR -c ':History'"
zle accept-line
}
zle -N _editor_fuzzy_history
bindkey '^o' _editor_fuzzy_history
-# launch vim+fzf+rg with Ctrl-g
+# launch $EDITOR+fzf+rg with Ctrl-g
_editor_fuzzy_grep() {
- BUFFER="vim -c ':Rg'"
+ BUFFER="$EDITOR -c ':Rg'"
zle accept-line
}
zle -N _editor_fuzzy_grep
@@ -192,15 +192,27 @@ rprompt() {
PROMPT="$(prompt_with_vimode $insert_mode)"
RPROMPT="$(rprompt)"
-function zle-line-init zle-keymap-select {
+function zle-line-init zle-keymap-select zle-line-finish {
PROMPT=$(prompt_with_vimode \
${${KEYMAP/vicmd/$normal_mode}/(main|viins)/$insert_mode})
RPROMPT=$(rprompt)
+
+ # new start
+ case $KEYMAP in
+ # vicmd) print -n -- "\E]50;CursorShape=0\C-G";; # block cursor
+ # viins|main) print -n -- "\E]50;CursorShape=1\C-G";; # line cursor
+ vicmd) print -rn -- $terminfo[cvvis];; # block cursor
+ viins|main) print -rn -- $terminfo[cnorm];; # less visible cursor
+ esac
+ # new end
+
zle reset-prompt
+ zle -R # new
}
zle -N zle-line-init
zle -N zle-keymap-select
+zle -N zle-line-finish
#### PLUGINS
diff --git a/lib/nq b/lib/nq
@@ -0,0 +1 @@
+Subproject commit c09c3a7df2464fc966c121a2a9a9d96f9fb0e98c