5

I am trying to load plugins based on file type. That's a wrong idea. All plugins which do depend on file types should be ftplugin-plugins (i.e. 2-nd level plugins). And ftplugin already knows how load-on-demand. So don't try to re-invent the wheel. My questions are The answer is on both. Roughly speaking, packadd does two things: registers plugin's ...


4

how to load vim8 optional packages in vimrc? The way to load vim8 optional packages in your vimrc is to use the :packadd! command, which will add them to your 'runtimepath', which will make the opt plugins load together with the ones in start. In your particular case: packadd! vim-javascript The examples you give hint that what you're actually trying to ...


4

You are looking for the makeprg option, :h 'makeprg': *'makeprg'* *'mp'* 'makeprg' 'mp' string (default "make", VMS: "MMS") global or local to buffer |global-local| {not in Vi} Program to use for the ":make" command. See :...


4

Yes, you can have multiple pack directories In the example you quote from the documentation, "foo" is the name of the package. In your example, you've created a single package named "bundle". You could indeed create other subdirectories of the pack directory: each of these would be another package. There's not necessarily any benefit for you to create any ...


3

If you look at netrwPlugin.vim you'll find: if &cp || exists("g:loaded_netrwPlugin") finish endif So just set this in your .vimrc: let g:loaded_netrwPlugin = 1 If they both use the same variable (g:loaded_netrwPlugin) then they only one can be loaded and it is sufficient to either use packloadall or source ~/.vim/pack/packages/start/netrw.vim/plugin/...


3

A feature that isn't documented is a useless feature. :h design-documented In theory, you can do :h local-additions (towards the bottom of :h) which will show you an index of all local plugins that you have installed (if they included documentation). get to the top of the documentation for a specific package Most documentation you can do :h {...


2

Having done a bit more reading and thinking about this, I'm posting an answer to my own question. A plugin contains one or more .vim files which add new functionality globally or for a particular filetype. Plugins are usually organised using one or more of these subdirectories: plugin - global commands/mappings (loaded on startup) ftplugin - ftplugin ...


2

You can also use a try/catch block and a local variable to control whether you managed to load it successfully. let has_myplugin = 0 " if there is package myplugin and all dependencies if has('python') || has('python3') do some setup try packadd myplugin let has_myplugin = 1 catch /^Vim\%((\a\+)\)\=:E919:/ " Directory not ...


2

You could just silent! packadd <plugin>


2

You can use :h exists() to test if a variable, a command or a function provided by the plugin is defined. If it is defined then it means the plugin is available: exists({expr}) The result is a Number, which is |TRUE| if {expr} is defined, zero otherwise. The {expr} argument is a string, which contains one of these: &option-...


2

It is actually quite easy. IF you want to have all flexibility and be able to use a plugin wherever it resides on your local filesystem, you need to go with setting up the runtimepath setting yourself (e.g. using :set rtp+=...). This might make sense for having the plugin reside somewhere locally, where it can be used by different users on your system (e.g. ...


1

I think the helptags are not distributed with the plugins for the same reasons you don't put the tags generated by cscope or ctags in version control: That limits the size of your repo Since generating them is deterministic, there is no added value to have the file generated by the author And that limit the risk for the author to distribute the wrong tags ...


1

:help startup describes what Vim does on startup. I won't repeat the full details here, but you're correct that packages are loaded right after the initialization files (vimrc etc.) However, you can use the :packloadall to do this earlier if desired. That being said, the VimEnter autocmd is run as the last step, and packages should have been loaded at this ...


1

You can use :packloadall!: Load all packages in the "start" directory under each entry in 'packpath' [..] This is normally done automatically during startup, after loading your .vimrc file. With this command it can be done earlier. [..] Packages will be loaded only once. After this command it won't happen again. When the ...


Only top voted, non community-wiki answers of a minimum length are eligible