From 5eb80fabcccfa79ab0dd50458c785ce7cfc1543a Mon Sep 17 00:00:00 2001 From: Aathavan <7279940-aathavan@users.noreply.gitlab.com> Date: Sun, 7 May 2023 01:41:52 +0000 Subject: [PATCH] Coc extensions and language servers --- home/dot_config/nvim/coc-settings.json | 24 +++++++++++++ home/dot_config/shell/exports.sh.tmpl | 3 +- home/dot_config/vim/vimrc | 50 ++++++++++++++++++++++++++ software.yml | 28 +++++++++++++++ 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 home/dot_config/nvim/coc-settings.json diff --git a/home/dot_config/nvim/coc-settings.json b/home/dot_config/nvim/coc-settings.json new file mode 100644 index 00000000..4c7fb31e --- /dev/null +++ b/home/dot_config/nvim/coc-settings.json @@ -0,0 +1,24 @@ +{ + "sh.enable": true, + "dockerfile": { + "command": "docker-langserver", + "filetypes": ["Dockerfile"], + "args": ["--stdio"] + }, + "sql": { + "module": "$HOME/.local/share/nvim/lib/node_modules/sql-language-server/npm_bin/cli.js", + "args": ["up", "--method", "node-ipc"], + "filetypes": ["sql", "mysql"] + }, + "terraform": { + "command": "terraform-ls", + "args": ["serve"], + "filetypes": [ + "terraform", + "tf" + ], + "initializationOptions": {}, + "settings": {} + } + } +} diff --git a/home/dot_config/shell/exports.sh.tmpl b/home/dot_config/shell/exports.sh.tmpl index 61311cb6..0262068f 100644 --- a/home/dot_config/shell/exports.sh.tmpl +++ b/home/dot_config/shell/exports.sh.tmpl @@ -134,7 +134,7 @@ fi ### BitWarden # https://bitwarden.com/help/cli/#using-an-api-key -# BW_CLIENTID client_id +# BW_CLIENTID client_id # BW_CLIENTSECRET ### Deta @@ -368,6 +368,7 @@ fi export EDITOR='vi -e' if command -v nvim > /dev/null; then export VISUAL='nvim -e' + export PATH="$PATH:$HOME/.local/share/nvim/bin" else export VISUAL="$EDITOR" fi diff --git a/home/dot_config/vim/vimrc b/home/dot_config/vim/vimrc index 5182328f..d40b9069 100644 --- a/home/dot_config/vim/vimrc +++ b/home/dot_config/vim/vimrc @@ -31,6 +31,56 @@ Plug '~/.vim/plugged/ansible-vim', {'do': './UltiSnips/generate.sh'} call plug#end() " TODO -- add executable checks around plugins +" Install Coc extensions +if executable('node') + let g:coc_global_extensions = [ + \ 'coc-angular', + \ '@yaegassy/coc-ansible', + \ 'coc-calc', + \ 'coc-copilot', + \ 'coc-htmlhint', + \ 'coc-html-css-support', + \ 'coc-markdownlint', + \ 'coc-markdown-preview-enhanced', + \ '@yaegassy/coc-nginx', + \ 'coc-powershell', + \ 'coc-prettier', + \ 'coc-stylelint', + \ 'coc-spell-checker', + \ 'coc-yaml', + \ 'coc-xml', + \ 'coc-sh', + \ 'coc-css', + \ 'coc-deno', + \ 'coc-go', + \ 'coc-html', + \ 'coc-tsserver', + \ 'coc-json', + \ 'coc-markdownlint', + \ 'coc-phpls', + \ 'coc-pyright', + \ 'coc-solargraph', + \ 'coc-rls', + \ 'coc-solidity' + \] + + if !executable('docker-langserver') + call system('npm install --prefix $HOME/.local/share/nvim -g dockerfile-language-server-nodejs') + endif + if !executable('sql-language-server') + call system('npm install --prefix $HOME/.local/share/nvim -g sql-language-server') + endif + if !executable('solargraph') + call system('gem install solargraph -n $HOME/.local/share/nvim/bin') + endif +endif + +" Settings for coc-css extension +autocmd FileType scss setl iskeyword+=@-@ + +" Settings for coc-go extension, to add missing imports on save +autocmd BufWritePre *.go :silent call CocAction('runCommand', 'editor.action.organizeImport') + syntax enable set background=dark colorscheme Betelgeuse diff --git a/software.yml b/software.yml index a517122c..f7776558 100644 --- a/software.yml +++ b/software.yml @@ -1175,6 +1175,20 @@ softwarePackages: - clamav - clamav-update pacman: clamav + clangd: + _bin: clangd + _desc: '[clangd](https://clangd.llvm.org/) is an language server that understands your C++ code and adds smart features to your editor' + _docs: https://clangd.llvm.org/guides/ + _github: https://github.com/llvm/llvm-project/tree/main/clang-tools-extra/clangd + _home: https://clangd.llvm.org/ + _name: clangd + _type: cli + apt: clangd + brew: llvm + choco: llvm + dnf: clang-tools-extra + pacman: clang + scoop: llvm clocker: _when: '! test -d /Applications/Clocker.app' _bin: null @@ -4803,6 +4817,7 @@ softwarePackages: _home: null _name: nativefier npm: nativefier + _service: false _type: nautilus-brasero: apt: nautilus-extension-brasero @@ -4895,6 +4910,9 @@ softwarePackages: _github: https://github.com/neovim/neovim _home: https://neovim.io/ _name: neovim + _deps: + - clangd + - terraform-ls apk: neovim apt: - neovim @@ -7233,6 +7251,16 @@ softwarePackages: terraform: _deps: - tfenv + terraform-ls: + _bin: terraform-ls + _desc: '[terraform-ls](https://github.com/tfutils/tfenv) is the official Terraform language server maintained by HashiCorp that provides IDE features to any LSP-compatible editor.' + _docs: https://github.com/hashicorp/terraform-ls + _github: https://github.com/hashicorp/terraform-ls + _home: https://github.com/hashicorp/terraform-ls + _name: terraform-ls + brew: terraform-ls + _service: false + _type: cli tfenv: _bin: tfenv _desc: '[tfenv](https://github.com/tfutils/tfenv) is a Terraform version manager inspired by [rbenv](https://github.com/rbenv/rbenv). It supports macOS, Linux, and Windows.'