Change the default plugin directory for Neovim

And suggest users to call plug#begin() without an argument to avoid
confusion.
This commit is contained in:
Junegunn Choi 2022-01-03 23:05:08 +09:00
parent f085751ca1
commit e300178a0e
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627
3 changed files with 51 additions and 43 deletions

View File

@ -87,7 +87,7 @@ iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
Add a vim-plug section to your `~/.vimrc` (or `stdpath('config') . '/init.vim'` for Neovim) Add a vim-plug section to your `~/.vimrc` (or `stdpath('config') . '/init.vim'` for Neovim)
1. Begin the section with `call plug#begin()` 1. Begin the section with `call plug#begin([PLUGIN_DIR])`
1. List the plugins with `Plug` commands 1. List the plugins with `Plug` commands
1. `call plug#end()` to update `&runtimepath` and initialize plugin system 1. `call plug#end()` to update `&runtimepath` and initialize plugin system
- Automatically executes `filetype plugin indent on` and `syntax enable`. - Automatically executes `filetype plugin indent on` and `syntax enable`.
@ -96,12 +96,14 @@ Add a vim-plug section to your `~/.vimrc` (or `stdpath('config') . '/init.vim'`
#### Example #### Example
```vim ```vim
" Specify a directory for plugins call plug#begin()
" - For Vim (Linux/macOS): '~/.vim/plugged' " The default plugin directory will be as follows:
" - For Vim (Windows): '~/vimfiles/plugged' " - Vim (Linux/macOS): '~/.vim/plugged'
" - For Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged' " - Vim (Windows): '~/vimfiles/plugged'
" - Avoid using standard Vim directory names like 'plugin' " - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
call plug#begin('~/.vim/plugged') " You can specify a custom plugin directory by passing it as the argument
" - e.g. `call plug#begin('~/.vim/plugged')`
" - Avoid using standard Vim directory names like 'plugin'
" Make sure you use single quotes " Make sure you use single quotes

View File

@ -1,4 +1,4 @@
plug.txt plug Last change: November 27 2017 plug.txt plug Last change: January 3 2022
PLUG - TABLE OF CONTENTS *plug* *plug-toc* PLUG - TABLE OF CONTENTS *plug* *plug-toc*
============================================================================== ==============================================================================
@ -23,6 +23,7 @@ PLUG - TABLE OF CONTENTS *plug* *plug-to
Post-update hooks Post-update hooks
PlugInstall! and PlugUpdate! PlugInstall! and PlugUpdate!
Articles Articles
Collaborators
License License
VIM-PLUG *vim-plug* VIM-PLUG *vim-plug*
@ -36,8 +37,8 @@ https://raw.githubusercontent.com/junegunn/i/master/vim-plug/installer.gif
< Pros. >_____________________________________________________________________~ < Pros. >_____________________________________________________________________~
*plug-pros* *plug-pros*
- Easier to setup: Single file. No boilerplate code required. - Easy to set up: Single file. No boilerplate code required.
- Easier to use: Concise, intuitive syntax - Easy to use: Concise, intuitive syntax
- {Super-fast}{1} parallel installation/update (with any of `+job`, `+python`, - {Super-fast}{1} parallel installation/update (with any of `+job`, `+python`,
`+python3`, `+ruby`, or {Neovim}{2}) `+python3`, `+ruby`, or {Neovim}{2})
- Creates shallow clones to minimize disk space usage and download time - Creates shallow clones to minimize disk space usage and download time
@ -77,14 +78,8 @@ file as suggested {here}{5}.
>> Windows (PowerShell)~ >> Windows (PowerShell)~
> >
md ~\vimfiles\autoload iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' ni $HOME/vimfiles/autoload/plug.vim -Force
(New-Object Net.WebClient).DownloadFile(
$uri,
$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(
"~\vimfiles\autoload\plug.vim"
)
)
< <
Neovim~ Neovim~
@ -93,20 +88,14 @@ Neovim~
>> Unix~ >> Unix~
> >
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
< <
>> Windows (PowerShell)~ >> Windows (PowerShell)~
> >
md ~\AppData\Local\nvim\autoload iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' ni "$(@($env:XDG_DATA_HOME, $env:LOCALAPPDATA)[$null -eq $env:XDG_DATA_HOME])/nvim-data/site/autoload/plug.vim" -Force
(New-Object Net.WebClient).DownloadFile(
$uri,
$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(
"~\AppData\Local\nvim\autoload\plug.vim"
)
)
< <
< Getting Help >______________________________________________________________~ < Getting Help >______________________________________________________________~
@ -127,12 +116,12 @@ Neovim~
< Usage >_____________________________________________________________________~ < Usage >_____________________________________________________________________~
*plug-usage* *plug-usage*
Add a vim-plug section to your `~/.vimrc` (or `~/.config/nvim/init.vim` for Add a vim-plug section to your `~/.vimrc` (or `stdpath('config').'/init.vim'` for
Neovim): Neovim)
*plug#begin* *plug#end* *plug#begin* *plug#end*
1. Begin the section with `callplug#begin()` 1. Begin the section with `callplug#begin([PLUGIN_DIR])`
2. List the plugins with `Plug` commands 2. List the plugins with `Plug` commands
3. `callplug#end()` to update 'runtimepath' and initialize plugin system 3. `callplug#end()` to update 'runtimepath' and initialize plugin system
- Automatically executes `filetypepluginindenton` and `syntaxenable`. - Automatically executes `filetypepluginindenton` and `syntaxenable`.
@ -143,10 +132,14 @@ Neovim):
Example~ Example~
*plug-example* *plug-example*
> >
" Specify a directory for plugins call plug#begin()
" - For Neovim: ~/.local/share/nvim/plugged " The default plugin directory will be as follows:
" - Avoid using standard Vim directory names like 'plugin' " - Vim (Linux/macOS): '~/.vim/plugged'
call plug#begin('~/.vim/plugged') " - Vim (Windows): '~/vimfiles/plugged'
" - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
" You can specify a custom plugin directory by passing it as the argument
" - e.g. `call plug#begin('~/.vim/plugged')`
" - Avoid using standard Vim directory names like 'plugin'
" Make sure you use single quotes " Make sure you use single quotes
@ -285,16 +278,16 @@ Reload .vimrc and `:PlugInstall` to install plugins.
Plug 'junegunn/goyo.vim', { 'for': 'markdown' } Plug 'junegunn/goyo.vim', { 'for': 'markdown' }
autocmd! User goyo.vim echom 'Goyo is now loaded!' autocmd! User goyo.vim echom 'Goyo is now loaded!'
< <
`for` option is generally not needed as most plugins for specific file types The `for` option is generally not needed as most plugins for specific file
usually don't have too much code in `plugin` directory. You might want to types usually don't have too much code in the `plugin` directory. You might
examine the output of `vim--startuptime` before applying the option. want to examine the output of `vim--startuptime` before applying the option.
< Post-update hooks >_________________________________________________________~ < Post-update hooks >_________________________________________________________~
*plug-post-update-hooks* *plug-post-update-hooks*
There are some plugins that require extra steps after installation or update. There are some plugins that require extra steps after installation or update.
In that case, use `do` option to describe the task to be performed. In that case, use the `do` option to describe the task to be performed.
> >
Plug 'Shougo/vimproc.vim', { 'do': 'make' } Plug 'Shougo/vimproc.vim', { 'do': 'make' }
Plug 'ycm-core/YouCompleteMe', { 'do': './install.py' } Plug 'ycm-core/YouCompleteMe', { 'do': './install.py' }
@ -325,9 +318,9 @@ and only run when the repository has changed, but you can force it to run
unconditionally with the bang-versions of the commands: `PlugInstall!` and unconditionally with the bang-versions of the commands: `PlugInstall!` and
`PlugUpdate!`. `PlugUpdate!`.
Make sure to escape BARs and double-quotes when you write `do` option inline Make sure to escape BARs and double-quotes when you write the `do` option
as they are mistakenly recognized as command separator or the start of the inline as they are mistakenly recognized as command separator or the start of
trailing comment. the trailing comment.
> >
Plug 'junegunn/fzf', { 'do': 'yes \| ./install' } Plug 'junegunn/fzf', { 'do': 'yes \| ./install' }
< <
@ -351,7 +344,8 @@ The installer takes the following steps when installing/updating a plugin:
1. Update submodules 1. Update submodules
2. Execute post-update hooks 2. Execute post-update hooks
The commands with `!` suffix ensure that all steps are run unconditionally. The commands with the `!` suffix ensure that all steps are run
unconditionally.
< Articles >__________________________________________________________________~ < Articles >__________________________________________________________________~
@ -367,6 +361,16 @@ The commands with `!` suffix ensure that all steps are run unconditionally.
{13} http://junegunn.kr/2013/09/thoughts-on-vim-plugin-dependency {13} http://junegunn.kr/2013/09/thoughts-on-vim-plugin-dependency
< Collaborators >_____________________________________________________________~
*plug-collaborators*
- {Jan Edmund Lazo}{14} - Windows support
- {Jeremy Pallats}{15} - Python installer
{14} https://github.com/janlazo
{15} https://github.com/starcraftman
< License >___________________________________________________________________~ < License >___________________________________________________________________~
*plug-license* *plug-license*

View File

@ -242,6 +242,8 @@ function! plug#begin(...)
let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p')) let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p'))
elseif exists('g:plug_home') elseif exists('g:plug_home')
let home = s:path(g:plug_home) let home = s:path(g:plug_home)
elseif has('nvim')
let home = stdpath('data') . '/plugged'
elseif !empty(&rtp) elseif !empty(&rtp)
let home = s:path(split(&rtp, ',')[0]) . '/plugged' let home = s:path(split(&rtp, ',')[0]) . '/plugged'
else else