Skip to content

niumeng07/vim

Repository files navigation

Introduction

My vimrc.
Most used languages: C/C++, Golang, Python2/Python3, Java/Scala, Shell, Lua, Rust, PHP

Plugins

Install

Install with vim-plug.

cd ~ && /bin/rm -rf .vim && git clone https://github.com/niumeng07/vim.git .vim --recursive
vim +PlugInstall 
wget https://github.com/google/google-java-format/releases/download/google-java-format-1.9/google-java-format-1.9-all-third_party.jar ~/.vim/third_party/format
or download latest version from https://github.com/google/google-java-format/releases/

third-party

  1. go support
vim +GoInstallBinaries
npm i -g neovim
go get -u github.com/stamblerre/gocode
  1. support for ag
brew install the_silver_searcher
# For Ubuntu, apt-get install the_silver_searcher
# For CentOS, yum install the_silver_searcher
  1. third_party of coc.
# curl -sL install-node.now.sh/lts | sh
brew install node

yarn is necessary if install coc from source.

alias vim="PATH=$HOME/.vim/third_party/yarn/bin:$PATH vim"
$HOME/.vim/third_party/yarn/bin/yarn add coc-json coc-snippets

If coc can't find package.json, delete ~/.config/coc/extensions/node_modules/* and reinstall coc-plugins.

vim -c "PlugUpdate"
vim -c "CocInstall coc-explorer coc-floaterm coc-git coc-pairs coc-prettier coc-lists coc-marketplace|q"
vim -c "CocInstall coc-vetur coc-rls coc-solargraph coc-calc coc-translator coc-yank|q"
vim -c "CocInstall coc-phpls coc-vimlsp coc-go coc-html|q"  # langserver
vim -c "CocInstall coc-java coc-json coc-xml coc-yaml coc-css coc-emmet coc-tslint coc-tsserver|q"
vim -c "CocInstall coc-dictionary coc-word coc-snippets coc-tag coc-ultisnips coc-gocode|q"  # completion
vim -c "CocInstall coc-markdownlint|q"

# vim -c "CocInstall @yaegassy/coc-black-formatter"   # 更严格的 python formatter, 该formater过于啰嗦
# vim -c "CocCommand black-formatter.installServer"

# vim -c "CocInstall coc-omni|q" # will block vim on completion
# vim -c "CocInstall coc-tabnine|q" # Too much cpu used.
# vim -c "CocInstall coc-ccls coc-sh|q"  # Use language server instead.
# vim -c "CocInstall coc-syntax|q"  # get words from syntax for completion, use coc-dictionary/coc-word instead.
# vim -c "CocInstall coc-highlight|q" # call Node, too much CPU used.

vim -c 'CocUpdateSync|q'

Install coc dependencies:

./coursier bootstrap \
  --java-opt -Xss4m \
  --java-opt -Xms100m \
  --java-opt -Dmetals.client=coc.nvim \
  org.scalameta:metals_2.12:0.9.9 \
  -r bintray:scalacenter/releases \
  -r sonatype:snapshots \
  -o /usr/local/bin/metals-vim -f

coc-java cashe: Version 57 of JDT Lang Sever works fine https://download.eclipse.org/jdtls/milestones/0.57.0/

Quick hack for those who are facing this issue Replace all directories/files in ~/.config/coc/extensions/coc-java-data/server with directories/files from above extracted JDT lang server tar.

Try build coc if errors found following coc updates.

cd ~/.vim/plugged/coc.nvim && $HOME/.vim/third_party/yarn/bin/yarn install --frozen-lockfile && cd -

Or config in plugin configs.

Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'}
  1. Python support
# vim -c "CocInstall coc-python" # Too much CPU used.
vim -c "CocInstall coc-pyright"
  1. C++ support build ccls from source.
git clone https://github.com/MaskRay/ccls --recursive
cd ccls
brew info llvm
cmake -H. -BRelease -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/local/Cellar/llvm/<Your Version>/lib/cmake
cmake --build Release
cd Release
make -j
sudo make install
  1. hack nerd font
brew install homebrew/cask-fonts/font-hackgen-nerd --cask
brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font
brew search '/font-.*-nerd-font/' | awk '{ print $1 }' | xargs -I{} brew install --cask {} || true
  1. floaterm for neovim
sudo pip3 install neovim-remote
  1. Other Language Support
npm i -g sql-language-server
# orbrew install sql-language-server

npm i -g bash-language-server
# or brew install bash-language-server
npm install -g dockerfile-language-server-nodejs
# 以下是tex language server (cp third_party/digestif /usr/local/bin/digestif && chmod +x /usr/local/bin/digestif)
sudo curl -o /usr/local/bin/digestif https://raw.githubusercontent.com/astoff/digestif/master/scripts/digestif
sudo chmod +x /usr/local/bin/digestif

go get github.com/mattn/efm-langserver
# or brew install efm-langserver

sudo pip3 install cmake-language-server
npm install -g dockerfile-language-server-nodejs
sudo pip install 'python-language-server[all]'
sudo pip3 install 'python-language-server[all]'
sudo pip install pynvim
sudo pip3 install pynvim
sudo pip install vim-vint
sudo pip3 install vim-vint

Plugins deprecated

Releases

No releases published

Packages

No packages published