I'm restructuring my vim scripts and I'm not sure in which namespace to put some functions/ commands/ maps.
By now there are these namespaces (copied from vim help) as far as I know |buffer-variable| b: Local to the current buffer. |window-variable| w: Local to the current window. |global-variable| g: Global. |local-variable| l: Local to a function. |script-variable| s: Local to a |:source|'ed Vim script. |function-argument| a: Function argument (only inside a function). |vim-variable| v: Global, predefined by Vim. Eg. I want to use the closeb script, my own HTML mappings to type ü faster , matchit plugin and so on. This functionality should be associated with not just HTML but also with HTML like types like jsp,asp,... I think a very clean way would be doing something like this: function <namespace xml>:Close() ... imap -namespace=xml <C-_> <C-r>=Close()<CR> to associate maps/functions to namespaces which might be associated all at once to buffer this way: ftplugin/xml.vim: setlocal namespaces+=xml ftplugin/html.vim: setlocal namespaces+=xml ftplugin/jsp.vim setlocal b:namespaces+=xml ftplugin/aspx.vim setlocal b:namespaces+=xml ftplugin/vim.vim setlocal b:namespaces+=NERD_commentify setlocal b:namespaces+=TlistMappings setlocal b:namespaces+=regexpr ftplugin/sh.vim setlocal b:namespaces+=NERD_commentify setlocal b:namespaces+=bash_mappings setlocal b:namespaces+=make_executable setlocal b:namespaces+=sh_menu Some scripts like Trigger.vim wouldn't be necessary any more because removing/adding a functionality would be done in a clean way: setlocal b:namespaces+/-=xml local settings should override namespace settings which should ovverride global settings. (the way setlocal is preferred over set settings).. I would also introducde another folder like ftplugin which should contain loading mappings/ functions for namespaces eg .vim/namespaces/xml.vim What do you think? Marc Weber