From 86d86cf4a0b9c10a688497adc776d7372e26f335 Mon Sep 17 00:00:00 2001 From: bugarela Date: Mon, 25 Sep 2023 11:37:11 -0300 Subject: [PATCH 1/6] Add README file with vim/nvim setup instructions --- editor-plugins/vim/README.md | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 editor-plugins/vim/README.md diff --git a/editor-plugins/vim/README.md b/editor-plugins/vim/README.md new file mode 100644 index 000000000..245affcd0 --- /dev/null +++ b/editor-plugins/vim/README.md @@ -0,0 +1,40 @@ +# Vim support + +This guide will help you set up Vim for Quint, including syntax highlighting and an integrated language server. Follow these easy steps for a smooth configuration. + +## Syntax Highlighting + +1. Copy the [quint.vim] file to `~/.vim/syntax/` +2. Choose one of the following options to enable syntax highlighting for Quint: + + - **Option A (Manual):** Open a Quint file in Vim and manually set the syntax with `:set syntax=quint`. + + - **Option B (Automatic):** Add the following line to your `~/.vimrc` file: + + ```vim + au BufNewFile,BufReadPost *.qnt runtime syntax/quint.vim + ``` + + - **Option C (Modelines):** Make sure you have modelines enabled and add the following line to the end of your Quint file: + + ```bluespec + // vim: syntax=quint + ``` + +## Language Server (Neovim only) + +1. Install the [quint-language-server][] globally using npm: + +```sh +npm i @informalsystems/quint-language-server -g +``` + +2. Enable language server integration by adding the following lines to your `~/.config/nvim/init.vim`: + +```vim-script +autocmd FileType quint lua vim.lsp.start({name = 'quint', cmd = {'quint-language-server', '--stdio'}, root_dir = vim.fs.dirname()}) +au BufRead,BufNewFile *.qnt setfiletype quint +``` + +[quint.vim]: (./quint.vim) +[quint-language-server]: (https://www.npmjs.com/package/@informalsystems/quint-language-server) From 9cae27555c695a4a714abff456272976a0edfcde Mon Sep 17 00:00:00 2001 From: bugarela Date: Mon, 25 Sep 2023 11:37:44 -0300 Subject: [PATCH 2/6] List neovim client in the language server's README --- vscode/quint-vscode/server/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vscode/quint-vscode/server/README.md b/vscode/quint-vscode/server/README.md index 5cac570bb..e27840ded 100644 --- a/vscode/quint-vscode/server/README.md +++ b/vscode/quint-vscode/server/README.md @@ -14,9 +14,10 @@ npm i @informalsystems/quint-language-server -g ## Usage -There are currently two clients for this server: +There are currently three clients for this server: 1. The Quint [VSCode extension](https://marketplace.visualstudio.com/items?itemName=informal.quint-vscode) 2. The [Quint LSP client](https://github.com/informalsystems/quint/blob/main/editor-plugins/emacs/README.md) for Emacs +3. A [Neovim LSP client]((https://github.com/informalsystems/quint/blob/main/editor-plugins/vim/README.md) -They are capable of downloading and installing this server for you. +(1) and (2) are capable of downloading and installing this server for you. (3) requires manual installation (for now). From 5600b7b5581760243c1958f4c9d2e06759da20e9 Mon Sep 17 00:00:00 2001 From: bugarela Date: Mon, 25 Sep 2023 11:42:40 -0300 Subject: [PATCH 3/6] Update README with new editor support information --- README.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index db1ea76a5..78d14b189 100644 --- a/README.md +++ b/README.md @@ -102,12 +102,17 @@ editor (currently, VSCode, Emacs and Vim are supported). - [REPL](./tutorials/repl/repl.md) - - VSCode plugin: +- Editor support: - We strongly encourage you to use the VSCode plugin for Quint. It provides - the quickest feedback loop for your specifications, reporting informative - errors as you type. Install the plugin from [Visual Studio Code - Marketplace][]. + We strongly encourage you to configure your editor for Quint. Our language + server provides the quickest feedback loop for your specifications, reporting + informative errors as you type. These are instuctions for the currently + supported editors: + + - VSCode: Install the plugin from [Visual Studio Code + Marketplace][]. + - Emacs: Setup two custom packages from the [emacs folder](./editor-plugins/emacs). + - Vim/Neovim: Follow configuration instructions from the [vim folder](./editor-plugins/vim) - VSCode plugin for [ITF traces][] by @hvanz: From 68a18cef452f57d8582fda5952d001431e4de0f1 Mon Sep 17 00:00:00 2001 From: Igor Konnov Date: Wed, 27 Sep 2023 11:01:00 +0200 Subject: [PATCH 4/6] add the instructions on neovim syntax files --- editor-plugins/vim/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/editor-plugins/vim/README.md b/editor-plugins/vim/README.md index 245affcd0..0c19335b3 100644 --- a/editor-plugins/vim/README.md +++ b/editor-plugins/vim/README.md @@ -4,7 +4,8 @@ This guide will help you set up Vim for Quint, including syntax highlighting and ## Syntax Highlighting -1. Copy the [quint.vim] file to `~/.vim/syntax/` +1. If you are using vim, copy the [quint.vim] file to `~/.vim/syntax/`. +1. If you are using neovim, copy the [quint.vim] file to `~/.config/nvim/syntax`. 2. Choose one of the following options to enable syntax highlighting for Quint: - **Option A (Manual):** Open a Quint file in Vim and manually set the syntax with `:set syntax=quint`. From addec37c37377f0b47a0e7b02a47d20f751b8743 Mon Sep 17 00:00:00 2001 From: Thomas Pani Date: Wed, 27 Sep 2023 14:51:34 +0200 Subject: [PATCH 5/6] Add instructions for vim --- editor-plugins/vim/README.md | 55 ++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/editor-plugins/vim/README.md b/editor-plugins/vim/README.md index 0c19335b3..bddf02caf 100644 --- a/editor-plugins/vim/README.md +++ b/editor-plugins/vim/README.md @@ -22,7 +22,7 @@ This guide will help you set up Vim for Quint, including syntax highlighting and // vim: syntax=quint ``` -## Language Server (Neovim only) +## Language Server 1. Install the [quint-language-server][] globally using npm: @@ -30,6 +30,8 @@ This guide will help you set up Vim for Quint, including syntax highlighting and npm i @informalsystems/quint-language-server -g ``` +### Neovim + 2. Enable language server integration by adding the following lines to your `~/.config/nvim/init.vim`: ```vim-script @@ -37,5 +39,52 @@ autocmd FileType quint lua vim.lsp.start({name = 'quint', cmd = {'quint-language au BufRead,BufNewFile *.qnt setfiletype quint ``` -[quint.vim]: (./quint.vim) -[quint-language-server]: (https://www.npmjs.com/package/@informalsystems/quint-language-server) +### Vim + +This requires vim built with Lua support (check with `vim --version`). + +2. Install [`prabirshrestha/vim-lsp`](https://github.com/prabirshrestha/vim-lsp) (e.g., via vim-plug): + +```vim-script +Plug 'prabirshrestha/vim-lsp' +``` + +3. Enable LSP for Quint + +```vim-script +au BufRead,BufNewFile *.qnt setfiletype quint + +if executable('quint-language-server') + au User lsp_setup call lsp#register_server({ + \ 'name': 'quint', + \ 'cmd': {server_info->['quint-language-server', '--stdio']}, + \ 'allowlist': ['quint'], + \ }) +endif + +function! s:on_lsp_buffer_enabled() abort + setlocal omnifunc=lsp#complete + setlocal signcolumn=yes + if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif + nmap gd (lsp-definition) + nmap gs (lsp-document-symbol-search) + nmap gS (lsp-workspace-symbol-search) + nmap gr (lsp-references) + nmap gi (lsp-implementation) + nmap gt (lsp-type-definition) + nmap rn (lsp-rename) + nmap [g (lsp-previous-diagnostic) + nmap ]g (lsp-next-diagnostic) + nmap K (lsp-hover) + nnoremap lsp#scroll(+4) + nnoremap lsp#scroll(-4) +endfunction + +augroup lsp_install + au! + autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled() +augroup END +``` + +[quint.vim]: ./quint.vim +[quint-language-server]: https://www.npmjs.com/package/@informalsystems/quint-language-server From ae6915b57d753030ac02b26dc54c8ec787a24da5 Mon Sep 17 00:00:00 2001 From: bugarela Date: Thu, 28 Sep 2023 09:42:39 -0300 Subject: [PATCH 6/6] Add nvim path to syntax file instructions --- editor-plugins/vim/quint.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor-plugins/vim/quint.vim b/editor-plugins/vim/quint.vim index e3b7d03ff..df2a63862 100644 --- a/editor-plugins/vim/quint.vim +++ b/editor-plugins/vim/quint.vim @@ -4,7 +4,7 @@ " Latest Revision: 03 February 2023 " " How to install: -" 1. Copy this file to ~/.vim/syntax/ +" 1. Copy this file to ~/.vim/syntax/ (vim) or to ~/.config/nvim/syntax (neovim). " 2a. Either manually set syntax with :set syntax=quint " 2b. Or add the following in your ~/.vimrc " au BufNewFile,BufReadPost *.qnt runtime syntax/quint.vim