Closed YuFei29 closed 1 year ago
this plugin currently has no way to declare the plugin configuration between
plug#begin()
andplug#end()
You can put plugin configuration anywhere in your Vim configuration file because most Vim plugins are configured via global variables (i.e. let g:something_something = ...
). Here is an excerpt from my configuration. I'm using an extra indentation level to clarify the structure.
Plug 'tpope/vim-commentary'
map gc <Plug>Commentary
nmap gcc <Plug>CommentaryLine
Plug 'mbbill/undotree', { 'on': 'UndotreeToggle' }
let g:undotree_WindowLayout = 2
nnoremap U :UndotreeToggle<CR>
Plug 'inkarkat/vim-ReplaceWithRegister'
Plug 'AndrewRadev/splitjoin.vim'
let g:splitjoin_split_mapping = ''
let g:splitjoin_join_mapping = ''
nnoremap gss :SplitjoinSplit<cr>
nnoremap gsj :SplitjoinJoin<cr>
Plug 'AndrewRadev/switch.vim'
let g:switch_mapping = '-'
let g:switch_custom_definitions = [
\ ['MON', 'TUE', 'WED', 'THU', 'FRI']
\ ]
Plug 'sgur/vim-editorconfig'
" Browsing
Plug 'Yggdroot/indentLine', { 'on': 'IndentLinesEnable' }
autocmd! User indentLine doautocmd indentLine Syntax
let g:indentLine_color_term = 239
let g:indentLine_color_gui = '#616161'
But if your plugin is configured via an autoload function (i.e. call something#setup(...)
), the function is not available before plug#end()
. in that case you can circumvent the limitation using autoload VimEnter
.
Plug 'junegunn/vim-after-object'
autocmd VimEnter * silent! call after_object#enable('=', ':', '#', ' ', '|')
I tried your reply, it works.
I always thought that it is not possible to put statements between plug#begin()
and plug#end().
Thank you!
When we install a plug-in, we basically need to personalize the configuration of the plug-in. If the plug-in configuration can be placed where the plug-in is declared, the readability of the configuration file will be greatly enhanced. I often struggle to find the configuration of the corresponding plugin ðŸ˜
The emacs community has something like this, neovim's plug-in manager can generally put the configuration together, and kakoune can also.
If I'm not mistaken, this plugin currently has no way to declare the plugin configuration between
plug#begin()
andplug#end()
, sorry if I'm wrongemacs use-package package config example
neovim Lazy plugin manager
kakoune kak-bundle plguin manager