• Stars
    star
    319
  • Rank 131,491 (Top 3 %)
  • Language
    C
  • Created over 9 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A small vi/ex editor for editing UTF-8 text
NEATVI
======

Neatvi is a vi/ex editor.  It can edit bidirectional UTF-8 text.

CONFIGURATION
-------------

Edit conf.h to adjust syntax highlighting rules and text direction
patterns.  To define a new keymap, create a new array in kmap.h, like
kmap_fa, and add it to kmaps array in the same header (the first entry
of the new array specifies its name).  The current keymap may be
changed with :cm ex command.  When in input mode, ^e activates the
English keymap and ^f switches to the alternate keymap (the last
keymap specified with :cm).

Sadly, VTE-based terminals such as GNOME's implement a
backward-incompatible extension of virtual terminal escape codes to
render bidirectional text by default.  When using these terminal, the
value of LNPREF macro in conf.h needs to be edited.

COMMANDS
--------

Commands not available in ex(1):

:cm[ap][!] [kmap]
  Without kmap, prints the current keymap name.
  When kmap is specified, sets the alternate keymap to
  kmap and, unless ! is given, switches to this keymap.
:ft [filetype]
  Without filetype, prints the current file type.
  When filetype is specified, sets the file type of the
  current ex buffer.
:ta[g] tag
  Jumps to tag (tags file: TAGPATH environment variable or ./tags).
:tn[ext]
  Jumps to the next matching tag.
:tp[rev]
  Jumps to the previous matching tag.
:po[p]
  Pops tag stack.
:b[uffer] [buf]
  Switch to buffer buf (buffer number or alias); lists buffers
  if buf is missing.

New key mappings:
- ^a in normal mode: searches for the word under the cursor.
- ^p in insert mode: inserts the contents of the default yank buffer.
- zL, zl, zr, and zR in normal mode: change the value of td option.
- ^e and ^f in insert mode: switches to the English and alternate keymap.
- ze and zf in normal mode: switches to the English and alternate keymap.
- gu, gU, and g~ in normal mode: switches character case.
- ^l in normal mode: updates terminal dimensions (after resizing it).
- ^] and ^t in normal mode: jumps to tag and pops tag stack.
- gf in normal mode: edits the file whose address is under the cursor.
- gl in normal mode: like gf, but it reads line and column numbers too.
- ^ws, ^wo, ^wc, ^wj, ^wk, ^wx in normal mode: manages windows.
- ^wgf, ^wgl, ^w^] in normal mode: executes gf, gl, ^] in a new window.
- qX in normal mode: see q-commands section (X can be any letter).

Other noteworthy differences with vi(1):
- Neatvi assumes POSIX extended regular expressions (ERE) in search
  patterns, conf.h variables, and even tags files.
- If paths start with =, they are assumed to be relative to the
  directory of the current file.
- Neatvi highlights files whose names ends with ls as directory
  listings; the gl command can be used to edit its files.

OPTIONS
-------

To improve Neatvi's performance, shaping, character reordering, and
syntax highlighting can be disabled by defining the EXINIT environment
variable as "set noshape | set noorder | set nohl | set td=+2".

Options supported in Neatvi:

td, textdirection
  Current direction context.  The following values are meaningful:
  * +2: always left-to-right.
  * +1: follow conf.h's dircontexts[]; left-to-right for others.
  * -1: follow conf.h's dircontexts[]; right-to-left for others.
  * -2: always right-to-left.
shape
  If set (default), performs Arabic/Farsi letter shaping.
order
  If set, reorder characters based on the rules defined
  in conf.h.
hl, highlight
  If set (default), text will be highlighted based on syntax
  highlighting rules in conf.h.
hll, highlightline
  If set, highlight current line.
lim, linelimit
  Lines longer than this value are not reordered or highlighted.
ai, autoindent
  As in vi(1).
aw, autowrite
  As in vi(1).
ic, ignorecase
  As in vi(1).

MARKS AND BUFFERS
-----------------

Special marks:
- * the position of the previous change
- [ the first line of the previous change
- ] the last line of the previous change

Special yank buffers:
- / the previous search keyword
- : the previous ex command

Q-COMMANDS
----------

For qX command in normal mode, Neatvi executes ECMD (defined in conf.h)
with the following parameters:
- X (the key following q)
- current file
- current line number
- current line offset

ECMD must print a line of ex commands and Neatvi executes this line.
Q-commands can be used to add interesting features to Neatvi, such as
language-dependent IDE features, for instance by connecting to an LSP
(language server protocol) server.  As an example, the following
script shows how to use gopls to implement goto defintion and find
references for Go.

  # Compile.
  if test "$1" = "c"; then
    go build >.make.ls 2>&1
    echo ":e +1 .make.ls | :e"
  fi
  # Goto definition; uses gopls (not very efficient without using LSP).
  if test "$1" = "d"; then
    loc=`gopls definition $2:$3:$4`
    if test -n "$loc"; then
      echo $loc | sed -E 's/^([^:]+):([^:]+):([^:]+).*$/:e +\2 \1/'
    fi
  fi
  # Find references.  Use gl command on each line.
  if test "$1" = "f"; then
    gopls references $2:$3:$4 >$OUT/.out.ls
    echo ":e +1 $OUT/.out.ls | :e"
  fi

More Repositories

1

fbpdf

A small framebuffer pdf, djvu, epub, xps, and cbz viewer
C
192
star
2

neatcc

A small arm/x86(-64) C compiler
C
160
star
3

neatroff

Neatroff troff clone
C
137
star
4

fbpad

A small Linux framebuffer virtual terminal
C
113
star
5

neatlibc

A small arm/x86(-64) libc
C
77
star
6

fbff

A small ffmpeg-based framebuffer media player
C
68
star
7

neatroff_make

Neatroff top-level makefile
M
53
star
8

neatld

A simple ARM/x86(_64) static linker
C
38
star
9

neatmail

A text-mode mail client
C
34
star
10

fbvnc

A small Linux framebuffer VNC viewer
C
25
star
11

minmad

A small libmad/oss mp3 player
C
15
star
12

cell

A small Linux sandbox
C
14
star
13

tsvm

TSLANG Intermediate Code Virtual Machine
C
14
star
14

neatrefer

A refer preprocessor for neatroff
C
13
star
15

neatpost

Neatroff's postscript postprocessor
C
12
star
16

troffp9

A Linux port of Plan 9 Troff
C
12
star
17

neatcc_make

Neatcc top-level makefile
C
12
star
18

neateqn

An eqn preprocessor for Neatroff
C
11
star
19

neatmkfn

Generate font descriptions for Neatroff
C
10
star
20

fbpad_mkfn

Generate Fbpad fonts from TrueType fonts
C
10
star
21

neatsmtp

A small SMTP client
C
9
star
22

neatpop3

A small POP3 client
C
9
star
23

sysneat

A small Linux init program
C
8
star
24

json

A small program to work with JSON-encoded data
C
7
star
25

neatroff_ths

Neatroff macro package for writing a Farsi thesis
Roff
7
star
26

dnsred

Redirect DNS queries
C
6
star
27

dblp

Convert DBLP search results to refer records
C
5
star
28

chth

Challenging Thursdays Contest Judge
C
4
star
29

minmix

A Minimal OSS Mixer
C
4
star
30

nvmc

Neat VM Cluster
Shell
4
star
31

aligrudi.github.io

HTML
2
star
32

gpss

General Position Subset Selection Algorithms
C
2
star