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

Cursor is not changing in Alacritty #72

Closed
g6ai opened this issue Mar 28, 2021 · 12 comments
Closed

Cursor is not changing in Alacritty #72

g6ai opened this issue Mar 28, 2021 · 12 comments
Assignees
Labels
bug Something isn't working verified This issue was already verified

Comments

@g6ai
Copy link

g6ai commented Mar 28, 2021

When I use Alacritty as terminal, and with the alacritty terminfo they provided, the cursor shape does not change in vi-mode.

The pertinent alacritty.yml lines are:

https://github.com/g6ai/dotfiles/blob/db16f7463092592dc347fc946f1e78ef711ecb32/alacritty/alacritty_macos.yml#L352-L378

And I use these zsh-vi-mode settings in my .zshrc:

ZVM_KEYTIMEOUT=0.05
ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BEAM
ZVM_NORMAL_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BLOCK
@jeffreytse jeffreytse self-assigned this Mar 28, 2021
@jeffreytse jeffreytse added the bug Something isn't working label Mar 28, 2021
@GiancarloAparicio
Copy link

GiancarloAparicio commented Mar 28, 2021

I also use alacritty but it works for me
image
image

And in zsh-vi-mode I have only set

ZVM_LINE_INIT_MODE=$ZVM_MODE_NORMAL

If you are using powerlevel try to change the configuration, I remember that some things did not show well with zsh-vi-mode

@g6ai
Copy link
Author

g6ai commented Mar 28, 2021

@GiancarloAparicio Thanks for the info! Yes I'm using powerlevel10k as zsh theme. So I disabled it and use oh-my-zsh default theme (robyrussell), but the problem is still there. Could you provide your config so I can investigate?

@GiancarloAparicio
Copy link

My alacritty configuration is:

# Sorry, I don't have everything in a dotfile repository :(
env:
    TERM: xterm-256color

window:
    dimensions:
        columns: 115
        lines: 35
    padding:
        x: 0
        y: 0
    decorations: full

background_opacity: 0.88

dpi:
    x: 128.0
    y: 128.0

draw_bold_text_with_bright_colors: true

font:

    normal:
        family: 'MesloLGS NF'

    bold:
        family: 'MesloLGS NF'
    italic:
        family: 'MesloLGS NF'

    size: 9.0

    offset:
        x: 0
        y: 0

    glyph_offset:
        x: 0
        y: 0

    use_thin_strokes: false

debug.render_timer: false

colors:

    primary:
        background: '0x002635'
        foreground: '0xe6e6dc'
    normal:
        black: '0x00384d'
        red: '0xc43061'
        green: '0x7fc06e'
        yellow: '0xf08e48'
        blue: '0x1c8db2'
        magenta: '0xc694ff'
        cyan: '0x00cccc'
        white: '0x77929e'
    bright:
        black: '0x517f8d'
        red: '0xff5a67'
        green: '0x9cf087'
        yellow: '0xffcc1b'
        blue: '0x7eb2dd'
        magenta: '0xfb94ff'
        cyan: '0x00ffff'
        white: '0xb7cff9'
    cursor:
        text: '0x002635'
        cursor: '0xffcc1b'

key_bindings:
    - { key: V, mods: Command, action: Paste }
    - { key: C, mods: Command, action: Copy }
    - { key: Q, mods: Command, action: Quit }
    - { key: W, mods: Command, action: Quit }
    - { key: N, mods: Command, action: SpawnNewInstance }
    - { key: Home, chars: "\x1bOH", mode: AppCursor }
    - { key: Home, chars: "\x1b[1~", mode: ~AppCursor }
    - { key: End, chars: "\x1bOF", mode: AppCursor }
    - { key: End, chars: "\x1b[4~", mode: ~AppCursor }
    - { key: PageUp, mods: Shift, chars: "\x1b[5;2~" }
    - { key: PageUp, mods: Control, chars: "\x1b[5;5~" }
    - { key: PageUp, chars: "\x1b[5~" }
    - { key: PageDown, mods: Shift, chars: "\x1b[6;2~" }
    - { key: PageDown, mods: Control, chars: "\x1b[6;5~" }
    - { key: PageDown, chars: "\x1b[6~" }
    - { key: Left, mods: Shift, chars: "\x1b[1;2D" }
    - { key: Left, mods: Control, chars: "\x1b[1;5D" }
    - { key: Left, mods: Alt, chars: "\x1b[1;3D" }
    - { key: Left, chars: "\x1b[D", mode: ~AppCursor }
    - { key: Left, chars: "\x1bOD", mode: AppCursor }
    - { key: Right, mods: Shift, chars: "\x1b[1;2C" }
    - { key: Right, mods: Control, chars: "\x1b[1;5C" }
    - { key: Right, mods: Alt, chars: "\x1b[1;3C" }
    - { key: Right, chars: "\x1b[C", mode: ~AppCursor }
    - { key: Right, chars: "\x1bOC", mode: AppCursor }
    - { key: Up, mods: Shift, chars: "\x1b[1;2A" }
    - { key: Up, mods: Control, chars: "\x1b[1;5A" }
    - { key: Up, mods: Alt, chars: "\x1b[1;3A" }
    - { key: Up, chars: "\x1b[A", mode: ~AppCursor }
    - { key: Up, chars: "\x1bOA", mode: AppCursor }
    - { key: Down, mods: Shift, chars: "\x1b[1;2B" }
    - { key: Down, mods: Control, chars: "\x1b[1;5B" }
    - { key: Down, mods: Alt, chars: "\x1b[1;3B" }
    - { key: Down, chars: "\x1b[B", mode: ~AppCursor }
    - { key: Down, chars: "\x1bOB", mode: AppCursor }
    - { key: Tab, mods: Shift, chars: "\x1b[Z" }
    - { key: F1, chars: "\x1bOP" }
    - { key: F2, chars: "\x1bOQ" }
    - { key: F3, chars: "\x1bOR" }
    - { key: F4, chars: "\x1bOS" }
    - { key: F5, chars: "\x1b[15~" }
    - { key: F6, chars: "\x1b[17~" }
    - { key: F7, chars: "\x1b[18~" }
    - { key: F8, chars: "\x1b[19~" }
    - { key: F9, chars: "\x1b[20~" }
    - { key: F10, chars: "\x1b[21~" }
    - { key: F11, chars: "\x1b[23~" }
    - { key: F12, chars: "\x1b[24~" }
    - { key: Back, chars: "\x7f" }
    - { key: Back, mods: Alt, chars: "\x1b\x7f" }
    - { key: Insert, chars: "\x1b[2~" }
    - { key: Delete, chars: "\x1b[3~" }

  
