Thursday, December 17, 2015

Re: Using matchit.vim with mapclear.

On 2015-12-17, Stephen Rasku wrote:
> I've been trying to debug `matchit.vim` to find out why it's not
> working. It turns out I am using `mapclear` in one of my vim config
> files[1]. I call this every time I load a file[2]. If you look at
> the `std.vim` file you can see that I load various macro files
> depending on the extension. The maps are cleared so that previously
> loaded macros are cleared and only the relevant ones are loaded.
>
> Is there an elegant way that I can get matchit.vim while still
> working with my existing development environment?

The standard way to handle filetype-dependent settings and mappings
is to put the settings in filtype plugins and also put the unsetting
and unmapping commands in the variable b:undo_ftplugin. Then when
the filetype is changed, just the settings and mappings made for the
old filetype are cleared.

This is discussed very briefly in ":help undo_ftplugin". You can
find numerous examples in $VIMRUNTIME/ftplugin. Specifically, you
can find examples of unmapping buffer-local mappings in these files:

abaqus.vim
cobol.vim
cucumber.vim
gitrebase.vim
j.vim
pdf.vim
ruby.vim

Regards,
Gary

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