插件管理器安装

https://github.com/junegunn/vim-plug

  1. # 本质是把plug.vim 放到autoload文件夹下
  2. 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 -mappings
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
    • X - Revert the update

      有道翻译插件

https://github.com/ianva/vim-youdao-translater

  1. call plug#begin()
  2. Plug 'ianva/vim-youdao-translater'
  3. call plug#end()
  1. :PlugInstall

CocVim

https://github.com/neoclide/coc.nvim
https://gitee.com/yzhrex/coc.nvim

  • 安装命令:CocInstall 插件名
  • 移除命令:CocUninstall 插件名
  • 查看已安装:CocList extensions
  • 更新命令:CocUpdate

安装nodejs

  1. curl -sL install-node.vercel.app/lts | bash
  1. call plug#begin()
  2. Plug 'neoclide/coc.nvim', {'branch': 'release'}
  3. call plug#end()
  1. :PlugInstall

配置Coc 使用pnpm 管理包

安装初始化pnpm

  1. npm i -g pnpm
  2. pnpm setup
  3. mkdir -p ~/.loca/share/pnpm
  4. touch ~/.config/nvim/vi.vim
  5. echo 'alias vi="nvim -u ~/.config/nvim/vi.vim --noplugin"'>> ~/.bashrc
  6. source ~/.bashrc

配置 coc_config_npm_binPath 为pnpm 默认是npm

  1. # nvim命令模式打开文件
  2. :CocConfig
  3. {
  4. "npm.binPath":"/path/to/pnpm"
  5. }

配置coc pnpm 源

  1. coc.nvim:rergistry=https://registry.npm.taobao.org/

安装插件

  1. :CocInstall coc-html coc-css coc-json coc-xml coc-yaml coc-toml coc-sh coc-git coc-tsserver coc-go coc-pyright
  1. #当然也可以以配置的方式,让coc自动检测安装
  2. 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"]