3

I'm testing the new built-in package manager. From :h packages:

When Vim starts up, after processing your .vimrc, it scans all directories in
'packpath' for plugins under the "pack/*/start" directory.  First all those
directories are added to 'runtimepath'.  Then all the plugins are loaded.
See packload-two-steps for how these two steps can be useful.

My folders are looking in this way:

.vim
  |--pack
    |--javascript
      |--start
        |--vim-javascript
          |--ftdetect
            |-- javascript.vim
          |--ftplugin
            |--javascript.vim
          |--indent
            |--javascript.vim

When I'm opening a .js file, I get this log:

sourcing /opt/local/share/vim/vim74/syntax/javascript.vim    
sourcing /Users/me/.vim/pack/javascript/start/vim-javascript/syntax/javascript.vim    
sourcing /opt/local/share/vim/vim74/ftplugin/javascript.vim    
sourcing /Users/me/.vim/pack/javascript/start/vim-javascript/ftplugin/javascript.vim    
sourcing /opt/local/share/vim/vim74/indent/javascript.vim    
sourcing /Users/me/.vim/pack/javascript/start/vim-javascript/indent/javascript.vim

This seems to look fine, but the plugin doesn't work at all. Where is the problem?

EDIT: I'm using Vim version 7.4.1797, huge version without GUI on OSX. The plugin, that I try to load, is pangloss/vim-javascript. With pathogen, plugin is loading, no problem.

2
  • 1
    I'm guessing from the log that this is a minimal setup? Oddly, in my case, the file in pack/*/start/*/ftplugin was loaded before the one in /usr/share/vim/vim74/ftplugin. Which version of Vim?
    – muru
    Commented May 2, 2016 at 11:09
  • @muru I give an update. I use Vim version 7.4.1797, huge version without GUI on OSX.
    – oliver
    Commented May 2, 2016 at 15:02

2 Answers 2

0

I found myself a solution. I changed runtimepath to bring pack/*/start/*/ftplugin in front of the PATH

set runtimepath^=~/Users/me/.vim/pack/

Works for all ft plugin. This is a workaround, maybe there is a better solution?

0

I believe the problem is vim's filetype detection uses:

runtime! ftdetect/*.vim

The help for runtime[!] [where] {file} .. says:

Read Ex commands from {file} in each directory given by 'runtimepath' and/or 'packpath'.

[snip]

When [where] is omitted only 'runtimepath' is used. Other values:

START search under "start" in 'packpath'
OPT search under "opt" in 'packpath'
PACK search under "start" and "opt" in 'packpath'
ALL first use 'runtimepath', then search under "start" and "opt" in 'packpath'

When I added ALL to the filetype detection line quoted above, it picked up filetype files in the packages. I.e.:

runtime! ALL ftdetect/*.vim
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.