mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Move vim-plug installation outside of config.
It is a one-time thing. Do not waste precious time checking it every time we start Nvim.
This commit is contained in:
parent
b1f07af6fe
commit
dbe24697f3
@ -156,6 +156,38 @@ Make sure that you can call `nvim` from the command line after all these setups.
|
|||||||
|
|
||||||
# Setting up Nvim
|
# Setting up Nvim
|
||||||
|
|
||||||
|
## Install plugin manager vim-plug
|
||||||
|
|
||||||
|
I use [vim-plug](https://github.com/junegunn/vim-plug) to manage all my
|
||||||
|
plugins. We need to install vim-plug on our system first.
|
||||||
|
|
||||||
|
For Windows, if curl is installed, use the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
curl -fLo ~\AppData\Local\nvim-data\site\autoload\plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
|
```
|
||||||
|
|
||||||
|
Or execute the following command on PowerShell:
|
||||||
|
|
||||||
|
```
|
||||||
|
md ~\AppData\Local\nvim-data\site\autoload
|
||||||
|
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||||
|
(New-Object Net.WebClient).DownloadFile(
|
||||||
|
$uri,
|
||||||
|
$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(
|
||||||
|
"~\AppData\Local\nvim-data\site\autoload\plug.vim"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
Or just create the directory `~\AppData\Local\nvim-data\site\autoload\`, and put the vim-plug script there.
|
||||||
|
|
||||||
|
For macOS and Linux, use the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
|
```
|
||||||
|
|
||||||
## How to install this configuration
|
## How to install this configuration
|
||||||
|
|
||||||
On Windows, the config directory is `$HOME/AppData/Local/nvim`[^1]. On Linux
|
On Windows, the config directory is `$HOME/AppData/Local/nvim`[^1]. On Linux
|
||||||
@ -167,12 +199,11 @@ command to install this configuration:
|
|||||||
git clone https://github.com/jdhao/nvim-config.git .
|
git clone https://github.com/jdhao/nvim-config.git .
|
||||||
```
|
```
|
||||||
|
|
||||||
After that, when we first open nvim, all the plugins included in this
|
After that, when we first open nvim, use `:PlugInstall` to install all the
|
||||||
configuration will be installed automatically for you (for Windows and macOS).
|
plugins. Since I use quite a lot of plugins (more than 60), it may take some
|
||||||
Since I use quite a lot of plugins (around 60 plugins), it may take some time
|
time to install all of them, depending on your network condition.
|
||||||
to install all of them, depending on your network condition.
|
|
||||||
|
|
||||||
# Automatic Installation #
|
# Automatic Installation for Linux #
|
||||||
|
|
||||||
To set up a workable Neovim environment in Linux, I use the script
|
To set up a workable Neovim environment in Linux, I use the script
|
||||||
[`Nvim_setup.sh`](Nvim_setup.sh) to automatically install necessary
|
[`Nvim_setup.sh`](Nvim_setup.sh) to automatically install necessary
|
||||||
|
|||||||
23
plugins.vim
23
plugins.vim
@ -1,30 +1,15 @@
|
|||||||
scriptencoding utf-8
|
scriptencoding utf-8
|
||||||
"{ Plugin installation
|
"{ Plugin installation
|
||||||
"{{ Vim-plug Install and related settings
|
"{{ Vim-plug related settings.
|
||||||
|
" The root directory to install all plugins.
|
||||||
|
let g:PLUGIN_HOME=expand(stdpath('data') . '/plugged')
|
||||||
|
|
||||||
" Auto-install vim-plug on different systems if it does not exist. For
|
if empty(readdir(g:PLUGIN_HOME))
|
||||||
" Windows, only Windows 10 with curl installed are supported (after Windows 10
|
|
||||||
" build 17063, source:
|
|
||||||
" https://devblogs.microsoft.com/commandline/tar-and-curl-come-to-windows/).
|
|
||||||
" The following script to install vim-plug is adapted from vim-plug
|
|
||||||
" wiki: https://github.com/junegunn/vim-plug/wiki/tips#tips
|
|
||||||
let g:vim_plug_fpath = expand(stdpath('data') . '/site/autoload/plug.vim')
|
|
||||||
if (g:is_win || g:is_mac) && !filereadable(g:vim_plug_fpath)
|
|
||||||
if !executable('curl')
|
|
||||||
echoerr 'Curl not available on your system, you may install vim-plug by yourself.'
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
echomsg 'Installing Vim-plug on your system'
|
|
||||||
let g:vim_plug_furl = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
|
||||||
silent execute printf('!curl -fLo %s --create-dirs %s', g:vim_plug_fpath, g:vim_plug_furl)
|
|
||||||
augroup plug_init
|
augroup plug_init
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd VimEnter * PlugInstall --sync | quit |source $MYVIMRC
|
autocmd VimEnter * PlugInstall --sync | quit |source $MYVIMRC
|
||||||
augroup END
|
augroup END
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" The directory to install plugins.
|
|
||||||
let g:PLUGIN_HOME=expand(stdpath('data') . '/plugged')
|
|
||||||
"}}
|
"}}
|
||||||
|
|
||||||
"{{ Autocompletion related plugins
|
"{{ Autocompletion related plugins
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user