Under my gvim I use <C-Tab> and <C-S-Tab> to switch buffers. However in my vim under cygwin/mintty these mapping don't work.
If I try the <C-V><C-Tab> with $vim -u NONE, I get this:
[1;5I for <C-Tab>
[1;6I for <C-S-Tab>
How can I make mappings for such key codes ?
Moreover, If I do :unmap <C-Tab> and press Ctrl+Tab in normal mode, I go to insert mode.
Any clue ?
You can try to set the terminal's keycodes to vim's keycodes like this:
set <c-tab>=^[[1;5I
Or you may have to find an unusable key, like <f13>, and map it to the terminal code and then map that key to <c-tab>. Like so:
set <f13>=^[[1;5I
map <f13> <c-tab>
map! <f13> <c-tab>
Now I must warn you this approach may not work if your terminal does not send a unique key code to vim.
I personally would simply avoid such a mapping and use something like [b and ]b to move through buffers. Tim Pope's Unimpaired provides these exact mappings and a few more very handy mappings.
Alternatively I would suggest against moving through buffers one at a time. There are better ways to go directly to a buffer:
mA and return with 'A<c-6> to go to the previous buffer (known as the alternative buffer)<c-]>:b and :sb can take partial filenames and globs. e.g. :b foo and :b foo*barFor more help see:
:h tags-and-searches
:h cscope
:h ctrl-6
:h m
:h :b
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With