withoutboats / notty

A new kind of terminal
GNU Affero General Public License v3.0
2.3k stars 41 forks source link

Bug when using Command-T in vim #42

Open withoutboats opened 8 years ago

withoutboats commented 8 years ago

I haven't even tried to figure out what esc codes are actually involved, but the vim plugin command-t interacts very poorly with notty right now. Arrow keys don't work at all, and it is quirky in other ways as well.

Arrow key issues may have to do with the difference between "application mode" and "normal mode," an inexplicable "feature" of ANSI terminals.

Here is a script log of me opening vim and using command t, attempting to press the down arrow:

log file

withoutboats commented 8 years ago

Partial solution:

Adding this to my vimrc made arrow keys work in command-t:

nmap <esc>OA <Up>
nmap <esc>OB <Down>
nmap <esc>OC <Right>
nmap <esc>OD <Left>

This is very curious. Vim seems to be set to expect ^[OA etc as arrow keys, because it sends DECCKM on start up. When I type ctrl + v and then any arrow key in insert mode, I get ^[OA and so on as expected, both in the scaffolding terminal and in my other terminals. I don't know what we're missing for vim to recognize these keys as arrow keys for the purposes of mapping.