coc.nvim
Cocnvim中文官网 | Cocnvim - git | coc插件
microsoft LSP | nvim-lsp 和 coc.nvim | 同时使用COC与youComplete
vimspector
: h vimspector
cd ~/.vim/plug/vimspector/
./install_gadget.py --enable-c --enable-cpp --enable-python --enable-bash --verbose
:VimspectorInstall debugpy #TAB to show wildmenu
:VimspectorInstall debugpy --no-check-certificate --verbose #no ssl check
:VimspectorUpdate
运行coc-java-debug
#vim .vimspector.json
{
"adapters": {
"java-debug-server": {
"name": "vscode-java",
"port": "${AdapterPort}"
}
},
"configurations": {
"Java Attach": {
"default": true,
"adapter": "java-debug-server",
"configuration": {
"request": "attach",
"host": "127.0.0.1",
"port": "5005"
},
"breakpoints": {
"exception": {
"caught": "N",
"uncaught": "N"
}
}
}
}
}
编译并运行java debug server
javac -g Main.java
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=5005,suspend=y Main &
./gradlew bootRun
#vim build.gradle
tasks.withType(JavaExec) {
if (System.getProperty('DEBUG', 'false') == 'true') {
jvmArgs '-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=localhost:5005'
}
}
./mvnw spring-boot:run
#vim pom.xml
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
</jvmArguments>
</configuration>
</plugin>
</plugins>
</build>
vim:
let g:vimspector_enable_mappings = 'VISUAL_STUDIO'
启动debug
:CocCommand java.debug.vimspector.start
coc-snippets设置:
:CocCommand snippets.editSnippets
查看出错日志
:VimspectorToggleLog
:VimspectorReset
-----------------------------------
mvn archetype:generate -DgroupId=my.test.app \
-DartifactId=hello \
-DarchetypeArtifactId=maven-archetype-quickstart \
-DinteractiveMode=false
vim .vimspector.json
{
"configurations": {
"Java Attach": {
"adapter": "vscode-java",
"filetypes": [ "java" ],
"configuration": {
"request": "attach",
"hostName": "localhost",
"port": "${port}",
"sourcePaths": [
"${workspaceRoot}/src/main/java",
"${workspaceRoot}/src/test/java"
]
}
}
}
}
升级nodejs到12.0以上 安装node管理工具nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash . ~/.nvm/nvm.sh nvm install node npm install -g yarn #cd .vim/plugged/cocvim #yarn install #yarn build CocInstall coc-marketplace CocList extensions CocList marketplace CocList marketplace python <tab> -> install -> uninstall CocUpdate CocUpdateSync CocUninstall coc-css CocConfig ~/.vim/coc-settings.json CocList snippets CocList commands CocCommand snippets.editSnippets vim ~/.config/coc/ultisnips/java.snippets
Centos 下 ld 链接器版本更新 | gcc release info | Linux升级安装GCC G++ 6.2 | coc for C++ setup | 2020年vim的C/C++配置 | LLVM download https://github.com/llvm/llvm-project
C/C++
前端扩展安装:
:CocCommand clangd.install
:CocCommand clangd.update
:CocInstall coc-clangd
后端LSP服务器ccls安装:
1.cmake下载
https://cmake.org/download/
cmake for aws安装
sudo yum install gcc -y
sudo yum install openssl openssl-devel -y
sudo yum install clang clang-devel -y
sudo yum install llvm llvm-devel -y
wget https://github.com/Kitware/CMake/releases/download/v3.22.3/cmake-3.22.3.tar.gz
tar -xvzf cmake-3.22.3.tar.gz
cd cmake-3.22.3
./bootstrap
make
sudo make install
2.GCC编译安装
下载地址:http://ftp.gnu.org/gnu/gcc
wget http://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.gz
tar -zxvf gcc-11.2.0.tar.gz -O gcc11.2
cd gcc11.2
#下载依赖
./contrib/download_prerequisites
mkdir build
cd build
#../configure -enable-checking=release -enable-languages=c,c++ --disable=multilib
../configure --prefix=/opt/gcc-13 --enable-languages=c,c++,fortran --disable-multilib
#指定4个CPU,可以不指定参数
make -j4
make install
3.llvm编译安装
#下载llvm:
wget https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-12.0.0.tar.gz
#编译指定的库
cmake -G "Unix Makefiles" \
-DCMAKE_C_COMPILER=/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
-DCMAKE_INSTALL_PREFIX=/usr/local/clang \
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt;libc;libclc;libcxx;libcxxabi;lld;lldb" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=On \
../llvm
4.安装ccl
git clone --depth=1 --recursive https://github.com/MaskRay/ccls
cd ccls
cmake -H. -BRelease
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_PREFIX_PATH=/path/to/clang+llvm-xxx
cmake --build Release
cmake -H. -BRelease
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=/usr/lib/llvm-10 \
-DLLVM_INCLUDE_DIR=/usr/lib/llvm-10/include \
-DLLVM_BUILD_INCLUDE_DIR=/usr/include/llvm-10/
cd Release
sudo make install
Windows下安装
注:不能运行VS自带cmake, 下载cmake(https://cmake.org/download/)
Enter "Developer Command Prompt for VS"
git clone https://github.com/llvm/llvm-project.git
cd llvm-project
cmake -Hllvm -BRelease -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_PROJECTS=clang
ninja -C Release clangFormat clangFrontendTool clangIndex clangTooling clang
# Download ccls
cd ccls
注:要指定-DCMAKE_C_COMPILER=clang-cl, 否则会因为编译器不一致而报错
cmake -H. -BRelease -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_PREFIX_PATH="D:/llvm-project/Release"
ninja -C Release
python
:CocInstall coc-pyright
获取Intelephense licence | vsCode 使用 PHP Intelephense插件函数跳转跟踪 | My Neovim setup for PHP Development
php
:CocInstall coc-phpls
安装PHP Intelephense
npm i -g Intelephense
:CocConfig
{
"intelephense.licenseKey": "<your-key-here>"
}
golang
设置代理: Go 版本是 1.13 及以上 go env -w GO111MODULE=on go env -w GOPROXY=https://goproxy.cn,direct 取消代理: go env -u GOPROXY 查看配置: go env go env json Plug 'fatih/go' :PlugInstall :GoInstallBinaries CocInstall coc-go mkdir gone cd gond go mod init gone go run test.go go get github.com/gin-gonic/gin go mod tidy
rust
券商扩展安装:
:CocCommand rust-analyzer.install
:CocCommand rust-analyzer.update
:CocInstall coc-rust-analyzer
安装rust-src:
rustup component add rust-src
rustup update
自动更新
:CocConfig
{
"rust-analyzer.updates.prompt": false,
"rust-analyzer.server.path": "~\\AppData\\Local\\coc\\extensions\\coc-rust-analyzer-data\\rust-analyzer.exe",
}
javascript
:CocInstall coc-tsserver
:CocInstall coc-eslint
pnpm install -g typescript
查看全局node_modules路径
npm list -g
pnpm list -g
vim coc-settings.json
{
"tsserver.tsdk"; "/path/to/node_modules/lib",
}
vim coc-setting.json
{
"tsserver.tsdk": "/root/.local/share/pnpm/global/5/node_modules/typescript/lib",
"[vue]": {
"diagnostic.enable": true,
"coc.preferences.formatOnSave": true
},
"tailwindCSS.custom.serverPath": "/root/.nvm/versions/node/v24.3.0/bin/tailwindcss-language-server",
}
vue
CocInstall coc-volar
css
CocInstall @yaegassy@coc-tailwind3
tailwind3 server 路径:
vim coc-setting.json
{
"tailwindCSS.custom.serverPath": "/root/.nvm/versions/node/v24.3.0/bin/tailwindcss-language-server",
}