Changing command key shortcuts to work with Vim

393 views
Skip to first unread message

Tony McDaniel

unread,
Sep 23, 2012, 6:53:09 PM9/23/12
to iterm2-...@googlegroups.com
I have several custom shortcuts for MacVim that use the Command key.
They work fine in the GUI, but not in iTerm2. For example, Cmd-/ is
mapped to NERDCommenterToggle, but in iTerm2 it highlights the current
cursor position. I also use Cmd-[ and Cmd-] to increase/decrease
indenting which conflicts with Next/Previous Pane. Is there a way to get
this working?

George Nachman

unread,
Oct 5, 2012, 7:34:06 PM10/5/12
to iterm2-...@googlegroups.com
It'll be hard. You'll need to map keystrokes in iTerm2 to send escape codes (or something) to vim. Problem is, iTerm2 doesn't know when you're in vim or not, they'd always be active. I'd suggest using a key combo other than cmd because that will probably step on lots of important shortcuts. FWIW, you can assign key mappings in prefs->profiles->keys.

TJ Luoma

unread,
Oct 5, 2012, 8:04:36 PM10/5/12
to iterm2-...@googlegroups.com
There is a way.

Keyboard Maestro.

http://www.keyboardmaestro.com/main/

You could program it to use your vim commands for certain keystrokes
"Only If" the iTerm window has 'vim' in the Title… and then make sure
that your shell sets the Titlebar properly. Mine does, but I don't
know if that's standard or the something special that I did.

Surely someone here can explain HOWTO if you need assistance. I can
help with the Keyboard Maestro part of it if you need it.

TjL

ps - I'm not connected to Keyboard Maestro except as a customer. I did
write about some of the ways I use it at
http://www.tuaw.com/2012/10/01/keyboard-maestro-and-the-automation-mindset/
Reply all
Reply to author
Forward
0 new messages