I'm new to vim. The problem happens when I type :PlugInstall
I get:
[vim-plug] Invalid plug directory: /Users/joqsan/.vim/plugged. Try to call plug#begin with a valid directory
This is how I installed vim-plug
:
$ mkdir -p ~/.vim/autoload/ $ cd ~/.vim/autoload/
$ curl -O https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
In .vimrc
I have:
set number
if filereadable(expand("~/.vimrc.plug"))
source ~/.vimrc.plug
endif
In ~/.vimrc.plug
:
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-fugitive'
call plug#end()
But when I reload vim
and type :PlugInstall
, I get:
[vim-plug] Invalid plug directory: /Users/joqsan/.vim/plugged. Try to call plug#begin with a valid directory
If I type :scriptnames
I get this:
1: /usr/share/vim/vimrc
2: ~/.vimrc
3: ~/.vimrc.plug
4: ~/.vim/autoload/plug.vim
5: /usr/share/vim/vim80/filetype.vim
6: /usr/share/vim/vim80/ftplugin.vim
7: /usr/share/vim/vim80/indent.vim
8: /usr/share/vim/vim80/syntax/syntax.vim
9: /usr/share/vim/vim80/syntax/synload.vim
10: /usr/share/vim/vim80/syntax/syncolor.vim
11: /usr/share/vim/vim80/plugin/getscriptPlugin.vim
12: /usr/share/vim/vim80/plugin/gzip.vim
13: /usr/share/vim/vim80/plugin/logiPat.vim
14: /usr/share/vim/vim80/plugin/manpager.vim
15: /usr/share/vim/vim80/plugin/matchparen.vim
16: /usr/share/vim/vim80/plugin/netrwPlugin.vim
17: /usr/share/vim/vim80/plugin/rrhelper.vim
18: /usr/share/vim/vim80/plugin/spellfile.vim
19: /usr/share/vim/vim80/plugin/tarPlugin.vim
20: /usr/share/vim/vim80/plugin/tohtml.vim
21: /usr/share/vim/vim80/plugin/vimballPlugin.vim
22: /usr/share/vim/vim80/plugin/zipPlugin.vim
Since I don't see ~/.vim/plugged
, I try to create the directory:
$ mkdir ~/.vim/plugged
But I get:
net120:~ joqsan$ mkdir ~/.vim/plugged
mkdir: /Users/joqsan/.vim/plugged: File exists
net120:~ joqsan$
I don't know what I'm doing wrong.
Edit 1: Directory structure of ~/.vim
and ~/.vim/autoload
net120:~ joqsan$ ls -la ~/.vim/autoload
total 256
drwxr-x--- 3 root staff 96 Mar 30 12:33 .
drwxr-x--- 4 root staff 128 Mar 30 13:14 ..
-rw-r--r-- 1 root staff 74434 Mar 30 13:45 plug.vim
Joqsans-MacBook-Air:~ joqsan$ ls -al ~/.vim
total 0
drwxr-x--- 4 root staff 128 Mar 30 13:14 .
drwxr-xr-x+ 66 joqsan staff 2112 Mar 30 17:38 ..
drwxr-x--- 3 root staff 96 Mar 30 12:33 autoload
-rw-r--r-- 1 root staff 0 Mar 30 13:14 plugged`
Edit 2:
Edit 3:
On OS X, the primary group is always staff
, so I think this is ok. I didn't create the directory ~/.vim
. I installed vim with homebrew (I mean, I did nothing manually).
After doing what you recommended I got this:
Joqsans-MacBook-Air:~ joqsan$ sudo chown joqsan:staff ~/.vim
Joqsans-MacBook-Air:~ joqsan$ ls -al ~/.vim
total 0
drwxr-x--- 4 joqsan staff 128 Mar 30 23:08 .
drwxr-xr-x+ 67 joqsan staff 2144 Mar 31 04:28 ..
drwxr-x--- 3 root staff 96 Mar 30 12:33 autoload
drwxr-xr-x 2 root staff 64 Mar 30 23:08 plugged
With respect to the previous prompt (in Edit 1 above) now the first two directories are owned by joqsan
, but I still get the error when typing :PlugInstall
. Maybe that is because autoload
and plugged
are still owned by root
?
Edit 4:
Joqsans-MacBook-Air:~ joqsan$ sudo chown -R joqsan: ~/.vim
Joqsans-MacBook-Air:~ joqsan$ ls -al ~/.vim
total 0
drwxr-x--- 4 joqsan staff 128 Mar 30 23:08 .
drwxr-xr-x+ 67 joqsan staff 2144 Mar 31 13:11 ..
drwxr-x--- 3 joqsan staff 96 Mar 30 12:33 autoload
drwxr-xr-x 2 joqsan staff 64 Mar 30 23:08 plugged
Any help would be appreciated.
$ mkdir /Users/joqsan/.vim/plugged
in your shell? If you get a “Permission denied” error message, try to change the owner of the~/.vim/
directory by running$ chown joqsan:joqsan /Users/joqsan/.vim
.mkdir
:mkdir: /Users/joqsan/.vim/plugged: File exists
$ mv /Users/joqsan/.vim/plugged /Users/joqsan/.vim/plugged.bak
. Then try again to create the directory:$ mkdir /Users/joqsan/.vim/plugged
.