[ANN] effortless adding and removing of features without restarting vim

0 views
Skip to first unread message

Marc Weber

unread,
Dec 11, 2008, 5:28:02 PM12/11/08
to vim...@googlegroups.com
I've implemented some advanced kind of filetype handling:

You have different features (commands, mappings, completion functions)
which you want to assign to some buffers:

Mappings like this can be tagged (eg tag "vim" and "help")
map <leader>Help :call ShowHelp()<cr>

You than add all features belonging to a tag to the buffer:
BufferFeatureTags help
or
BufferFeatureTags vim
or both:
BufferFeatureTags vim help

So far its nice. It's not much different from
runtime */ftplugin/help*.vim | runtime */ftplugin/vim*.vim

However you can remove them again easily:
BufferFeatureTags -vim -help
and the mappings and commands are gone.

I guess you've already noticed that there must be a
GlobalFeatureTag

command as well. There is :-)

I've only tested the global features yet. I'll test buffer features when
I need them.

The code can be found within the TOVL library.

You can define such mappings or commands similar to this example taken
from core/autoload/plugins/language_support/haskell.vim
call self.RegI({
\ 'lhs' : self.cfg.lhs_compile,
\ 'rhs' : '<esc>:call '. self.s .'.NewCompileProcess().RunInBackground()<cr>',
\ 'tags' : ['haskell']
\ })

Enjoy and join!

Marc Weber

Reply all
Reply to author
Forward
0 new messages