Re: [dev] [st] Why does F5 capitalize things?

From: Ryan Wilson <ryan_AT_enosys.org>
Date: Sat, 23 Apr 2016 12:55:17 -0500

 ---- On Sat, 23 Apr 2016 11:52:38 -0500 Ryan Roden-Corrent <ryan_AT_rcorre.net> wrote ----
> Hi all,
>
> On st 0.6 (and HEAD), pressing F5 capitalizes the word under the cursor.
> This isn't a huge deal, but it interferes with the vim plugin ctrlp
> (https://github.com/ctrlpvim/ctrlp.vim). F5 is supposed to refresh the file
> list, but instead it closes the search menu and capitalizes the word under the
> cursor.
 
When you press F5, st encodes it as the sequence ^[[15~, where ^[ indicates the
escape key. If that sequence isn't mapped to something in vim, then vim
interprets it just as if you'd typed those keys by hand. So ^[[15~ corresponds
to 1) hitting escape 2) running the command `[1`, which is invalid and does
nothing 3) running the command `5~`, which toggles the case of the next 5
characters.

The issue is most likely a problem with $TERM. Vim doesn't know that ^[[15~
means F5 without being told. That's the purpose of $TERM and terminfo, to tell
vim that when it sees ^[[15~, that's the terminal sending F5.

So you need to 1) ensure that TERM=st-256color, 2) ensure that st-256color
exists in /usr/share/terminfo/s/st256-color or in ~/.terminfo. If you use ssh,
they must be on the machines you ssh into as well.

If you run `infocmp` and the output says st-256color and kf5=\E[15~, then your
terminfo is good. Also `:set termcap` inside vim should show the same thing for
t_k5, and `:map` should show <F5> bound to something.

Setting TERM=xterm happens to work but it's not proper. It's telling programs
that st speaks the same control sequences as xterm, which is not quite correct.
Received on Sat Apr 23 2016 - 19:55:17 CEST

This archive was generated by hypermail 2.3.0 : Sat Apr 23 2016 - 20:00:19 CEST