Vis editor tutorial

Those notes are meant for those who already know vi/vim.

What's vis

Vis is a modal editor inspired by both vi(m) and sam. Basically it's vi with ex

replaced by sam regexes.

Project Github page

Project SourceHut page

Objective of this article

Vis doesn't have a proper tutorial, to learn it you have to read its help and

manpage. There is a video demonstration on ascii I find it quite inconvienant,

I prefer to learn by pratice.

It is recommanded to download this gmi file, so you can open it in vis.

Basic sam regexes

In this part you'll learn a few ways to use sam regexes within vis.

To avoid messing up with the text I recommand selecting lines in visual

mode so that the command is only applied to the selection.

Substitution

You can do a substitution like so :

:x/pattern/ c/replacement/<Enter>

which is the equivalent in vi/ex to :

:s/pattern/replacement/

Try it out by replacing "thee" by "the" in the following text :

thee best time to see thee flowers is in thee spring.

Now let's decompose what we just did :

Those two commands are independant try to do this :

As you might have noticed, when executing the x command you switched to visual

mode.

So as a third way to substitute text you can first select the text with x, and then

use the vi command c.

Append/Insert text

add the missing letters in the next line (example : x/ext/ i/t/)

this ext, is missin a few letter

Warning : if you want to do the same with vi command you have to first press

<Escape> to get back to insert mode, you'll have a cursor placed at the beginning

of each selection.

Deletion

The d command is used for deleting selection.

Delete every comma in the example

by using the following command

x/,/d<Enter>

note that you can seperate commands with spaces :

x/,/ d<Enter>

Example :

This, text, has, a, lot, of, commas.