sagemathinc / viz

A very fast and lightweight vim like editor written in C and lua with multiple cursors and syntax highlight
Other
5 stars 0 forks source link

Viz - A very fast and lightweight vim-like editor written in C and Lua with multiple cursors and syntax highlight

This is a fork of https://github.com/martanne/vis, meant to be more friendly to my needs.

Please see https://github.com/martanne/vis for the overall goals of that editor. This readme is mostly about specifics to this fork.

Also, watch this amazing 15 minute talk by the creator of vis (demo), which emphasizes how to use multiple cursors and how selection is aware of the document structure:

Name: I've renamed it viz instead of vis, because on macOS there is already a standard program /usr/bin/vis that "display non-printable characters in a visual format", and related vis functionality in the standard lib (man 3 vis), which has nothing to do with this editor. It's confusing to me. Also, this helps separate any changes I make here from the official "vis", since I might end up

Build instructions

In order to build vis you will need a C99 compiler, a POSIX.1-2008 compatible environment as well as:

Assuming these dependencies are met, execute:

$ ./configure && make && sudo make install

By default the configure script will try to auto detect support for Lua using pkg-config(1). See configure --help for a list of supported options. You can also manually tweak the generated config.mk file.

NOTE about other dependencies: The upstream project https://github.com/martanne/vis depended on libtermkey (for terminal support) and lpeg for syntax highlighting. Those libraries used to be under active development when vis started, but in 2022 they are both completely done. libtermkey is actually officially deprecated, and lpeg hasn't had a single commit in years. So instead we include copies of a snapshot of their code here, and replace their archaic build system with just integrating it with vis's standard build system. Since lpeg requires lua, of course now lua is a mandatory dependency, whereas it used to be optional. Editing code without syntax highlighting and the ability to customize the editor is not an option these days, so requiring lua is fine.

Persistent Configuration

Here's an example of how to get going with configuring vis. If you want to change the default theme to be zenburn, make ~/.config/vis, a lua program to set the theme in a persistent way:

~/.config/vis$ cat visrc.lua 
require('vis')
vis.events.subscribe(vis.events.INIT, function()
   vis:command('set theme zenburn')
end)

Documentation

Most of the upstream docs for vis should apply just fine -- End user documentation can be found in the vis(1) manual page and the Wiki. Read the FAQ for common questions. Learn about some differences compared to sam(1) and vim(1), respectively.

C API as well as Lua API documentation is also available.https://news.ycombinator.com/item?id=11434195

Links