---
** [tickets:#77] Mapping C-Arrow in Vim**
**Status:** open
**Created:** Tue Nov 12, 2013 12:08 PM UTC by Paul Gideon Dann
**Last Updated:** Tue Nov 12, 2013 12:08 PM UTC
**Owner:** nobody
Not so much a bug as a comment regarding the FAQ, which mentioned that examples
of how to map special keys in Vim without requiring xterm-keys would be welcome.
>From the following:
https://github.com/godlygeek/vim-files/blob/master/plugin/terminalkeys.vim
I came to this "simplified" solution:
<pre>
set ttimeoutlen=100
if &term == 'screen'
set <F25>=^[[A
map <F25> <C-Up>
map! <F25> <C-Up>
set <F26>=^[[B
map <F26> <C-Down>
map! <F26> <C-Down>
set <F27>=^[[C
map <F27> <C-Right>
map! <F27> <C-Right>
set <F28>=^[[D
map <F28> <C-Left>
map! <F28> <C-Left>
endif
</pre>
For some reason, Vim receives `^[OA` for `<Up>` and `^[[A` for `<C-Up>`,
whereas `cat -v` receives them the other way around, in the same session. No
idea why, but this works. There are no terminfo keycode names we can set
directly for `<C-Up>` and friends, but it's important that we not simply map
the escape sequence to the final `<C-Up>` using `map`, because that would
result in an annoying delay when pressing <Esc> to leave insert mode.
Specifying `ttimeoutlen` allows us to greatly reduce the length of time Vim
waits after receiving an `<Esc>` code before deciding it wasn't one of these
combinations.
---
Sent from sourceforge.net because tmux-users@lists.sourceforge.net is
subscribed to https://sourceforge.net/p/tmux/tickets/
To unsubscribe from further messages, a project admin can change settings at
https://sourceforge.net/p/tmux/admin/tickets/options. Or, if this is a mailing
list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users