#+TITLE: Vimscript language layer

#+TAGS: dsl|layer|programming|script

* Table of Contents                     :TOC_5_gh:noexport:
- [[#description][Description]]
  - [[#features][Features:]]
- [[#install][Install]]
- [[#configuration][Configuration]]
  - [[#choosing-a-backend][Choosing a backend]]
    - [[#company-vimscript][Company-vimscript]]
    - [[#lsp][LSP]]

* Description
This layer adds support for vimscript and pentadactyl config files.

** Features:
- Syntax highlighting
- Auto-completion (with LSP)
- Syntax-checking (with LSP)

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

* Configuration
All layer configurations can be done by setting layer variables in your dotfile.
No custom user config lines are necessary

** Choosing a backend
This layer provides two alternative backends to choose from.

*** Company-vimscript
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 scripts
are edited. To set explicitly set the following in your
dotfile:

#+BEGIN_SRC emacs-lisp
  (vimscript :variables vimscript-backend 'company-vimscript)
#+END_SRC

*** 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 vimscript 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:

#+BEGIN_SRC emacs-lisp
  (vimscript :variables
             vimscript-backend 'lsp)
#+END_SRC

For this to work you will also need to install
the latest version of the lsp server with below command:

#+BEGIN_SRC sh
  npm install -g vim-language-server
#+END_SRC

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.
