%h1 The Vis Editor

%p
  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
  = succeed '.' do
    %code :help 
  Vis is an editor that is very capable yet the entire user interface can be
  summarized in about 1000 lines.

%h2 Switching from Vim

%table
  %tr
    %th
    %th{:colspan=>"2"}
      vim
      %span{:style=>"margin-left: 2em; margin-right: 2em"} &rarr;
      vis
  %tr
    %td
      Wrap/format text
    %td
      %code gq
    %td
      %code =
  %tr
    %td
      Search for text (must be valid regular expression)
    %td
      %code /
      %code main(
    %td
      %code /
      %code main\(
  %tr
    %td
      Search-and-replace is implemented using structured regular expressions
    %td
      %code :
      %code %s/xyz/XYZ/
    %td
      %code :
      %code x/xyz/ c/XYZ/
  %tr
    %td
      Default key bindings do not define line-oriented yank
    %td
      %code Y
      or
      %code yy
    %td
      %code 0Y
  %tr
    %td
      Read output from external shell commands
    %td
      %code :
      %code r!command
    %td
      %code :
      %code < command
  %tr
    %td
      Instead of block mode, use regex to select the beginning of a line
    %td.nowrap
      %code C-v
      %em motion
      %code I
      %code #
      %code Esc
    %td.nowrap
      %code v
      %em motion
      %code :x/^/
      %code i
      %code #

%h3 Digraphs

%p
  A dedicated utility
  %a{:href=>"https://man.archlinux.org/man/vis-digraph.1.en"} vis-digraph(1)
  is used to insert special characters.
  As with Vim, it is accessible using
  %code C-k
  in insert mode.  With no argument this utility prints a list with human
  readable descriptions, which makes finding the right character easy.

%h2 Structured Regular Expressions

%p
  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

%pre
  00:55<span class="hl">55 seconds</span>the quick brown fox
  01:04<span class="hl">1 minute, 4 seconds</span>jumped over
  02:00<span class="hl">2 minutes</span>the lazy dog

%p
  Commands

:codeblock
  :x/.+ (second|minute)[s]/
  o
  5<Right>
  :c/ /

%p
  Result

%pre
  00:55 the quick brown fox
  01:04 jumped over
  02:00 the lazy dog

%h2 Customization

%p
  %code ~/.config/vis/visrc.lua

:codeblock
  :::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"

%p
  %code ~/bin/fmt

:codeblock
  :::sh
  #!/bin/sh
  exec /usr/bin/fmt -w ${FMT_W:=80} "$@"

%h2 References

%p
  %a{:href=>"https://www.brain-dump.org/gsoc17/vis-cosin.pdf"} Vis Editor
  &ndash; CoSin 2017
  %br
  %a{:href=>"https://martanne.github.io/vis/doc/"} Vis Editor and Lua API documentation
  %br
  %a{:href=>"https://rnpnr.xyz/git/dotfiles/file/.config/vis/visrc.lua.html"} A visrc.lua config
  %br
  %a{:href=>"https://lpar.ath0.com/posts/2026/05/the-vi-family/"} The vi family
  %br
  %a{:href=>"https://github.com/martanne/vis/wiki/Differences-from-Sam"} Differences from Sam
  &ndash; Vis Wiki
