Thursday, January 14, 2021

Re: vim terminal - cannot generate C-Space (C-@)

On Wed, Jan 13, 2021 at 6:17 PM mckel...@gmail.com
<mckelly2833@gmail.com> wrote:
>
> Hi again,
>
> Just fyi, I think adding this helps -
>
> tnoremap <C-@> <C-Space>
>
> Not sure why, and will keep trying different things.
>
> take care,
> -m
>
> On Monday, December 21, 2020 at 4:10:40 PM UTC-5 mckel...@gmail.com wrote:
>>
>> Hi,
>>
>> Just more info, I am using version 8.2.2184, on Ubuntu 18.04
>>
>> thx,
>> -m
>> On Monday, December 21, 2020 at 11:46:46 AM UTC-5 mckel...@gmail.com wrote:
>>>
>>> Hi,
>>>
>>> Thank you for awesome vim!
>>>
>>> In a vim terminal I cannot seem to get a C-@ key.
>>> This works fine in vim itself and at a normal shell prompt, but not inside a vim terminal.
>>> Is this supported ? Is there something I need to add (tmap etc.) ?
>>>
>>> thanks for any/all help,
>>> -m
>>>

There are keystrokes which are difficult to get on some keyboard
layouts or on some terminals. A workaround is to define a mapping with
the desired keystroke as {rhs} and something which you know how to
type, but don't need in Vim, as {lhs}. Here is an example:

When I started using Vim, I couldn't find how to get Ctrl-] on my
AZERTY keyboard. Now that's an extremely useful keystroke in Vim: in
Normal mode it finds tags (and when in the help, it follows hotlinks),
and in Insert mode it triggers an abbreviation (if there is one) for
whatever has just been typed without inserting an additional
character. Finally I added the following to my vimrc:

if exists(':map') == 2
map <F9> <C-]>
map! <F9> <C-]>
endif

Now I can follow help links with just F9 (in +eval buids because of
the :if wrapper; in any +mouse builds I can also use a double-click,
and all builds are compiled with +mouse nowadays). Years later, I
found how to get Ctrl-] on my keyboard: it's Ctrl-AltGr-$ where $ is
the key at the end of the top alphabet row, two keys to the right of
the P in AZERTYUIOP. Now that's a fairly complicated (three-finger)
keystroke combination, so I keep using F9 (and sometimes a double
click).

Maybe you can easily get Ctrl-] on your keyboard; but similar mappings
can be used for any difficult-to-reach keystrokes, keystrokes not
available on your keyboard layout in one or more of Vim's modes, or
even just keystrokes for which an alternative is desired.

Best regards,
Tony.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXt2z36YMchcT4_K4%2Br4hPkfG51%2BVTaxMyQozDC3BmnPdw%40mail.gmail.com.

No comments:

Post a Comment