spacemacs/layers/+lang/shell-scripts
syl20bnr 584392bd92 [core] Fix layer dependencies based on layer variables
There was a edge case with the declaration of the `lsp` layer in `layers.el`
files.
The `hy` layer depends on the `python` layer which in turn depends on the `lsp`
layer if and only if the `python-backend` layer variable is set to `lsp`.
When the `hy` layer was declared first then it declares the `python` layer
without its layer variables, thus the `lsp` layer was not declared because the
`python-backend` variable was not set.

The fix is to gather all the layer dependencies and resolve them only after all
the used layers have been declared.

* new function `configuration-layer/declare-layer-dependencies`
* replace all calls to `configuration-layer/declare-layer` by the new function
  except for distribution layers (we declare layer dependencies right away in
  distribution layers)
2019-09-30 02:00:48 -04:00
..
img Use + instead of ! for layer categories 2015-09-11 00:13:51 -04:00
config.el [lsp] When used, make LSP the default backend for all supported lang 2019-09-30 00:49:44 -04:00
funcs.el [lsp] When used, make LSP the default backend for all supported lang 2019-09-30 00:49:44 -04:00
layers.el [core] Fix layer dependencies based on layer variables 2019-09-30 02:00:48 -04:00
packages.el Enable experimental support for lsp within the shell-scripts layer 2019-09-22 20:51:33 +02:00
README.org [lsp] When used, make LSP the default backend for all supported lang 2019-09-30 00:49:44 -04:00

Shell Scripts layer

/TakeV/spacemacs/media/commit/2390c4ed69984fdba971644ab982143c393ae5e4/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.

Backends

You have the choice between two different backends with different setup instructions and different capabilities.

Shell-script-mode

This is the recommended way for working with shell scripts in emacs. It works by using an emacs major mode.

It supports bash and fish shell scripts.

No additional setup is necessary.

LSP

This backend uses an external server to provide the various IDE integrations and a more modern UI integration in spacemacs.

However it only supports working with bash scripts.

It requires installing the external server via:

  npm i -g bash-language-server

Enable the lsp layer to activate this backend as well as setting the layer variable shell-scripts-backend:

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

You can find further information about the project at its 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