8.2. Vim and Neovim

We have created a plugin for Vim and Neovim to make it easier to work with our configuration. It provides syntax highlighting, indentation and completion for the Halon script (HSL) source files.

Note

For a more fully-featured integration that supports linting and debugging right inside the code editor, see our Visual Studio Code integration instead.

8.2.1. Features

  • Syntax highlighting

  • Indentation

  • Completion

    • Covers the entire standard library

    • Trigger with Ctrl-X Ctrl-O (omni completion)

8.2.2. Installation

8.2.2.1. Vim

To install the plugin use the following command.

$ git clone https://github.com/halon/vim-hsl.git ~/.vim/pack/vendor/start/vim-hsl

To enable it add the following to your ~/.vimrc file.

syntax on
filetype plugin indent on

8.2.2.1.1. Plugin managers

If you use a plugin manager, add the repository to it instead of cloning it manually. With vim-plug, add the following between call plug#begin() and call plug#end() in your ~/.vimrc file. vim-plug enables syntax highlighting and filetype plugins itself, so the lines above are not needed.

Plug 'halon/vim-hsl'

8.2.2.1.2. Upgrade

In order to upgrade the plugin, use the following command.

$ git -C ~/.vim/pack/vendor/start/vim-hsl pull

If you installed it with a plugin manager, use its update command instead (e.g. :PlugUpdate).

8.2.2.2. Neovim

To install the plugin use the following command.

$ git clone https://github.com/halon/vim-hsl.git ~/.local/share/nvim/site/pack/vendor/start/vim-hsl

Neovim enables syntax highlighting and filetype plugins by default, so no extra configuration is needed.

8.2.2.2.1. Plugin managers

If you use a plugin manager, add the repository to it instead of cloning it manually. With lazy.nvim, add the following plugin spec.

{ "halon/vim-hsl", ft = "hsl" }

Neovim 0.12 and later also include an (experimental) built-in plugin manager. To use it add the following to your init.lua file.

vim.pack.add({ "https://github.com/halon/vim-hsl" })

8.2.2.2.2. Upgrade

In order to upgrade the plugin, use the following command.

$ git -C ~/.local/share/nvim/site/pack/vendor/start/vim-hsl pull

If you installed it with a plugin manager, use its update command instead (e.g. :Lazy update or :lua vim.pack.update()).

8.2.3. Screenshots

_images/vim-1.png

The Halon script (HSL) syntax highlighting and completion in action

_images/vim-2.png

Linting a script hook in a Vim window with :terminal halonconfig