Ⅰ. 插件描述
A language server for BashⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'mads-hartmann/bash-language-server'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'mads-hartmann/bash-language-server'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'mads-hartmann/bash-language-server'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/mads-hartmann/bash-language-server
Ⅳ. 文档说明
# Bash Language Server
Bash language server implementation based on Tree Sitter and its grammar for Bash
with explainshell integration.
Features
- [x] Jump to declaration
- [x] Find references
- [x] Code Outline & Show Symbols
- [x] Highlight occurrences
- [x] Code completion
- [x] Simple diagnostics reporting
- [x] Documentation for flags on hover
- [x] Workspace symbols
- [ ] Rename symbol
Installation
npm i -g bash-language-serverIf you encounter installation errors, ensure you have node version 8 or newer (node --version).
Clients
The following editors and IDEs have available clients:
- Visual Studio Code (Bash IDE)
- Atom (ide-bash)
- Vim (see below)
- Neovim (see below)
- Oni (see below)
- Eclipse (ShellWax)
- Emacs (see below)
- JupyterLab (jupyterlab-lsp)
Vim
For Vim 8 or later install the plugin prabirshrestha/vim-lsp and add the following configuration to .vimrc:
if executable('bash-language-server')
au User lsp_setup call lsp#register_server({
\ 'name': 'bash-language-server',
\ 'cmd': {server_info->[&shell, &shellcmdflag, 'bash-language-server start']},
\ 'whitelist': ['sh'],
\ })
endifFor Vim 8 or Neovim using neoclide/coc.nvim, according to it's Wiki article, add the following to your coc-settings.json:
"languageserver": {
"bash": {
"command": "bash-language-server",
"args": ["start"],
"filetypes": ["sh"],
"ignoredRootPaths": ["~"]
}
}For Vim 8 or NeoVim using w0rp/ale add the following
configuration to your .vimrc:
let g:ale_linters = {
\ 'sh': ['language_server'],
\ }Neovim
Install the plugin autozimu/LanguageClient-neovim and add the following configuration toinit.vim:
let g:LanguageClient_serverCommands = {
\ 'sh': ['bash-language-server', 'start']
\ }Oni
On the config file (File -> Preferences -> Edit Oni config) add the following configuration:
"language.bash.languageServer.command": "bash-language-server",
"language.bash.languageServer.arguments": ["start"],Emacs
Lsp-mode has a built-in client, can be installed by use-package.
Add the configuration to your .emacs.d/init.el
(use-package lsp-mode
:commands lsp
:hook
(sh-mode . lsp))Development Guide
Please see docs/development-guide for more information.