Is it possible to make iTerm2 work with vim to differ shift-ctrl-X from ctrl-x?

350 views
Skip to first unread message

Martin Lundberg

unread,
Apr 8, 2011, 3:56:26 AM4/8/11
to iterm2-...@googlegroups.com
Hi,

I'm using vim through iTerm2 (actually I'm using vim through iTerm2 ->
tmux -> vim) and I'm wondering if it is possible to make iTerm2 work
with vim so that it differs ctrl-shift-X from ctrl-X?

Thanks,

-Martin

George Nachman

unread,
Apr 8, 2011, 11:06:41 AM4/8/11
to iterm2-...@googlegroups.com, iterm2-...@googlegroups.com
You can map it to an unused f key. See the xfree86 xterm column here:
http://aperiodic.net/phil/archives/Geekery/term-function-keys.html

Martin Lundberg

unread,
Apr 11, 2011, 2:34:44 PM4/11/11
to iterm2-...@googlegroups.com
Thanks George! I think I need a little more help even with that page.
I don't really understand what to do with that information.

George Nachman

unread,
Apr 11, 2011, 4:04:26 PM4/11/11
to iterm2-...@googlegroups.com, Martin Lundberg
You can map a key to F13 (code ^[O2P according to that page) by going to prefs->profiles->keys and click the plus to add a new mapping. Press the key combination that you want to use (say, ctrl-shift-X). For the action, select Send Escape Sequence. In the "characters to send" area put O2P.

In your .vimrc, put this:

:set <C-S-x>=^O2P
:map <C-S-x> dd

In this example, control-shift-x is mapped to "dd", which deletes a line. Just change dd to whatever action you want control-shift-x to do.

The reason we're using F13-F37's codes are because we know they won't conflict with any other key codes in use.

Martin Lundberg

unread,
Dec 25, 2018, 7:52:29 AM12/25/18
to iterm2-discuss
Any idea why this would stop working in tmux? If I set it up and try it in vim under tmux instead of getting ^[O2P I get ^[[1;2R].

George Nachman

unread,
Dec 28, 2018, 12:13:33 PM12/28/18
to iterm2-...@googlegroups.com
1;2R is a cursor position reporting code. I would expect tmux to handle that code rather than to pass it through to iTerm2. File an issue with a debug log and I'll have a deeper look.


--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages