Saturday, November 21, 2015

Re: Question about language specific mappings

On Sat, Nov 21, 2015 at 2:50 PM, BPJ <bpj@melroch.se> wrote:
> Den 2015-11-20 kl. 20:20, skrev Tony Mechelynck:
>> These options can be toggled by hitting Ctrl-^ but since that
>> keystroke is hard to find on my Belgian AZERTY keyboard I use the
>> following, which works also in Normal mode:
>>
>> set ims=-1
>> map <F8> :let &l:imi = ! &l:imi<CR>
>> map! <F8> <C-^>
>
> I guess this is some trick to make `<F8>` do two things at once, but I
> haven't managed to understand what `map!` does through reading the help. I
> suspect this can simplify my keymap switching setup but I want to understand
> how it works!
> (Sorry, I haven't used Vim for the prerequisite two decades yet! :-)

:map (with no exclamation mark) is for all the modes where letters
mean functions, movements, etc.: Normal, Visual and Operator-pending.
Also Select mode which is somewhat arbitrarily treated as a submode of
Visual. It might have been more correct to write :nmap instead of :map
above.

:map! is for all the modes where letters are letters which get
inserted: Insert and Command-line. Search (i.e. after / or ?) is
regarded as a submode of Command-line, and Replace is a submode of
Insert. Here :map! is correct since we want the same mapping to be
used in all variations of both Insert and Command-line modes.

I haven't been using Vim for 20 years either. Only 12 years or so, but
intensively, and near the begin I ran the vimtutor which is a quite
good "driving school" for Vim (and nowadays there even exists a
gvimtutor, which didn't yet exist then). After these 12 years (how
fast time passes!) I already feel as if I'd been using it all my life,
it's become easier than using a ballpoint pen.


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.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment