From c12369dec42c42bda73c5d46af975f3471122de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20B=C3=ACnh=20An?= <111893501+brianhuster@users.noreply.github.com> Date: Tue, 15 Apr 2025 16:40:16 +0700 Subject: [PATCH] docs: update Neovim intruction The configuration snippet for Neovim seems a bit outdated (it works, but I think we should recommend users the easy way) --- README.md | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 1226e85d1..fa0c1f540 100644 --- a/README.md +++ b/README.md @@ -128,32 +128,29 @@ let g:ale_linters = { \ } ``` +For Vim8/NeoVim v0.5 using [jayli/vim-easycomplete](https://github.com/jayli/vim-easycomplete). Execute `:InstallLspServer sh` and config nothing. Maybe it's the easiest way to use bash-language-server in vim/nvim. + #### Neovim -For Neovim v0.8: +For Neovim 0.11+ with [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) ```lua -vim.api.nvim_create_autocmd('FileType', { - pattern = 'sh', - callback = function() - vim.lsp.start({ - name = 'bash-language-server', - cmd = { 'bash-language-server', 'start' }, - }) - end, -}) +vim.lsp.enable 'bashls' ``` +For Neovim 0.11+ without plugins -For NeoVim using [autozimu/LanguageClient-neovim][languageclient-neovim], add the following configuration to -`init.vim`: - -```vim -let g:LanguageClient_serverCommands = { - \ 'sh': ['bash-language-server', 'start'] - \ } +```lua +vim.lsp.config.bashls = { + cmd = { 'bash-language-server', 'start' }, + filetypes = { 'bash', 'sh' } +} +vim.lsp.enable 'bashls' ``` -For Vim8/NeoVim v0.5 using [jayli/vim-easycomplete](https://github.com/jayli/vim-easycomplete). Execute `:InstallLspServer sh` and config nothing. Maybe it's the easiest way to use bash-language-server in vim/nvim. +For Neovim 0.10 or lower with [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) +```lua +require 'lspconfig'.bashls.setup {} +``` #### Oni