Perl5 layer
Table of ContentsClose
1. Description¶
This layer adds support for the Perl5 language.
2. Install¶
To use this configuration layer, add it to your ~/.spacemacs
. You will need to
add perl5
to the existing dotspacemacs-configuration-layers
list in this
file.
3. Configuration¶
All layer configurations can be done by setting layer variables in your dotfile. No custom user config lines are necessary
3.1. Choosing a backend¶
This layer provides two alternative backends to choose from.
3.1.1. Company-plsense¶
This is the default choice if nothing is set and no lsp layer is loaded in your dotfile. This mode only provides very limited IDE capabilities. Used best if only small files are edited. To set explicitly set the following in your dotfile:
(perl5 :variables perl5-backend 'company-plsense)
- Auto-completion: PlSense
company-plsense
requires installation of theplsense
server from here.
3.1.2. LSP¶
For proper IDE support this backend should be used. It is based on an external server which will be started automatically by emacs, once a perl5 file is opened. The key bindings are the same for all lsp modes so if you are already familiar with one you should be able to work the same in all modes.
To set explicitly do the following in your dotfile:
(perl5 :variables perl5-backend 'lsp)
For this to work you will also need to obtain the latest version of the lsp server from here.
Alternatively the server can be installed with:
cpan Perl::LanguageServer
NOTE: Key bindings for LSP are defined in the LSP layer. Also it is advisable to have a look at the autocomplete layer for an optimal intellisense config for LSP.
4. Key bindings¶
4.1. Perldoc¶
Browse formatted perldocs.
Key binding | Description |
---|---|
SPC m h h |
view perldoc of symbol at point |
SPC m h d |
view perldoc of any symbol |
4.2. POD and HERE doc¶
Select a POD or HERE doc.
Key binding | Description |
---|---|
SPC m v |
select entire POD or HERE doc at point |
4.3. Find Symbol¶
Jump to symbol definition.
Key binding | Description |
---|---|
SPC m g g |
jump to symbol definition |
SPC m g G |
jump to symbol definition in other window |
4.4. Formatting Code¶
Key binding | Description |
---|---|
SPC m = = |
format current line or region |
SPC m = b |
format current buffer |
SPC m = f |
format current function |