[vim/vim] Control arrow keys don't move word per word when used with alacritty (Issue #9254)

246 views
Skip to first unread message

Gaëtan

unread,
Dec 2, 2021, 11:03:43 AM12/2/21
to vim/vim, Subscribed

Steps to reproduce

  • Install alacritty
  • Install vim
  • Run vim in alacritty
  • Put random content into it
  • Try to use arrow + Left key or arrow + Right key
  • it deletes lines instead of moving to left or right word

Expected behaviour

moving to left or right word

Operating system

Ubuntu 20.04.3

Version of Vim

8.1-2269

Logs and stack traces

No response


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

lacygoill

unread,
Dec 2, 2021, 12:59:06 PM12/2/21
to vim/vim, Subscribed

What's TERM?

Try this:

" Enable modified arrow keys, see  :help xterm-modifier-keys
execute "silent! set <xUp>=\<Esc>[@;*A"
execute "silent! set <xDown>=\<Esc>[@;*B"
execute "silent! set <xRight>=\<Esc>[@;*C"
execute "silent! set <xLeft>=\<Esc>[@;*D"

See :help xterm-modifier-keys.

Gaëtan

unread,
Dec 2, 2021, 1:02:44 PM12/2/21
to vim/vim, Subscribed

What's TERM?

❯ echo $TERM

alacritty

FYI this below works but feels like a workaround

map <ESC>[1;5A <C-Up>

map <ESC>[1;5B <C-Down>

map <ESC>[1;5C <C-Right>

map <ESC>[1;5D <C-Left>

imap <ESC>[1;5A <C-Up>

imap <ESC>[1;5B <C-Down>

imap <ESC>[1;5C <C-Right>

imap <ESC>[1;5D <C-Left>

Try this:

" Enable modified arrow keys, see  :help xterm-modifier-keys

execute "silent! set <xUp>=\<Esc>[@;*A"

execute "silent! set <xDown>=\<Esc>[@;*B"

execute "silent! set <xRight>=\<Esc>[@;*C"

execute "silent! set <xLeft>=\<Esc>[@;*D"

See :help xterm-modifier-keys.

this doesn't fix it

lacygoill

unread,
Dec 2, 2021, 1:11:34 PM12/2/21
to vim/vim, Subscribed

this doesn't fix it

Try to set 'ttymouse' to sgr, and try to reproduce with no config (and on master).

This works for me:

$ TERM=alacritty vim -Nu NONE +'execute "silent! set <xUp>=\<Esc>[@;*A"' +'nnoremap <C-Up> :echomsg "C-Up"<CR>' +'set ttymouse=sgr'

Pressing <C-Up> causes Vim to print C-Up on the command-line.

Gaëtan

unread,
Dec 3, 2021, 5:54:41 AM12/3/21
to vim/vim, Subscribed

I moved my .vimrc and .vim folder, git clone vim repo, compiled it so i'm on default configuration. I ran

❯ cat test

ewihfgoiweh fbhguasihfui fugwqefghuo fuqgwhefgh9o

❯ TERM=alacritty ./vim -Nu NONE +'execute "silent! set <xUp>=\<Esc>[@;*A"' +'nnoremap <C-Up> :echomsg "C-Up"<CR>' +'set ttymouse=sgr' test

And control C-Left or C-Right doesn't move to the next/previous word but it doesn't delete lines like it was doing before

lacygoill

unread,
Dec 3, 2021, 1:35:29 PM12/3/21
to vim/vim, Subscribed

And control C-Left or C-Right doesn't move to the next/previous word

My command was only meant to test <C-Up>. It did not set <xLeft> nor <xRight>, which are necessary for <C-Left> or <C-Right> to work.

A recent patch (8.2.3727) has fixed an issue which should help you. Could you make another test on master? And use this snippet:

" Enable modified arrow keys, see  :help xterm-modifier-keys
execute "set <xUp>=\<Esc>[@;*A"
execute "set <xDown>=\<Esc>[@;*B"
execute "set <xRight>=\<Esc>[@;*C"
execute "set <xLeft>=\<Esc>[@;*D"

Yes, it's the same one that I posted earlier. At the time I posted it, it didn't work for you because of an issue which was fixed in 8.2.3727. Now, it should work. If it doesn't work, post the output of :set! termcap.

Gaëtan

unread,
Dec 3, 2021, 2:00:01 PM12/3/21
to vim/vim, Subscribed

And control C-Left or C-Right doesn't move to the next/previous word

My command was only meant to test <C-Up>. It did not set <xLeft> nor <xRight>, which are necessary for <C-Left> or <C-Right> to work.

Sorry, I didn't pay attention to the command 🤦

A recent patch (8.2.3727) has fixed an issue which should help you. Could you make another test on master? And use this snippet:

" Enable modified arrow keys, see  :help xterm-modifier-keys

execute "set <xUp>=\<Esc>[@;*A"

execute "set <xDown>=\<Esc>[@;*B"

execute "set <xRight>=\<Esc>[@;*C"

execute "set <xLeft>=\<Esc>[@;*D"

I compiled, and i'm running VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec 3 2021 19:45:48) Included patches: 1-3729 without .vimrc except the snippet above, and not .vim (no plugins). Ran ./vim test and it fixed the issue! thank you a lot for your time. Now I have to wait Ubuntu pushing 8.2 x)

AFAICT we can close this issue.

Christian Brabandt

unread,
Dec 3, 2021, 2:12:17 PM12/3/21
to vim/vim, Subscribed

Closed #9254.

lacygoill

unread,
Dec 3, 2021, 2:13:46 PM12/3/21
to vim/vim, Subscribed

Now I have to wait Ubuntu pushing 8.2 x)

No you don't have to wait for 8.2. You can fix your issue right now, by setting 'ttymouse' to sgr, and by setting <xUp> & friends:

set ttymouse=sgr
execute "set <xUp>=\<Esc>[@;*A"
execute "set <xDown>=\<Esc>[@;*B"
execute "set <xRight>=\<Esc>[@;*C"
execute "set <xLeft>=\<Esc>[@;*D"

lacygoill

unread,
Dec 3, 2021, 2:15:32 PM12/3/21
to vim/vim, Subscribed

by setting 'ttymouse' to sgr

If that doesn't work, clear <DecMouse> manually:

set <DecMouse>=
execute "set <xUp>=\<Esc>[@;*A"
execute "set <xDown>=\<Esc>[@;*B"
execute "set <xRight>=\<Esc>[@;*C"
execute "set <xLeft>=\<Esc>[@;*D"

If that still doesn't work, again, post the output of :set! termcap.

Reply all
Reply to author
Forward
0 new messages