All Projects → prabirshrestha → Vim Lsp

prabirshrestha / Vim Lsp

Licence: other
async language server protocol plugin for vim and neovim

Programming Languages

Vim Script
2826 projects

Projects that are alternatives of or similar to Vim Lsp

asyncomplete-nextword.vim
Provides intelligent English autocomplete for asyncomplete.vim via nextword
Stars: ✭ 43 (-98.07%)
Mutual labels:  vim8, asyncomplete
Vim Lsc
A vim plugin for communicating with a language server
Stars: ✭ 545 (-75.56%)
Mutual labels:  language-server-protocol, neovim
jdtls-launcher
The simplest way to install and launch JDTLS
Stars: ✭ 29 (-98.7%)
Mutual labels:  neovim, language-server-protocol
Vim Signify
➕ Show a diff using Vim its sign column.
Stars: ✭ 2,390 (+7.17%)
Mutual labels:  async, neovim
Ctrlsf.vim
An ack.vim alternative mimics Ctrl-Shift-F on Sublime Text 2
Stars: ✭ 1,283 (-42.47%)
Mutual labels:  async, neovim
Async.vim
normalize async job control api for vim and neovim
Stars: ✭ 242 (-89.15%)
Mutual labels:  async, neovim
Gen tags.vim
Async plugin for vim and neovim to ease the use of ctags/gtags
Stars: ✭ 288 (-87.09%)
Mutual labels:  async, neovim
Neomake
Asynchronous linting and make framework for Neovim/Vim
Stars: ✭ 2,512 (+12.65%)
Mutual labels:  async, neovim
Vista.vim
🌵 Viewer & Finder for LSP symbols and tags
Stars: ✭ 1,218 (-45.38%)
Mutual labels:  language-server-protocol, neovim
Vim Grepper
👾 Helps you win at grep.
Stars: ✭ 1,030 (-53.81%)
Mutual labels:  async, neovim
Vim Lsp Cxx Highlight
Vim plugin for C/C++/ObjC semantic highlighting using cquery, ccls, or clangd
Stars: ✭ 231 (-89.64%)
Mutual labels:  language-server-protocol, neovim
Neotags.nvim
Tag highlight in neovim
Stars: ✭ 124 (-94.44%)
Mutual labels:  async, neovim
Iron.nvim
Interactive Repl Over Neovim
Stars: ✭ 265 (-88.12%)
Mutual labels:  async, neovim
Fern.vim
🌿 General purpose asynchronous tree viewer written in Pure Vim script
Stars: ✭ 552 (-75.25%)
Mutual labels:  async, neovim
Nvim Lspconfig
Quickstart configurations for the Nvim LSP client
Stars: ✭ 3,410 (+52.91%)
Mutual labels:  language-server-protocol, neovim
Acid.nvim
Asynchronous Clojure Interactive Development
Stars: ✭ 147 (-93.41%)
Mutual labels:  async, neovim
Nvcode
An IDE layer for Neovim with sane defaults. Completely free and community driven.
Stars: ✭ 6,714 (+201.08%)
Mutual labels:  neovim
Darcula
A Vim color scheme reproduction of the official JetBrains IDE Darcula theme
Stars: ✭ 158 (-92.91%)
Mutual labels:  neovim
Plenary.nvim
plenary: full; complete; entire; absolute; unqualified. All the lua functions I don't want to write twice.
Stars: ✭ 150 (-93.27%)
Mutual labels:  neovim
Tortoise Orm
Familiar asyncio ORM for python, built with relations in mind
Stars: ✭ 2,558 (+14.71%)
Mutual labels:  async

vim-lsp Gitter

Async Language Server Protocol plugin for vim8 and neovim.

Installing

Install vim-plug and then:

Plug 'prabirshrestha/vim-lsp'

Performance

Certain bottlenecks in Vim script have been implemented in lua. If you would like to take advantage of these performance gains use vim compiled with lua or neovim v0.4.0+

Registering servers

if executable('pyls')
    " pip install python-language-server
    au User lsp_setup call lsp#register_server({
        \ 'name': 'pyls',
        \ 'cmd': {server_info->['pyls']},
        \ 'allowlist': ['python'],
        \ })
endif

function! s:on_lsp_buffer_enabled() abort
    setlocal omnifunc=lsp#complete
    setlocal signcolumn=yes
    if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif
    nmap <buffer> gd <plug>(lsp-definition)
    nmap <buffer> gs <plug>(lsp-document-symbol-search)
    nmap <buffer> gS <plug>(lsp-workspace-symbol-search)
    nmap <buffer> gr <plug>(lsp-references)
    nmap <buffer> gi <plug>(lsp-implementation)
    nmap <buffer> gt <plug>(lsp-type-definition)
    nmap <buffer> <leader>rn <plug>(lsp-rename)
    nmap <buffer> [g <plug>(lsp-previous-diagnostic)
    nmap <buffer> ]g <plug>(lsp-next-diagnostic)
    nmap <buffer> K <plug>(lsp-hover)
    inoremap <buffer> <expr><c-f> lsp#scroll(+4)
    inoremap <buffer> <expr><c-d> lsp#scroll(-4)

    let g:lsp_format_sync_timeout = 1000
    autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync')
    
    " refer to doc to add more commands
