justinmk / vim-sneak

The missing motion for Vim :athletic_shoe:
http://www.vim.org/scripts/script.php?script_id=4809
MIT License
3.26k stars 88 forks source link

packadd! in file in .config/nvim/plugin folder does not load vim-sneak #223

Closed milisims closed 6 years ago

milisims commented 6 years ago

I'm not sure if this is better to be in neovim or here, but this setup will load other plugins (I haven't tested every single plugin of mine, but I use snea regularly (using all of the bindings to overwrite defaults), so I opted to post here first. This was tested on a mac, neovim 0.2.2_1 installed via brew, as well as ubuntu 16.04 LTS installed via the recommended method in neovim repo (PPA I think). Logs are from the mac version.

My directory structure is (note: ~/.config/nvim symlinks to ~/.dotfiles/vim):

~/.dotfiles/vim
    init.vim
    pack/
        bundle/
            opt/
                vim-sneak/ [repo]
    plugin/
        20-plugins.vim

To start, my init.vim is empty (a few comments). 20-plugins.vim contains:

packadd! vim-sneak
nmap f <Plug>Sneak_f

When I start neovim, f is correctly bound to the mapping above, but it doesn't load the function, as the <Plug>Sneak_f is unmapped. The script is never sourced.

Running :scriptnames:

  1: ~/.dotfiles/vim/init.vim
  2: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/filetype.vim
  3: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/ftplugin.vim
  4: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/indent.vim
  5: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/syntax/syntax.vim
  6: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/syntax/synload.vim
  7: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/syntax/syncolor.vim
  8: ~/.dotfiles/vim/plugin/20-plugins.vim
  9: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/plugin/gui_shim.vim
 10: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/plugin/gzip.vim
 11: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/plugin/health.vim
 12: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/plugin/man.vim
 13: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/plugin/matchit.vim
 14: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/plugin/matchparen.vim
 15: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/plugin/netrwPlugin.vim
 16: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/plugin/rplugin.vim
 17: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/plugin/rrhelper.vim
 18: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/plugin/shada.vim
 19: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/plugin/spellfile.vim
 20: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/plugin/tarPlugin.vim
 21: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/plugin/tohtml.vim
 22: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/plugin/tutor.vim
 23: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/plugin/zipPlugin.vim
 24: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/ftplugin/vim.vim
 25: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/indent/vim.vim
 26: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/syntax/vim.vim
 27: /usr/local/Cellar/neovim/0.2.2_1/share/nvim/runtime/syntax/vim/generated.vim

If I execute :packadd vim-sneak after opening nvim, the binding works and the script is loaded (confirmed by scriptnames)

If I load another plugin (for example, I use gruvbox as a colorscheme currently), it loads as expected.

[ After manually loading with :packadd ]
28: ~/.dotfiles/vim/pack/bundle/opt/vim-sneak/plugin/sneak.vim
[ After using the f binding above ]
 29: ~/.dotfiles/vim/pack/bundle/opt/vim-sneak/autoload/sneak/util.vim
 30: ~/.dotfiles/vim/pack/bundle/opt/vim-sneak/autoload/sneak/search.vim
 31: ~/.dotfiles/vim/pack/bundle/opt/vim-sneak/autoload/sneak/hl.vim

Edit: packadd without ! works as expected as well, in the 20-plugins.vim file

milisims commented 6 years ago

Okay many of the plugins I want to use are not loading via this method (I'm loading using a deferred method for a lot of them, so I didn't notice the ones that were not loading. Looks to be neovim, so I'll post over there after re-reading :h packadd and making sure that it seems like this should work...

milisims commented 6 years ago

If anyone stumbles across this somehow, packadd! adds to the runtimepath without executing anything. the plugin folder is examined via (equivalently, see :h load-plugins) :runtime! plugin/**/*.vim, which means editing rtp after running the runtime command doesn't do anything. packadd works fine, as does packadd! somewhere before the plugins are loaded.