On Structured Regular Expressions and neovim (and vis)

Tue 03 March 2020 2 min read

(meant as an extended comment on neovim’s bug #8457: “Support sam/vim Structured Regular Expressions?”)

This is not a comprehensive review of vis or even just its comparison with vim. I would like to just describe my small moment of epiphany when working on some document with vis.

There is my large to-do list (actually maintained with VimOutliner, so that’s another problem) with all my work tasks. There is a couple of bugs which I am fixing with one large submit request. Unfortunately, it was a really huge request (basically rebasing of Python package for old SLE distribution to the latest 2.7.* version), and I haven’t managed to make the submission right on the first attempt. Or even on the second one. Or even … You get the picture. So, I have to update the number of the submit request multiple times.

The solution with the regular vim (or neovim, or any other vi-like editor) is something I can do in my dreams:


When thinking about this, it surprise how ridiculous this is. I really don’t to “search for the line which contains this particular pattern from it and replace it with this new pattern”. And of course, this is just very simple example, substitute command can get a way more complicated.

When doing the same with vis the command was slightly different (and not the only one possible), but it seems to me much more logical:

:x/ssr#oldnumber/ x/\d+/ c/newnumber/

Couple of comments on this. Yes, these all three commands are on one command line just separated with space. Vis, not being kept down by the compatibility with vi uses more normal regular expression engine (libtre, which implements POSIX Extended REs with some enhancements like approximate matches).

More on the higher level. I have intentionally used this very simple example to show that even in this level it makes more sense to me (more complicated examples are available). “Select broadly what you want, pinpoint on what exactly you want to change, and do it” makes much more sense, than (subconscious) translating my real task into the world of lines and matching them.

My suspicion is that with the rising complexity of the task, complexity of the vim substitute command rises exponentially, whereas the commands with vis rises just linearly. However, I would have to work on this more.

Category: computer Tagged: vim regexp plan9 vis


Design notes on plan9-for-vimspace

Mon 04 December 2017 14 min read


The purpose of this paper is to document any possible ideas, which could be salvaged from the Acme text editor of Plan9 fame, and reuse in vim.

When I have seen for the first time Cox (2012) presenting Acme, modular text editor from Plan9, I was intriguied by its …

Category: computer Tagged: vim plan9 ACME GUI


Read More
Page 1 of 1