Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ability to set custom ZVM_CURSOR_USER_DEFAULT #131

Closed
3 tasks done
dm9pZCAq opened this issue Oct 18, 2021 · 1 comment
Closed
3 tasks done

add ability to set custom ZVM_CURSOR_USER_DEFAULT #131

dm9pZCAq opened this issue Oct 18, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@dm9pZCAq
Copy link
Contributor

General information

  • Terminal program: st 0.8.4
  • ZSH version: 5.8
  • ZVM version: 0.8.4

Basic examination

  • I have read through the README page
  • I have the latest version of zsh-vi-mode
  • I have tested with another terminal program

Problem description

i heve "default" cursor set to be a "beam"
for st in config.h:

/*
 * Default shape of cursor
 * 2: Block ("█")
 * 4: Underline ("_")
 * 6: Bar ("|")
 * 7: Snowman ("☃")
 */
static unsigned int cursorshape = 6;

so it would be nice to customize ZVM_CURSOR_USER_DEFAULT


i think this is "elegant" solution is to move first case with ZVM_CURSOR_USER_DEFAULT to the end, so user can do something like this if they want

ZVM_CURSOR_USER_DEFAULT="${ZVM_CURSOR_BEAM}"

diff --git a/zsh-vi-mode.zsh b/zsh-vi-mode.zsh
index b7189cf..fa83cc3 100644
--- a/zsh-vi-mode.zsh
+++ b/zsh-vi-mode.zsh
@@ -3020,13 +3020,13 @@ function zvm_cursor_style() {
     # 256 colors the same way xterm does.
     xterm*|rxvt*|screen*|tmux*|konsole*|alacritty*|st*)
       case $style in
-        $ZVM_CURSOR_USER_DEFAULT) style='\e[0 q';;
         $ZVM_CURSOR_BLOCK) style='\e[2 q';;
         $ZVM_CURSOR_UNDERLINE) style='\e[4 q';;
         $ZVM_CURSOR_BEAM) style='\e[6 q';;
         $ZVM_CURSOR_BLINKING_BLOCK) style='\e[1 q';;
         $ZVM_CURSOR_BLINKING_UNDERLINE) style='\e[3 q';;
         $ZVM_CURSOR_BLINKING_BEAM) style='\e[5 q';;
+        $ZVM_CURSOR_USER_DEFAULT) style='\e[0 q';;
       esac
       ;;
     *) style='\e[0 q';;
@jeffreytse jeffreytse self-assigned this Oct 19, 2021
@jeffreytse jeffreytse added the enhancement New feature or request label Oct 19, 2021
jeffreytse added a commit that referenced this issue Oct 19, 2021
When you exit from a CLI program, this plugin will restore the
cursor to terminal's default, this feature allows you to custom
user default cursor instead of terminal's default.
jeffreytse added a commit that referenced this issue Oct 19, 2021
When you enter a CLI program from the prompt, this plugin will
restore the cursor to terminal's default, this feature allows you
to custom user default cursor instead of terminal's default.
@jeffreytse
Copy link
Owner

Hi @dm9pZCAq

Thanks for your issue, this feature has been supported now. Hope you have a good day!

Thanks and Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants