junegunn / vim-plug

:hibiscus: Minimalist Vim Plugin Manager
https://junegunn.github.io/vim-plug/
MIT License
34.02k stars 1.93k forks source link

How to pass configuration options (opts) to plugins? #1254

Closed TamaMcGlinn closed 1 year ago

TamaMcGlinn commented 1 year ago

Many plugins mention that you can pass option in the readme, for example:

"Can be disabled by no_default_keymaps = true option in setup."

How do we do that with vim-plug? I have tried various things like the following:

Plug 'archibate/nvim-gpt', {'opts':  {'no_default_keymaps': 'true'}}
Plug 'archibate/nvim-gpt', {'no_default_keymaps':  v:true}
Plug 'archibate/nvim-gpt', {'no_default_keymaps':  1}

But since there is no mention in the readme, is this even supported?


NVIM v0.10.0-dev-482+g38b0bb3c9                                                                                                                                               
Build type: RelWithDebInfo                                                                                                                                                    
LuaJIT 2.1.0-beta3                                                                                                                                                            
Compilation: /usr/bin/gcc-10 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissi
ng-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always -fstack-protector-strong -DUNIT_T
ESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_TS_HAS_SET_MAX_START_DEPTH -I/__w/neovim/neovim/.deps/usr/include/luajit-2.1 -I/usr/include -I/__w/neovim/neovim/
.deps/usr/include -I/__w/neovim/neovim/build/src/nvim/auto -I/__w/neovim/neovim/build/include -I/__w/neovim/neovim/build/cmake.config -I/__w/neovim/neovim/src -I/usr/include 
-I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neov
im/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include                                                                                                                   

   system vimrc file: "$VIM/sysinit.vim"                                                                                                                                      
  fall-back for $VIM: "/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim"                                                                                                   

Run :checkhealth for more info
junegunn commented 1 year ago

Traditionally, most Vim plugins are configured via global variables like so

let g:foobar_some_option = 'foobar'

which you would just put in your .vimrc (or init.vim if you're a Neovim user).


But it seems that the new hordes of Neovim-only Lua-based plugins are supposed to be configured via some Lua code. So you should directly call the Lua code in your configuration file, not through an option of vim-plug.