QubesOS / qubes-issues

The Qubes OS Project issue tracker
https://www.qubes-os.org/doc/issue-tracking/
536 stars 48 forks source link

Contribution - Qrexec Policy usability for Admins with Vim Plugin #8616

Open ben-grande opened 1 year ago

ben-grande commented 1 year ago

How to file a helpful issue

Background

Previously discussed on the mailing list, with the repo.

The problem is the syntax is lacking checks, there is node code completion, no spell checking for comments excluding valid Qrexec words and most of all, there is no integrated linter.

The package vim-qrexec solves all of this. Vim-qrexec was tested on Vim 8.2 and Vim9.0. Vim9.0 is not working well with markdown_fenced_blocks but that is minor.

What is needed?

A reviewer, someone that can understand VimL, but especially Vim Regex. Everything is available through Vim's internal help but it may take some time to understand every aspect of it.

Check out the tests/ directory for examples of trying to break the syntax, but can also be used to try to complete incorrect words, which should fail.

The goal is to add it as a package to qubes-core-qrexec.

ben-grande commented 9 months ago

vim-qrexec supports the new policy syntax and I've been using it on Qubes R4.2. Bumping for community review.

ben-grande commented 6 months ago

Maybe it's best to convince visually for those that haven't tried it yet. Besides my colorscheme, the functionality you will see below is provided by vim-qrexec, two 3rd lint plugins are supported and are optional but greatly enhances the experience, you can use vim builtin make command instead as will be show later.

The advantange of ALE over Dispatch or Vim's built-in make is that it works on what is being currently edited without having to save the file to disk for it to be linted.

Documentation

You can learn about what this plugins does from inside vim.

qrexec help

Lint

The lint you see on the bottom window is from vim-dispatch. The lint you see on the end of the line is from vim-ale.

qrexec dispatch

Vim's built-in linter make is not pretty but usable:

qrexec make

Code completion

Note the completion works on already inserted words of the file, if they are valid for that field.

qrexec completion-1 qrexec completion-5

Syntax

Syntax of 3 file types, the format of 4.0, the format of 4.1 and the rpc-config format.

qrexecconfig Service-1

qrexecpolicy policy-1 qrexecpolicy policy-4