From bc5e071d351431ea0ea77147a08f6834c4e8b164 Mon Sep 17 00:00:00 2001 From: Wenxuan Date: Sat, 25 Nov 2017 10:42:12 +0800 Subject: [PATCH] Add another install way Add another install way which vim will download and install the `vim-plug` automatically. Nothing will happen if it was already installed. The benefit of this approach is that we don't need to run the install command manually. When restoring configurations on a new machine, only thing to do is copy the `vimrc` file or make a symbol link. --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 73e2068..3c64c99 100644 --- a/README.md +++ b/README.md @@ -31,11 +31,22 @@ and put it in the "autoload" directory. ###### Unix +- Terminal way: + ```sh curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim ``` +- Vimrc way: + +```vim +" Put these lines into your vimrc. vim-plug will be installed automatically. +if !filereadable(glob('~/.vim/autoload/plug.vim')) + call system("curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim") +endif +``` + ###### Windows (PowerShell) ```powershell @@ -53,11 +64,22 @@ $uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' ###### Unix +- Terminal way: + ```sh curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim ``` +- Vimrc way: + +```vim +" Put these lines into your vimrc. vim-plug will be installed automatically. +if !filereadable(glob('~/.local/share/nvim/site/autoload/plug.vim')) + call system("curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim") +endif +``` + ###### Windows (PowerShell) ```powershell