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

From: Ryan Roden-Corrent <ryan_AT_rcorre.net>
Date: Sun, 24 Apr 2016 21:21:19 -0400

On Sat 04/23/16 12:55PM, Ryan Wilson wrote:
> ---- 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.
>
>

Thanks for the explanation! That explains why the weird behavior in the shell,
too, as I use use readline's 'vi mode'.

`terminfo` and `set termcap` both show ^[[15~ when TERM=st-256color.
In vim, it differs slightly. `set termcap` shows ^[[15~ when TERM=st-256color
and ^[[15;*~ when TERM=xterm.

I've reported a bug on ctrlp, because F5 seems to work for most other things in
vim (I can create bindings with it just fine). Still, let me know if anyone has
suggestions on how to resolve this on my end (I guess I could just always use
`TERM=xterm vim` until that causes another problem...).

-Ryan
Received on Mon Apr 25 2016 - 03:21:19 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 25 2016 - 03:24:11 CEST