Escape sequences work in Vim, but mishandled on the command line

120 views
Skip to first unread message

Ivan Brennan

unread,
Jan 11, 2016, 2:13:16 PM1/11/16
to iterm2-discuss
Maybe "mishandled" is the wrong word, but when iTerm is configured to send escape sequences for certain key-combinations (e.g. Shift-Space), I can use them to map keys in vim, but when I'm at the command line, in Bash, the characters following the CSI ( ^[[ ) aren't escaped. Maybe I need add to add something to my bashrc telling the shell how to handle such escape sequences?

For example, I followed the ideas in the libtermkey specification (http://www.leonerd.org.uk/hacks/fixterms/) and configured iTerm to send ^[[32;2u when Shift-Space is typed. In my vimrc I have these lines:

set   <F13>=^[[32;2u
map  
<F13> <S-Space>
map
!  <F13> <S-Space>

which allows me to do,

map <S-Space> :buffers<CR>

Now, when I'm in Vim, typing Shift-Space causes the list of buffers to display, as I intended. Outside of Vim, however, if I type Shift-Space at the command line, I see

;2u

Is there a way I can have my cake and eat it too?

George Nachman

unread,
Jan 11, 2016, 11:58:26 PM1/11/16
to iterm2-...@googlegroups.com
Maybe you could persuade bash to handle \e[32;2u as shift-space? I'm not a bash user, but that's probably your best bet. But I'm guessing your problems aren't limited to bash. You could tell vim to change your profile on entry and exit by putting this in your .vimrc:

let &t_SI = "\<Esc>]50;SetProfile=NameOfProfileForVim\x7"
let &t_EI = "\<Esc>]50;SetProfile=NameOfYourDefaultProfile\x7"


--
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