插件管理器安装
https://github.com/junegunn/vim-plug
# 本质是把plug.vim 放到autoload文件夹下
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs https://gitee.com/yzhrex/raw/raw/master/plug.vim'
Commands
Command | Description |
---|---|
PlugInstall [name …] [#threads] | Install plugins |
PlugUpdate [name …] [#threads] | Install or update plugins |
PlugClean[!] | Remove unlisted plugins (bang version will clean without prompt) |
PlugUpgrade | Upgrade vim-plug itself |
PlugStatus | Check the status of plugins |
PlugDiff | Examine changes from the previous update and the pending changes |
PlugSnapshot[!] [output path] | Generate script for restoring the current snapshot of the plugins |
Plug options
Option | Description |
---|---|
branch/tag/commit | Branch/tag/commit of the repository to use |
rtp | Subdirectory that contains Vim plugin |
dir | Custom directory for the plugin |
as | Use different name for the plugin |
do | Post-update hook (string or funcref) |
on | On-demand loading: Commands or |
for | On-demand loading: File types |
frozen | Do not update unless explicitly specified |
Global options
Flag | Default | Description |
---|---|---|
g:plug_threads | 16 | Default number of threads to use |
g:plug_timeout | 60 | Time limit of each task in seconds (Ruby & Python) |
g:plug_retries | 2 | Number of retries in case of timeout (Ruby & Python) |
g:plug_shallow | 1 | Use shallow clone |
g:plug_window | vertical topleft new | Command to open plug window |
g:plug_pwindow | above 12new | Command to open preview window in PlugDiff |
g:plug_url_format | https://git::@github.com/%s.git | printf format to build repo URL (Only applies to the subsequent Plug commands) |
Keybindings
- D - PlugDiff
- S - PlugStatus
- R - Retry failed update or installation tasks
- U - Update plugins in the selected range
- q - Close the window
- :PlugStatus
- L - Load plugin
- :PlugDiff
https://github.com/ianva/vim-youdao-translater
call plug#begin()
Plug 'ianva/vim-youdao-translater'
call plug#end()
:PlugInstall
CocVim
https://github.com/neoclide/coc.nvim
https://gitee.com/yzhrex/coc.nvim
- 安装命令:CocInstall 插件名
- 移除命令:CocUninstall 插件名
- 查看已安装:CocList extensions
- 更新命令:CocUpdate
安装nodejs
curl -sL install-node.vercel.app/lts | bash
call plug#begin()
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()
:PlugInstall
配置Coc 使用pnpm 管理包
安装初始化pnpm
npm i -g pnpm
pnpm setup
mkdir -p ~/.loca/share/pnpm
touch ~/.config/nvim/vi.vim
echo 'alias vi="nvim -u ~/.config/nvim/vi.vim --noplugin"'>> ~/.bashrc
source ~/.bashrc
配置 coc_config_npm_binPath 为pnpm 默认是npm
# nvim命令模式打开文件
:CocConfig
{
"npm.binPath":"/path/to/pnpm"
}
配置coc pnpm 源
coc.nvim:rergistry=https://registry.npm.taobao.org/
安装插件
:CocInstall coc-html coc-css coc-json coc-xml coc-yaml coc-toml coc-sh coc-git coc-tsserver coc-go coc-pyright
#当然也可以以配置的方式,让coc自动检测安装
let g:coc_global_extensions = ["coc-css", "coc-json", "coc-xml", "coc-yaml", "coc-toml", "coc-sh", "coc-git", "coc-tsserver", "coc-go", "coc-pyright"]