Open jdhao opened 4 years ago
That question asks how to install plugins for all the users. My question is about how the user can install their own plugins using vim-plug and also use the system-wide ones.
" /usr/share/vim/vim74/autoload/jdhao.vim
let s:base_dir = expand('<sfile>:p:h:h')
function jdhao#load_system_plugs()
" local plugs installed via OS package manager
if isdirectory(s:base_dir . '/plugged/vim-foo')
call plug#(s:base_dir . '/plugged/vim-foo', {})
endif
if isdirectory(s:base_dir . '/plugged/vim-bar')
call plug#(s:base_dir . '/plugged/vim-bar', {})
endif
endfunction
" vimrc
call plug#begin('~/.vim/plugged')
call jdhao#load_system_plugs()
Plug 'lifepillar/vim-gruvbox8'
call plug#end()
Thanks for the hint. But this becomes impractical since I have installed more than 60 plugins in the system. I will find if I can make it work.
I want to set up neovim for all users of my Linux server, and I use vim-plug to manage the plugins.
The part about plugin installation is something like the following:
This works fine and will install plugins into
/usr/local/share/nvim/site
. All users can use these plugins under their account.The problem is that I do not know how to let the users also use vim-plug to install other plugins they want to use.
For example, suppose a user want to install ayu-vim, if they use
Plug 'ayu-theme/ayu-vim'
in~/.config/nvim/init.vim
and then use:PlugInstall
. vim-plug warns that the user does not have permission to install plugins under/usr/local/share/nvim/site
.If the user choose to use:
Only this plugin will take effect, and all other plugins under
/usr/local/share/nvim/site
does not work anymore.Of course, the user can install the plugin manually and update the
runtimepath
variable manually. But it would be preferable to use vim-plug to manage the plugins.I am thinking of a functionality similar to how pip manages user and global packages, i.e., the user can choose to install plugins locally if he does not have root rights. In this way, the user can use both system-wide plugins and also user-specific plugins.
Is there an easy to achieve this right now?