A Vim plugin for syntax highlighting of OpenQASM files.
Add the line
Plugin 'openqasm/openqasm.vim'into your .vimrc between the call vundle#begin() and call vundle#end() lines, reload, and run :PluginInstall.
Add the line
Plug 'openqasm/openqasm.vim'into your .vimrc between the call plug#begin() and call plug#end() lines, reload, and run :PlugInstall.
Clone this repository somewhere locally with
$ cd <plugins path>
$ git clone https://github.com/openqasm/openqasm.vimThis does not need to be in the .vim directory.
Now add the plugin's subdirectory to Vim's runtime path, by adding the following to your .vimrc:
set rtp+='<plugins path>/openqasm.vim'Reload .vimrc to load the plugin.
At present, this only provides syntax highlighting file for OpenQASM files, which automatically registers itself for all files with the name *.qasm.
To turn on syntax highlighting for another file (for example stdgates.inc), call
:set filetype=openqasmeither as a command, or as part of an autocommand.
The default highlighting groups are defined at the bottom of the file syntax/openqasm.vim.
You can override these in your own configuration files (.vimrc, etc) if you prefer different groupings.
The plugin attempts to determine the OpenQASM version from the required OPENQASM <version>; statement at the top of the file, and falls back to OpenQASM 3.0 if this is unparseable (perhaps on multiple lines) or not present.
You can control the fallback value by setting
let g:openqasm_version_fallback = 2.0in your .vimrc file.
You can override all version checking with
let g:openqasm_version_override = 2.0For full help, call
:help openqasmNo attempt is made to highlight the arbitrary grammars present inside defcal blocks of OpenQASM 3.
This would be strongly dependent on the grammar file loaded by the defcalgrammar statement.
openqasm.vim is licensed under the Apache 2.0 open-source license.
See the LICENSE file in the root of this repository for more information.