endfunction

augroup lsp_install
    au!
    " call s:on_lsp_buffer_enabled only for languages that has the server registered.
    autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
augroup END

Refer to vim-lsp-settings on how to easily setup language servers using vim-lsp automatically.

Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'

auto-complete

Refer to docs on configuring omnifunc or asyncomplete.vim.

Snippets

vim-lsp does not support snippets by default. If you want snippet integration, you will first have to install a third-party snippet plugin and a plugin that integrates it in vim-lsp. At the moment, you have following options:

  1. vim-vsnip together with vim-vsnip-integ
  2. UltiSnips together with vim-lsp-ultisnips
  3. neosnippet.vim together with vim-lsp-neosnippet

For more information, refer to the readme and documentation of the respective plugins.

Folding

You can let the language server automatically handle folding for you. To enable this, you have to set 'foldmethod', 'foldexpr' and (optionally) 'foldtext':

set foldmethod=expr
  \ foldexpr=lsp#ui#vim#folding#foldexpr()
  \ foldtext=lsp#ui#vim#folding#foldtext()

If you would like to disable folding globally, you can add this to your configuration:

let g:lsp_fold_enabled = 0

Also see :h vim-lsp-folding.

Semantic highlighting

vim-lsp supports the unofficial extension to the LSP protocol for semantic highlighting (https://github.com/microsoft/vscode-languageserver-node/pull/367). This feature requires Neovim highlights, or Vim with the textprop feature enabled. You will also need to link language server semantic scopes to Vim highlight groups. Refer to :h vim-lsp-semantic for more info.

Supported commands

Note:

  • Some servers may only support partial commands.
  • While it is possible to register multiple servers for the same filetype, some commands will pick only the first server that supports it. For example, it doesn't make sense for rename and format commands to be sent to multiple servers.
Command Description
:LspAddTreeCallHierarchyIncoming Find incoming call hierarchy for the symbol under cursor, but add the result to the current list
:LspCallHierarchyIncoming Find incoming call hierarchy for the symbol under cursor
:LspCallHierarchyOutgoing Find outgoing call hierarchy for the symbol under cursor
:LspCodeAction Gets a list of possible commands that can be applied to a file so it can be fixed (quick fix)
:LspCodeLens Gets a list of possible commands that can be executed on the current document
:LspDeclaration Go to the declaration of the word under the cursor, and open in the current window
:LspDefinition Go to the definition of the word under the cursor, and open in the current window
:LspDocumentDiagnostics Get current document diagnostics information
:LspDocumentFormat Format entire document
:LspDocumentRangeFormat Format document selection
:LspDocumentSymbol Show document symbols
:LspHover Show hover information
:LspImplementation Show implementation of interface in the current window
:LspNextDiagnostic jump to next diagnostic (all of error, warning, information, hint)
:LspNextError jump to next error
:LspNextReference jump to next reference to the symbol under cursor
:LspNextWarning jump to next warning
:LspPeekDeclaration Go to the declaration of the word under the cursor, but open in preview window
:LspPeekDefinition Go to the definition of the word under the cursor, but open in preview window
:LspPeekImplementation Go to the implementation of an interface, but open in preview window
:LspPeekTypeDefinition Go to the type definition of the word under the cursor, but open in preview window
:LspPreviousDiagnostic jump to previous diagnostic (all of error, warning, information, hint)
:LspPreviousError jump to previous error
:LspPreviousReference jump to previous reference to the symbol under cursor
:LspPreviousWarning jump to previous warning
:LspReferences Find references
:LspRename Rename symbol
:LspStatus Show the status of the language server
:LspTypeDefinition Go to the type definition of the word under the cursor, and open in the current window
:LspTypeHierarchy View type hierarchy of the symbol under the cursor
:LspWorkspaceSymbol Search/Show workspace symbol

Diagnostics

Document diagnostics (e.g. warnings, errors) are enabled by default, but if you preferred to turn them off and use other plugins instead (like Neomake or ALE, set g:lsp_diagnostics_enabled to 0:

let g:lsp_diagnostics_enabled = 0         " disable diagnostics support

Highlight references

Highlight references to the symbol under the cursor (enabled by default). You can disable it by adding

let g:lsp_document_highlight_enabled = 0

to your configuration.

To change the style of the highlighting, you can set or link the lspReference highlight group, e.g.:

highlight lspReference ctermfg=red guifg=red ctermbg=green guibg=green

Debugging

In order to enable file logging set g:lsp_log_file.

let g:lsp_log_verbose = 1
let g:lsp_log_file = expand('~/vim-lsp.log')

" for asyncomplete.vim log
let g:asyncomplete_log_file = expand('~/asyncomplete.log')

Tests

vim-themis is used for testing. To run integration tests gopls executable must be in path.

Maintainers

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Sponsors

Become a sponsor and get your logo on our README on GitHub with a link to your site. [Become a sponsor]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].