I want to use shift-tab for auto completion and shifting code blocks visually. I have been referring to Make_Shift-Tab_work . That link talks about mapping ^[[Z to shift-tab . But i don’t get ^[[Z when i press shift-tab. i just get a normal tab in that case.
It then talks about using xmodmap -pke | grep 'Tab' to map tab keys. According to that the output should be
keycode 23 = Tab
or
keycode 23 = Tab ISO_Left_Tab
However i get
keycode 22 = Tab KP_Tab
if i use xmodmap -e 'keycode 22 = Tab ISO_Left_Tab' and after that xmodmap -pke | grep 'Tab', I still get
keycode 22 = Tab KP_Tab
This means running xmodmap -e 'keycode 22 = Tab ISO_Left_Tab' has no effect.
In the end the link mentions using xev to see what X recieves when i press shift-tab. But i dont have xev on my system.
Is there any other way i can capture shift-tab in vim
The link talks specifically about getting
^[[Zwhen you press Ctrl+vShift+Tab in insert mode. If you leave off the Ctrl+v, then Vim will behave just as if you pressed Tab.The easiest way to make Vim recognize
<S-Tab>, is to directly set thet_kBoption to the escape sequence your terminal sends, instead of messing with maps.As a quick test, try this in a running Vim:
Now when you press Shift+Tab in insert mode,
fooshould be inserted. If that worked, you can make the change permanent by adding the following to your vimrc.