Friday, November 20, 2015

Re: Question about language specific mappings

On Thu, Nov 19, 2015 at 11:23 PM, Dmitri Vereshchagin
<dmitri.vereshchagin@gmail.com> wrote:
> More precisely question is about unmapping. I am using keymap to edit
> texts in Russian. In my vimrc I have
>
> set keymap=russian-jcukenwin
> set iminsert=0
> set imsearch=-1
>
> When langmap mappings are enabled it translates `#' to `№' as expected.
> It is not very useful in markdown files. So I put
>
> lunmap <buffer> #
>
> in ~/.vim/after/ftplugin/markdown.vim. Then strange things begin to
> happen. When I open markdown document from running vim it shouts
>
> E31: No such mapping
>
> and points on that line. But after that mapping exists. When I start
> to edit markdown from command line everything is fine.
>
> Using autocommand instead of script in "after" directory leads to the
> same.
>
> The exact question is how to properly unmap this kind of mapping?
> Thanks for any help.
>
> --
> Dmitri Vereshchagin


Language-mappings (and keymaps) are disabled in Insert mode when the
local option 'iminsert' is set to 0. In search mode, it depends on
'imsearch' (also buffer-local) which when set to -1 falls back to
'iminsert' or when set to 0 disables search-mode language-mappings
(and keymaps).

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 also use different values for the Cursor and lCursor highlight
groups, so the cursor tells me by its colour whether keymaps are
enabled; and my custom statusline includes a %k item so I know which
keymap (if any) is enabled in which window.

See
:help 'iminsert'
:help 'imsearch'
:help i_CTRL-^
:help c_CTRL-^
:help 'guicursor'
:help lCursor
:help 'statusline'


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