Skip to content

Commit e300178

Browse files
committed
Change the default plugin directory for Neovim
And suggest users to call plug#begin() without an argument to avoid confusion.
1 parent f085751 commit e300178

File tree

3 files changed

+51
-43
lines changed

3 files changed

+51
-43
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
8787

8888
Add a vim-plug section to your `~/.vimrc` (or `stdpath('config') . '/init.vim'` for Neovim)
8989

90-
1. Begin the section with `call plug#begin()`
90+
1. Begin the section with `call plug#begin([PLUGIN_DIR])`
9191
1. List the plugins with `Plug` commands
9292
1. `call plug#end()` to update `&runtimepath` and initialize plugin system
9393
- 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'`
9696
#### Example
9797

9898
```vim
99-
" Specify a directory for plugins
100-
" - For Vim (Linux/macOS): '~/.vim/plugged'
101-
" - For Vim (Windows): '~/vimfiles/plugged'
102-
" - For Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
103-
" - Avoid using standard Vim directory names like 'plugin'
104-
call plug#begin('~/.vim/plugged')
99+
call plug#begin()
100+
" The default plugin directory will be as follows:
101+
" - Vim (Linux/macOS): '~/.vim/plugged'
102+
" - Vim (Windows): '~/vimfiles/plugged'
103+
" - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
104+
" You can specify a custom plugin directory by passing it as the argument
105+
" - e.g. `call plug#begin('~/.vim/plugged')`
106+
" - Avoid using standard Vim directory names like 'plugin'
105107
106108
" Make sure you use single quotes
107109

doc/plug.txt

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
plug.txt plug Last change: November 27 2017
1+
plug.txt plug Last change: January 3 2022
22
PLUG - TABLE OF CONTENTS *plug* *plug-toc*
33
==============================================================================
44

@@ -23,6 +23,7 @@ PLUG - TABLE OF CONTENTS *plug* *plug-to
2323
Post-update hooks
2424
PlugInstall! and PlugUpdate!
2525
Articles
26+
Collaborators
2627
License
2728

2829
VIM-PLUG *vim-plug*
@@ -36,8 +37,8 @@ https://raw.githubusercontent.com/junegunn/i/master/vim-plug/installer.gif
3637
< Pros. >_____________________________________________________________________~
3738
*plug-pros*
3839

39-
- Easier to setup: Single file. No boilerplate code required.
40-
- Easier to use: Concise, intuitive syntax
40+
- Easy to set up: Single file. No boilerplate code required.
41+
- Easy to use: Concise, intuitive syntax
4142
- {Super-fast}{1} parallel installation/update (with any of `+job`, `+python`,
4243
`+python3`, `+ruby`, or {Neovim}{2})
4344
- Creates shallow clones to minimize disk space usage and download time
@@ -77,14 +78,8 @@ file as suggested {here}{5}.
7778

7879
>> Windows (PowerShell)~
7980
>
80-
md ~\vimfiles\autoload
81-
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
82-
(New-Object Net.WebClient).DownloadFile(
83-
$uri,
84-
$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(
85-
"~\vimfiles\autoload\plug.vim"
86-
)
87-
)
81+
iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
82+
ni $HOME/vimfiles/autoload/plug.vim -Force
8883
<
8984

9085
Neovim~
@@ -93,20 +88,14 @@ Neovim~
9388

9489
>> Unix~
9590
>
96-
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
97-
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
91+
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
92+
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
9893
<
9994

10095
>> Windows (PowerShell)~
10196
>
102-
md ~\AppData\Local\nvim\autoload
103-
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
104-
(New-Object Net.WebClient).DownloadFile(
105-
$uri,
106-
$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(
107-
"~\AppData\Local\nvim\autoload\plug.vim"
108-
)
109-
)
97+
iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
98+
ni "$(@($env:XDG_DATA_HOME, $env:LOCALAPPDATA)[$null -eq $env:XDG_DATA_HOME])/nvim-data/site/autoload/plug.vim" -Force
11099
<
111100

112101
< Getting Help >______________________________________________________________~
@@ -127,12 +116,12 @@ Neovim~
127116
< Usage >_____________________________________________________________________~
128117
*plug-usage*
129118

130-
Add a vim-plug section to your `~/.vimrc` (or `~/.config/nvim/init.vim` for
131-
Neovim):
119+
Add a vim-plug section to your `~/.vimrc` (or `stdpath('config') . '/init.vim'` for
120+
Neovim)
132121

133122
*plug#begin* *plug#end*
134123

135-
1. Begin the section with `callplug#begin()`
124+
1. Begin the section with `callplug#begin([PLUGIN_DIR])`
136125
2. List the plugins with `Plug` commands
137126
3. `callplug#end()` to update 'runtimepath' and initialize plugin system
138127
- Automatically executes `filetypepluginindenton` and `syntaxenable`.
@@ -143,10 +132,14 @@ Neovim):
143132
Example~
144133
*plug-example*
145134
>
146-
" Specify a directory for plugins
147-
" - For Neovim: ~/.local/share/nvim/plugged
148-
" - Avoid using standard Vim directory names like 'plugin'
149-
call plug#begin('~/.vim/plugged')
135+
call plug#begin()
136+
" The default plugin directory will be as follows:
137+
" - Vim (Linux/macOS): '~/.vim/plugged'
138+
" - Vim (Windows): '~/vimfiles/plugged'
139+
" - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
140+
" You can specify a custom plugin directory by passing it as the argument
141+
" - e.g. `call plug#begin('~/.vim/plugged')`
142+
" - Avoid using standard Vim directory names like 'plugin'
150143
151144
" Make sure you use single quotes
152145
@@ -285,16 +278,16 @@ Reload .vimrc and `:PlugInstall` to install plugins.
285278
Plug 'junegunn/goyo.vim', { 'for': 'markdown' }
286279
autocmd! User goyo.vim echom 'Goyo is now loaded!'
287280
<
288-
`for` option is generally not needed as most plugins for specific file types
289-
usually don't have too much code in `plugin` directory. You might want to
290-
examine the output of `vim--startuptime` before applying the option.
281+
The `for` option is generally not needed as most plugins for specific file
282+
types usually don't have too much code in the `plugin` directory. You might
283+
want to examine the output of `vim--startuptime` before applying the option.
291284

292285

293286
< Post-update hooks >_________________________________________________________~
294287
*plug-post-update-hooks*
295288

296289
There are some plugins that require extra steps after installation or update.
297-
In that case, use `do` option to describe the task to be performed.
290+
In that case, use the `do` option to describe the task to be performed.
298291
>
299292
Plug 'Shougo/vimproc.vim', { 'do': 'make' }
300293
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
325318
unconditionally with the bang-versions of the commands: `PlugInstall!` and
326319
`PlugUpdate!`.
327320

328-
Make sure to escape BARs and double-quotes when you write `do` option inline
329-
as they are mistakenly recognized as command separator or the start of the
330-
trailing comment.
321+
Make sure to escape BARs and double-quotes when you write the `do` option
322+
inline as they are mistakenly recognized as command separator or the start of
323+
the trailing comment.
331324
>
332325
Plug 'junegunn/fzf', { 'do': 'yes \| ./install' }
333326
<
@@ -351,7 +344,8 @@ The installer takes the following steps when installing/updating a plugin:
351344
1. Update submodules
352345
2. Execute post-update hooks
353346

354-
The commands with `!` suffix ensure that all steps are run unconditionally.
347+
The commands with the `!` suffix ensure that all steps are run
348+
unconditionally.
355349

356350

357351
< Articles >__________________________________________________________________~
@@ -367,6 +361,16 @@ The commands with `!` suffix ensure that all steps are run unconditionally.
367361
{13} http://junegunn.kr/2013/09/thoughts-on-vim-plugin-dependency
368362

369363

364+
< Collaborators >_____________________________________________________________~
365+
*plug-collaborators*
366+
367+
- {Jan Edmund Lazo}{14} - Windows support
368+
- {Jeremy Pallats}{15} - Python installer
369+
370+
{14} https://github.com/janlazo
371+
{15} https://github.com/starcraftman
372+
373+
370374
< License >___________________________________________________________________~
371375
*plug-license*
372376

plug.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ function! plug#begin(...)
242242
let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p'))
243243
elseif exists('g:plug_home')
244244
let home = s:path(g:plug_home)
245+
elseif has('nvim')
246+
let home = stdpath('data') . '/plugged'
245247
elseif !empty(&rtp)
246248
let home = s:path(split(&rtp, ',')[0]) . '/plugged'
247249
else

0 commit comments

Comments
 (0)