From NetHackWiki
Jump to navigation Jump to search

Vi (pronounced "vee-eye") is short for VIsual editor, and is a popular text editor for Unix. Vi works with any ordinary terminal: the editor doesn't require a desktop environment, and can be used via telnet or ssh much like NetHack. and Hardfought offer vi as an option for editing nethackrc files, along with other Unix text editors and Web-based editors.

In a 2023 Stack Overflow survey of 90,000 developers, 22% reported using vim and 11% reported using neovim.[1]


Bill Joy developed vi under the auspices of the Computer Systems Research Group (CSRG) at the University of California, Berkeley, starting in 1976. vi was one of the first full-screen editors; the choice of hjkl navigation keys was based on the keyboard of the ADM-3A, a popular terminal at UC Berkeley at that time.

Ken Arnold, another member of the CSRG, abstracted the cursor movement and optimization code from vi into the curses programming library, so that a full-screen program could operate on any full-screen terminal. Later on, Ken Arnold collaborated with Michael Toy and Glenn Wichman to write a novel full-screen computer game called Rogue. Along with adopting the screen display code from vi, Rogue also adopted the hjkl navigation convention.

In 1986, Arnold wrote about curses: This package would not exist without the work of Bill Joy, who, in writing his editor, created the capability to generally describe terminals, wrote the routines which read this database, and, most importantly, those which implement optimal cursor movement, which routines I have simply lifted nearly intact.[2]


Vi has two different modes: one for giving commands to the editor, and one for editing the text. The editor starts out in the command-mode.

Keys Command
i Enter editing mode. (Insert)
a Enter editing mode. (Append)
Esc Return from editing mode back to command-mode.
h, j, k and l Move cursor left, down, up and right
$ Move cursor to the end of line.
^ Move cursor to the beginning of line.
G Move cursor to the end of the file.
:wEnter Save changes to file.
:q!Enter Quit without saving changes.
x Delete the character under the cursor.
dd Delete the line under the cursor.
p Paste deleted text.