spacemacs/layers/+lang/shell-scripts
Daniel Richtmann 724eb908a8 Enable experimental support for lsp within the shell-scripts layer
Note that this is only valid for bash scripts, since it uses the
`bash-language-server` defined in `lsp-clients.el`
2019-09-22 20:51:33 +02:00
..
img Use + instead of ! for layer categories 2015-09-11 00:13:51 -04:00
config.el Enable experimental support for lsp within the shell-scripts layer 2019-09-22 20:51:33 +02:00
funcs.el Enable experimental support for lsp within the shell-scripts layer 2019-09-22 20:51:33 +02:00
packages.el Enable experimental support for lsp within the shell-scripts layer 2019-09-22 20:51:33 +02:00
README.org Enable experimental support for lsp within the shell-scripts layer 2019-09-22 20:51:33 +02:00

Shell Scripts layer

/TakeV/spacemacs/media/commit/724eb908a8a2a40e843e4d8bf1aef5f28ba6d0ab/layers/+lang/shell-scripts/img/fish.png

Description

This simple layer adds support for shell scripting.

Supported scripting files:

Note: For Windows scripting see the layer windows-scripts

Features:

Install

Layer

To use this configuration layer, add it to your ~/.spacemacs. You will need to add shell-scripts to the existing dotspacemacs-configuration-layers list in this file.

Linting

In order to enable sh scripts linting, install shellcheck.

Style checking

In order to enable sh scripts style checking, install bashate.

Setting the backend

To activate the backend set the layer variable shell-scripts-backend:

  (shell-scripts :variables shell-scripts-backend 'lsp)

For spacemacs to use lsp you also need to add lsp to the dotspacemacs-configuration-layers in your ~/.spacemacs file.

Backend

Language Server Protocol

You have to install the bash language server:

  npm i -g bash-language-server

You can find further information on the project's GitHub page.

Key bindings

Key binding Description
SPC m \ insert end-of-line backslashes to the lines in the region
SPC i ! insert shebang in a script file
SPC m i ! insert shebang in a script file
SPC m i c insert switch case statement if supported by shell
SPC m i i insert if statement if supported by shell
SPC m i f insert function definition if supported by shell
SPC m i o insert for loop if supported by shell
SPC m i e insert an indexed for loop if supported by shell
SPC m i w insert while loop if supported by shell
SPC m i r insert repeat loop if supported by shell
SPC m i s insert select loop if supported by shell
SPC m i u insert until loop if supported by shell
SPC m i g insert a getopts while loop if supported by shell