other plugins

plugin alternatives

autocompletion

[!NOTE|label:references:]

vim-easycomplete

[!NOTE|label:references:]

[!NOTE]

cryptmethod

comments

programming

[!NOTE|label:references:]

$ mkdir -p ~/.cache/nvim/
# show all available packages
:LspInstall <TAB>
:LspInstall <package>
" i.e.:
:LspInstall groovyls

:LspInstallInfo
:LspPrintInstalled

:LspUninstall <package>

Plug 'neovim/nvim-lspconfig'
  • debug

    :LspInfo
    :LspLog

manual install lsp

[!NOTE]

  • gradlels

    $ mkdir -p ~/.vim/lsp
    $ git clone https://github.com/microsoft/vscode-gradle.git ~/.vim/lsp/vscode-gradle && cd $_
    $ ./gradlew installDist
    $ sudo ln -sf /opt/lsp/gradle-language-server/build/install/gradle-language-server/bin/gradle-language-server /usr/local/bin/
    $ which -a gradle-language-server
    /usr/local/bin/gradle-language-server
    
    # details for offline install
    $ la ~/.gradle/wrapper/dists/gradle-8.5-bin/5t9huq95ubn472n8rpzujfbqh/
    total 4.0K
    -rw-rw-r-- 1 marslo marslo    0 Jan 15 19:58 gradle-8.5-bin.zip.lck
    drwxrwxr-x 5 marslo marslo 4.0K Jan 15 19:58 gradle-8.5
    -rw-rw-r-- 1 marslo marslo    0 Jan 15 19:58 gradle-8.5-bin.zip.ok
    require'lspconfig'.gradle_ls.setup {
      filetypes = { 'groovy', 'Jenkinsfile' }
    }
  • groovyls

    • GroovyLanguageServer/groovy-language-server

      # java has to be less than jdk 19
      $ brew install openjdk@17
      $ export JAVA_HOME='/usr/local/opt/openjdk@17'
      $ export PATH=${JAVA_HOME}/bin:${PATH}
      $ export CPPFLAGS="-I${JAVA_HOME}/include ${CPPFLAGS}"
      
      $ git clone git@github.com:GroovyLanguageServer/groovy-language-server.git
      $ ./gradew build
      
      # run
      $ git@github.com:GroovyLanguageServer/groovy-language-server.git
    • ycm-core/lsp-examples

      [!NOTE|label:@deprecated] using gradlels instead of groovyls

      • full ycm-core/lsp-examples list

        Plug 'ycm-core/lsp-examples',  { 'do': 'python3 install.py --enable-groovy --enable-yaml --enable-bash --enable-json --enable-python --enable-lua --enable-docker' }
      # .vimrc
      Plug 'ycm-core/lsp-examples',  { 'do': 'python3 install.py --enable-groovy' }
      
      # ~/.config/nvim/init.lua
      require'lspconfig'.groovyls.setup{
        filetypes = { 'groovy', 'Jenkinsfile' },
        cmd = { "java", "-jar", "~/.vim/plugged/lsp-examples/groovy/groovy-language-server/build/libs/groovy-language-server-all.jar" },
      }
  • ansiblels

    $ npm install -g @ansible/ansible-language-server
    # ~/.config/nvim/init.lua
    require'lspconfig'.ansiblels.setup{}
  • bashls

    $ npm i -g bash-language-server
    # ~/.config/nvim/init.lua
    require'lspconfig'.bashls.setup{}
  • cmake | cmake-language-server

    $ pip install cmake-language-server
    # ~/.config/nvim/init.lua
    require'lspconfig'.cmake.setup{}
  • cssls

    $ npm i -g vscode-langservers-extracted
    # ~/.config/nvim/init.lua
    local capabilities = vim.lsp.protocol.make_client_capabilities()
    capabilities.textDocument.completion.completionItem.snippetSupport = true
    require'lspconfig'.cssls.setup { capabilities = capabilities, }
    require'lspconfig'.cssls.setup{}
  • dockerls

    $ npm install -g dockerfile-language-server-nodejs
    # ~/.config/nvim/init.lua
    require'lspconfig'.dockerls.setup{}
  • pylsp

    [!NOTE|label:references:]

    $ pip install python-lsp-server
    $ sudo npm install -g pyright
    require'lspconfig'.pylsp.setup {}
  • vimls

    $ npm install -g vim-language-server
    require'lspconfig'.vimls.setup{}
  • yamlls

    $ npm install -g yaml-language-server
    require'lspconfig'.yamlls.setup{}

" tpope/vim-commentary
map  <C-/>     gcc
map  <leader>x gcc
imap <C-/>     <Esc><Plug>CommentaryLineA
xmap <C-/>     <Plug>Commentary

augroup DevOps
  autocmd FileType ignore,gitconfig setlocal commentstring=#\ %s
augroup END

[!TIP]

  • delete undo file for 3 days ago

    $ find ~/.vim/undo -mtime +3
    # or
    $ fd --type=file \
         --change-older-than=30days \
         . \
         ~/.cache/vim/{backup,swap,undo}/ \
         -x rm -v
Plug 'sjl/gundo.vim'

noremap <Leader>u :GundoToggle<CR>
set undodir=~/.vim/undo/
set undofile

colors and themes

Plug 'NvChad/nvim-colorizer.lua'
require('config/theme')

# ~/.config/nvim/lua/config/theme.lua
require 'colorizer'.setup()
require 'colorizer'.setup {
  filetypes = {
    '*';
    css = { rgb_fn = true; mode = 'background'; };
    html = { names = true; };
    cmp_docs = {always_update = true}
  },
  user_default_options = { RRGGBBAA = true, css_fn = true, css = true, tailwind = true },
  buftypes = { "*", "!prompt", "!popup", }
}

others

[!NOTE|label:references:]

ctrl-p

require('cmp_nvim_lsp').default_capabilities

require'cmp'.setup {
  sources = {
    { name = 'nvim_lsp' }
  }
}

-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
local capabilities = require('cmp_nvim_lsp').default_capabilities()

-- An example for configuring `clangd` LSP to use nvim-cmp as a completion engine
require('lspconfig').clangd.setup {
  capabilities = capabilities,
  ...  -- other lspconfig configs
}
Plug 'hrsh7th/cmp-nvim-lsp'
set runtimepath+=~/.vim/plugged/cmp-nvim-lsp

[!NOTE|label:references:]

Last updated