Description:
In my Konsole the key mappings for changing tabs to left and right are Shift-left and Shift-right (where left/right are the arrow keys).
What I'm trying to do is to map F2 in vim to issue Shift-right, and thus change to the next tab in Konsole (in case of Clojure files, but probably this is not relevant). So, it would send keys "outside" of vim.
I've tried with the following mapping:
autocmd FileType clojure map <F2> <S-Right>
However, when I press F2, nothing happens. I'm fairly sure that the mapping syntax in general is right, since the following works as expected (inserts "Hello" at the current position):
autocmd FileType clojure map <F2> iHello
Questions:
- Is
<S-Right>
really the correct combination for shift-right? (Based on the documentation, I suspect yes, but a confirmation would be nice.) - Is it possible at all to achieve what I want? (I.e. send keys "outside" vim.) I'm beginning to suspect that this is not possible...
- If this can be done, then why does my command not work, and what is the way?
- Is there a way to "debug" in vim, what is going on when I press a certain key? (I.e. lookup of mappings, and then the keys that are sent as a result.)
Background:
I'm developing Clojure and doing TDD. F2 was previously mapped to execute lein test
and show the results:
autocmd FileType clojure map <F2> :wa<LF>:! clear && echo -en "\e[3J" && lein test<LF>
I got very used to just press F2 to show the test results, but today I found a plugin that can do continuous testing in the background, so I would like to keep my workflow with the new "implementation".
Remark:
I know that I could just remap F2 in Konsole, but I was curious if there is a way to achieve what I want in vim. This would have the additional advantage of not affecting all the other usages of console.
EDIT: (work-around)
Well, I found a way by running xdotool as an external command, which does what I want. Still I would be interested to the answers of the above questions, to deepen my knowledge about vim ;)
autocmd FileType clojure map <F2> :silent exec "!xdotool key shift+Right"<LF>:redraw!<LF>