Kate & vi mode: allow C-[ as escape

I am so used to typing ctrl-[ (instead of leaving the keyboard for the escape key) in vi and I would like to do the same in Kate’s vi mode.

Before filing a change request, I thought a simple config could do the trick.
So I went to Settings > Editing > Vi Input Mode and tried to define mapping for Insert mode.
But typing in the usual vim configuration (<C-]>) did not do the trick (whereas <esc> worked, e.g. mapping ;;; to <esc> worked).

Tried workaround by defining the usual stuff in a vimrc file

inoremap <c-[> <esc>
" note: ^[ = hitting ctrl-v, then ctrl-[
inoremap ^[ <esc>

and imported it, but did not work, either.

Any idea if this is even possible?

(BTW: it’s not really the bracket ([) that does the trick, but the key’s position; meaning: on a German keyboard, you get the same magic by hitting the ü key which happens to be in the position where US keyboard has [)

1 Like

Thank you for posting this. I am able to get some Ctrl key mappings to work: I can map <c-,> to <esc> and it works. It seems <c-[> doesn’t work because it switches to the previous tab, but this mapping doesn’t show up in the keyboard shortcuts, so I can’t change it!

I wanted to map an Alt (meta) key shortcut to <esc>, but am having no luck at all with that so far. Further insights appreciated.

Cool. Thanks for the hint regarding the hidden keyboard shortcut that might hinder me.
Regarding your alt shortcut: would that be the alt key alone on its own or alt in combination with another key?
I guess alt has similar issues as it is used to access menu shortcuts.

I meant Alt in combination with another key. I got it to work! The syntax is <A-k> and I had to check “Let Vi commands override Kate shortcuts”. Maybe that will work with <C-[> as well.

1 Like

Congrats! I would have expected vim’s notation of <m-k> instead, but glad that you found it.
Were you referring to the manual section with “Let Vi commands override Kate shortcuts”?

“Let Vi commands override Kate shortcuts” is an option you can select in the “Vi input mode” configuration tab.

1 Like