tpope / vim-pathogen

pathogen.vim: manage your runtimepath

Home Page:http://www.vim.org/scripts/script.php?script_id=2332

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Autoloading functions

1-61803 opened this issue · comments

I tried to load the functions at http://vim.wikia.com/wiki/Move_current_window_between_tabs by putting them in a script in ~/.vim/bundle/MoveWinToTab/autoload/MoveWinToTab.vim to no avail. Only way seems to be adding source ~/.vim/bundle/MoveWinToTab/autoload/MoveWinToTab.vim to my rc file.

Is this the expected behaviour?

I'm a little confused between what I expect pathogen to do and the doc, http://vimdoc.sourceforge.net/htmldoc/eval.html#autoload-functions.

An autoload file isn't sourced until one autoload function or variable in that file is referenced. If you're putting the snippet on that page directly into the autoload file without any changes, then your file doesn't have anything autoloadable and consquently is never sourced. To fix it, change the function names to MoveWinToTab#MoveToPrevTab and MoveWinToTab#MoveToNextTab, making them autoloadable, and also update their names at the call site(s). See :h autoload for more information.

Thanks!

In ~/.vim/bundle/MoveWinToTab/autoload/MoveWinToTab.vim I changed the function names to MoveWinToTab#MoveToPrevTab and MoveWinToTab#MoveToNextTab and called them in ~/.vimrc with map.

" MoveWinToTab map <C-m> :call MoveWinToTab#MoveToNextTab()<CR><C-w>H map <C-n> :call MoveWinToTab#MoveToPrevTab()<CR><C-w>H