vim-plug icon indicating copy to clipboard operation
vim-plug copied to clipboard

How to set multiple plug's code block of directory?

Open leiming opened this issue 4 years ago • 4 comments

How could I set multiple directory by dir option、set rtp etc ?

The example config file like as follow:

~/.vimrc


" The path of `/home/common/.vim/commons_dir` is just a common or soft link directory.

call plug#begin('/home/common/.vim/commons_dir')
" set common plugins
Plug 'majutsushi/tagbar',

call plug#end()

" source other files
source ~/.private.vimrc

~/ .private.vimrc

call plug#begin('~/.vim/private_dir')
" set private plugins
Plug 'mxw/vim-jsx',

call plug#end()

:version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Sep 16 2019 18:46:24)
Included patches: 1-503, 505-680, 682-1312
Compiled by [email protected]
Normal version without GUI.  Features included (+) or not (-):
+acl               +cmdline_compl     -emacs_tags        +insert_expand     +modify_fname      +netbeans_intg     +ruby/dyn          +terminfo          +vreplace
-arabic            +cmdline_hist      +eval              +job               +mouse             +num64             +scrollbind        +termresponse      +wildignore
+autocmd           +cmdline_info      +ex_extra          +jumplist          -mouseshape        +packages          +signs             +textobjects       +wildmenu
+autochdir         +comments          +extra_search      -keymap            -mouse_dec         +path_extra        +smartindent       +textprop          +windows
-autoservername    -conceal           -farsi             +lambda            -mouse_gpm         -perl              +startuptime       +timers            +writebackup
-balloon_eval      +cryptv            +file_in_path      -langmap           -mouse_jsbterm     +persistent_undo   +statusline        +title             -X11
-balloon_eval_term +cscope            +find_in_path      +libcall           -mouse_netterm     +postscript        -sun_workshop      -toolbar           -xfontset
-browse            +cursorbind        +float             +linebreak         +mouse_sgr         +printer           +syntax            +user_commands     -xim
+builtin_terms     +cursorshape       +folding           +lispindent        -mouse_sysmouse    -profile           +tag_binary        -vartabs           -xpm
+byte_offset       +dialog_con        -footer            +listcmds          -mouse_urxvt       +python/dyn        -tag_old_static    +vertsplit         -xsmp
+channel           +diff              +fork()            +localmap          +mouse_xterm       -python3           -tag_any_white     +virtualedit       -xterm_clipboard
+cindent           +digraphs          -gettext           -lua               +multi_byte        +quickfix          -tcl               +visual            -xterm_save
-clientserver      -dnd               -hangul_input      +menu              +multi_lang        +reltime           -termguicolors     +visualextra
-clipboard         -ebcdic            +iconv             +mksession         -mzscheme          -rightleft         +terminal          +viminfo
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L/usr/local/lib -o vim        -lm -lncurses  -liconv -framework Cocoa
  • Type:
    • [ ] Bug
    • [ ] Enhancement
    • [ ] Feature Request
    • [x] Question
  • OS:
    • [ ] All/Other
    • [ ] Linux
    • [x] OS X
    • [ ] Windows
  • Vim:
    • [x] Terminal Vim
    • [ ] GVim
    • [ ] Neovim

leiming avatar Nov 12 '19 13:11 leiming

I don't think that will work currently as each call to plug#begin resets Plug configuration (and not appends to it): https://github.com/junegunn/vim-plug/blob/master/plug.vim#L166-L169

I've run into this issue trying to have multiple plug sections: only plugins from the last one will be included.

raindev avatar Jan 09 '20 14:01 raindev

Duplicate of https://github.com/junegunn/vim-plug/issues/903

janlazo avatar Jan 10 '20 01:01 janlazo

Do you see any issues with changing the behaviour of plug#begin to not clear g:plug_home. Briefly looking at the code it seems reasonable. It will change the configuration for the users that rely on the last plug block to override the previous.

raindev avatar Jan 10 '20 06:01 raindev

That's insufficient to support multiple vim-plug homes because g:plug_home is used in a lot of places. It requires vim-plug to maintain an internal list of vim-plug homes, s:plug_homes, so that each Plug has a default directory relative to its plug#begin and vim-plug can cycle through all directories in s:plug_homes when installing/updating/deleting plugins. It's a non-trivial refactor if python,ruby installers will support this new feature.

janlazo avatar Jan 11 '20 00:01 janlazo