mouse_bindings:
    - { mouse: Middle, action: PasteSelection }

mouse:
    double_click: { threshold: 300 }
    triple_click: { threshold: 300 }

selection:
    semantic_escape_chars: ',│`|:"'' ()[]{}<>'

My .zshrc is divided into several files, but the general configuration and that of zsh-vi-mode is:

if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"

plugins=( 
    git 
    asdf 
    fzf-tab 
    fzf 
    zsh-autosuggestions 
    zsh-vi-mode 
)

source $ZSH/oh-my-zsh.sh
source $ZSH_CUSTOM/source/fzf.zsh
....
#-------------------------------------------------------------------

export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi
export EDITOR='nvim'


#-------------------------------------------------------------------
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

#-------------------------------------------------------------------
# Always starting with normal mode for each command line
ZVM_LINE_INIT_MODE=$ZVM_MODE_NORMAL

# Define an init function and append to zvm_after_init_commands
function my_init() {
  [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
}
zvm_after_init_commands+=(my_init)

I have not configured much of zsh-vi-mode and it works for me, maybe it is the order in which the plugins are executed, I could not tell you the truth

@g6ai
Copy link
Author

g6ai commented Mar 28, 2021

@GiancarloAparicio Great, I'll try investigate this issue with your config. I only recently switched to Alacritty, I have to admit although it has some improvement on speed (which is under debate as some claims it's actually high throughput rather than low latency), it also has some problems that are really painful to solve. One small example is this issue which may or may not be my config problem.

I just tried kitty as an alternative. This issue is gone, and kitty also has some more subtle design as far as I can tell, e.g. their terminfo is called xterm-kitty, which avoided some problems because its prefix is xterm and hence recognizable by many shell tools. Alacritty's terminfo is named alacritty, so I had to deal with those problems when I ssh into other machine.

@jeffreytse I think this should be an Alacritty issue, should I close it?

@jeffreytse
Copy link
Owner

jeffreytse commented Mar 29, 2021

Hi @g6ai

Could you try echo $TERM and tell me what the result is? And @GiancarloAparicio thanks for your useful information, too. : )

Thanks and regards

@GiancarloAparicio
Copy link

@jeffreytse

echo $TERM
screen-256color

@jeffreytse
Copy link
Owner

jeffreytse commented Mar 29, 2021

I just installed alacritty, the cursor feature is perfect in my enviroment, my alacritty version is as below:

image

@jeffreytse
Copy link
Owner

Hi @GiancarloAparicio

You said that you remember some things did not show well with zsh-vi-mode, could you tell me some details? : )

Thanks and regards

@g6ai
Copy link
Author

g6ai commented Mar 29, 2021

@jeffreytse My $TERM is alacritty.

@GiancarloAparicio I see you set the TERM to xterm-256color in your Alacritty config. Well I can also use zsh-vi-mode without a problem using xterm-256color terminfo. However, it is recommended to use alacritty terminfo in their instructions because otherwise you may lose some display feature.

@jeffreytse jeffreytse added the verified This issue was already verified label Mar 29, 2021
@jeffreytse
Copy link
Owner

Hi @g6ai

Thanks for the reporting and this issue has been addressed and settled down. Please update your plugin to the latest version.

Thanks and regards

@g6ai
Copy link
Author

g6ai commented Mar 29, 2021

@jeffreytse Sir you are most brilliant! Thanks for the fix!

@g6ai g6ai closed this as completed Mar 29, 2021
@jeffreytse
Copy link
Owner

jeffreytse commented Mar 29, 2021

@g6ai You are welcome, It's my honor to be able to help you! If you like my works, very welcome to be my prior sponsor, it will keep these open-source works sustainable and make my new ideas come true. 😝

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working verified This issue was already verified
Projects
None yet
Development

No branches or pull requests

3 participants