> I don't think they're available in gvim either. I just pulled up gvim
> (GTK2, v7.2 on Debian Linux) and tried several unconventional
> control+{nonalpha char} mapping combinations and had hit-or-miss
> results. If I mapped them by issuing control+V followed by the
> character in question, several worked (such as control+backslash,
> control+at and control+caret) though I believe they have ASCII equivs.
> None of the other punctuation characters (comma, period, colon,
> semicolon, quote, apostrophe, and most of the other characters over
> the digits on my US keyboard) worked with a literal mapping. Also,
> none of the attempts to use the "<c-foo>" notation worked for me such
> as "<c-bslash>" or "<c-^>" (both of which worked in mappings created
> using control+V).
Actually there is a way to make it work in terminal vim assuming your
terminal allows mapping keys to escape sequences (rxvt-unicode and xterm
do, for example).
Since I like using C-space instead of C-X_C-O for omni-completion I have
the following in my ~/.Xresources:
URxvt.keysym.C-space : \033[?1;32~
And for xterm:
UXTerm*vt100.translations: #override \
Ctrl <Key>space: string(0x1b) string("[?1;32~") \n
If you're using xterm instead of uxterm then change the 'UXTerm' part to
'XTerm'. Note that these escape sequences are made up by me, the '?' in
them means that they are private use and therefore shouldn't clash with
any standard ones.
Then in my vimrc I have this:
map <Esc>[?1;32~ <C-Space>
map! <Esc>[?1;32~ <C-Space>
That way the C-Space sequence correctly ends up in Vim. It will of
course only be recognized by Vim, in other applications you will see the
raw escape sequence.
This should work for most keys; it definitely works for characters like
numbers and comma. You can see my complete (slightly more complicated)
configuration here:
https://github.com/majutsushi/etc/blob/master/xorg/Xresources#L182
https://github.com/majutsushi/etc/blob/master/vim/vimrc#L1490
The funny thing is that with this technique it's actually possible to
recognize more character combinations in terminal Vim than in GVim
(unless I'm missing something).
Cheers,
Jan
--
-[ OpenPGP key ID: 00A0FD5F ]-
I distrust those people who know so well what God wants them to do because I
notice it always coincides with their own desires.
-- Susan B. Anthony
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment