mirror of
https://github.com/junegunn/vim-plug.git
synced 2024-12-19 10:35:38 -07:00
parent
802b100415
commit
449b4f1ed6
@ -83,7 +83,9 @@ Add a vim-plug section to your `~/.vimrc` (or `~/.config/nvim/init.vim` for Neov
|
|||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
" Specify a directory for plugins (for Neovim: ~/.local/share/nvim/plugged)
|
" Specify a directory for plugins
|
||||||
|
" - For Neovim: ~/.local/share/nvim/plugged
|
||||||
|
" - Avoid using standard Vim directory names like 'plugin'
|
||||||
call plug#begin('~/.vim/plugged')
|
call plug#begin('~/.vim/plugged')
|
||||||
|
|
||||||
" Make sure you use single quotes
|
" Make sure you use single quotes
|
||||||
|
3
plug.vim
3
plug.vim
@ -121,6 +121,9 @@ function! plug#begin(...)
|
|||||||
else
|
else
|
||||||
return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.')
|
return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.')
|
||||||
endif
|
endif
|
||||||
|
if fnamemodify(home, ':t') ==# 'plugin' && fnamemodify(home, ':h') ==# s:first_rtp
|
||||||
|
return s:err('Invalid plug home. '.home.' is a standard Vim runtime path and is not allowed.')
|
||||||
|
endif
|
||||||
|
|
||||||
let g:plug_home = home
|
let g:plug_home = home
|
||||||
let g:plugs = {}
|
let g:plugs = {}
|
||||||
|
@ -19,6 +19,13 @@ Execute (plug#begin() without path argument with empty &rtp):
|
|||||||
let &rtp = save_rtp
|
let &rtp = save_rtp
|
||||||
unlet save_rtp
|
unlet save_rtp
|
||||||
|
|
||||||
|
Execute (Standard runtime path is not allowed):
|
||||||
|
redir => out
|
||||||
|
silent! AssertEqual 0, plug#begin(split(&rtp, ',')[0].'/plugin')
|
||||||
|
redir END
|
||||||
|
Log out
|
||||||
|
Assert stridx(out, 'Invalid plug home') >= 0
|
||||||
|
|
||||||
Execute (plug#begin(path)):
|
Execute (plug#begin(path)):
|
||||||
call plug#begin(g:temp_plugged.'/')
|
call plug#begin(g:temp_plugged.'/')
|
||||||
Assert g:plug_home !~ '[/\\]$', 'Trailing / should be stripped from g:plug_home'
|
Assert g:plug_home !~ '[/\\]$', 'Trailing / should be stripped from g:plug_home'
|
||||||
|
Loading…
Reference in New Issue
Block a user