The Vis Editor
Vim/Vim Classic/Neovim provide indispensable improvements over Vi, but they
are also massive, and one could spend years finding new features and
adjustments in
:help.
Vis is an editor that is very capable yet the entire user interface can be
summarized in about 1000 lines.
Switching from Vim
| vim → vis | ||
|---|---|---|
| Wrap/format text |
gq
|
=
|
| Search for text (must be valid regular expression) |
/
main(
|
/
main\(
|
| Search-and-replace is implemented using structured regular expressions |
:
%s/xyz/XYZ/
|
:
x/xyz/ c/XYZ/
|
| Default key bindings do not define line-oriented yank |
Y
or
yy
|
0Y
|
| Read output from external shell commands |
:
r!command
|
:
< command
|
| Instead of block mode, use regex to select the beginning of a line |
C-v
motion
I
#
Esc
|
v
motion
:x/^/
i
#
|
Digraphs
A dedicated utility
vis-digraph(1)
is used to insert special characters.
As with Vim, it is accessible using
C-k
in insert mode. With no argument this utility prints a list with human
readable descriptions, which makes finding the right character easy.
Structured Regular Expressions
To see how capable these changes are, try sanitizing a YouTube transcript, which has hours/minutes/seconds mixed in at the beginning of each line
00:5555 secondsthe quick brown fox 01:041 minute, 4 secondsjumped over 02:002 minutesthe lazy dog
Commands
:x/.+ (second|minute)[s]/ o 5<Right> :c/ /
Result
00:55 the quick brown fox 01:04 jumped over 02:00 the lazy dog
Customization
~/.config/vis/visrc.lua
require('vis') require('plugins/filetype-settings') vis.events.subscribe(vis.events.INIT, function() -- vis:command('set theme zenburn') -- vis:command('set theme base16-nord') vis:command('set theme base16-solarized-light') end) vis.events.subscribe(vis.events.WIN_OPEN, function(win) vis:command('set number') vis:command('set tabwidth 4') vis:command('set showtab on') end) settings = { python = {"set expandtab on"}, ruby = {"set expandtab on", "set tabwidth 2"}, } -- F7 in normal mode spellcheck = require('plugins/spellcheck') spellcheck.default_lang = "en_US"
~/bin/fmt
#!/bin/sh exec /usr/bin/fmt -w ${FMT_W:=80} "$@"
References
Vis Editor
– CoSin 2017
Vis Editor and Lua API documentation
A visrc.lua config
The vi family
Differences from Sam
– Vis Wiki