" Vimball Archiver by Charles E. Campbell, Jr., Ph.D. UseVimball finish plugin/crdispatcher.vim [[[1 40 " Author: Marcin Szamotulski " Email: mszamot [AT] gmail [DOT] com " License: vim-license, see :help license " " This plugin is a dependency for three other plugins: " * system : http://www.vim.org/scripts/script.php?script_id=4224 " * CommandAlias : http://www.vim.org/scripts/script.php?script_id=4250 " * EnchantedVim: http://www.vim.org/scripts/script.php?script_id=4849 " " It registers an object CRDispatcher to which you can append function which " will change command line. For exampe " " fun Fun(cmdline): " " Transform cmdline. " return cmdline " endfun " call add(CRDispatcher['/'], function('Fun')) " call add(CRDispatcher[':'], function('Fun')) " " All the registered call backs (for a given command line type) will be called " after you hit enter: they are triggered with a custom " cm CRDsipatch " map. " " For examples how this can be used to enhance vim funcionality please look " into the three plugins. " " Happy Viming, " Marcin let g:CRDispatcher = crdispatcher#CRDispatcher fun CRDispatch() return g:CRDispatcher.dispatch() endfun cno cno CRDispatch eCRDispatcher.dispatch() cm CRDispatch " Clever fix: cno eCRDispatcher.dispatch(1) autoload/crdispatcher.vim [[[1 31 " Author: Marcin Szamotulski " Email: mszamot [AT] gmail [DOT] com " License: vim-license, see :help license let crdispatcher#CRDispatcher = { \ 'callbacks': [] \ } fun! crdispatcher#CRDispatcher.dispatch(...) dict if a:0 >= 1 let self.ctrl_f = a:1 else let self.ctrl_f = 0 endif let self.cmdtype = getcmdtype() let self.line = getcmdline() " split cmdline into | segments " TODO: this split will not work well when a range has a search very magic " pattern, like (a|b|c) let cmdlines = split(self.line, '\\\@