Difference between revisions of "Vi"

From NetHackWiki
Jump to navigation Jump to search
(copyedit + update pass)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Around here, '''Vi''' (being vee eye, not [[6|six]]) is most notorious as the origin of the use of [hjkl] for movement. '''Vi''', short for ''VIsual editor'', is a classic but controversial [[text editor]] for [[Unix]]. Vi's main benefit is that it works with any ordinary terminal. The editor doesn't require a desktop environment, thus it can be used via telnet or ssh - much like nethack.
+
{{man|vi}}
 +
'''Vi''' (pronounced "vee-eye") is short for ''VIsual editor'', and is a classic but controversial text editor for [[Unix]]. Vi's main benefit is that it works with any ordinary terminal: the editor doesn't require a desktop environment, and can be used via telnet or ssh much like ''[[NetHack]]''. Beyond this comparison, vi's primary source of relevance to the game is as the origin of the use of [hjkl] for movement (the programmers of vi did not care much about moving the cursor diagonally).
  
 +
The programmers of [[Rogue (game)|Rogue]] likely adopted the [hjkl] movement system because their keyboards lacked both numeric keypads and separate arrow keys, and added [yubn] for diagonal movement; this [[yuhjklbn]] system was in turn adopted for ''NetHack''.
  
The programmers of vi did not care much about moving the cursor diagonally. The programmers of [[Rogue (game)]] adopted the [hjkl] movement system (likely because their keyboards lacked both numeric keypads and separate arrow keys) and added [yubn] for diagonal movement. NetHack adopts this [[yuhjklbn]] system.
+
vi is primarily used for editing [[nethackrc]] files via the vi-like editor called '''virus''' when playing on [[nethack.alt.org]] or [[Hardfought]]. If you aren't comfortable using a vi-like program to edit text, NAO and Hardfought also offer web-based configuration editors.
 
 
These days, the one reason that you might need to know "vi" is if you play on [[nethack.alt.org]] or [[slashem.crash-override.net]]. If you [[telnet]] in and try to edit your [[nethackrc]], you will find yourself in a vi-like editor called '''virus'''. If you aren't comfortable using a vi-like program to edit text, NAO also offers a web-based configuration editor.  
 
== Usage ==
 
  
 +
==Usage==
 
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.
 
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.
  
Line 37: Line 37:
 
|}
 
|}
  
 
+
You will find vi in many [[Unix]] systems, though some [[GNU/Linux]] distros (notably [[Debian]] and [[Gentoo]]) leave it away from of the core system. To learn about vi in general, you could try to start with [http://www.bbc.co.uk/dna/h2g2/A306857 H2G2's brief description vi], then move to [http://everything2.com/index.pl?node_id=13588 vi@Everything2.com] for commands and tutorials. [[Wikipedia:Vi]] reveals the history of Vi, while [[Wiki:ViEditor]] explains how to pronounce "vi" and links to comparisons with [[Emacs]]. There is also an improved version of Vi called [[w:c:vim|Vim]].
You will find vi upon many [[Unix]] systems, though some [[GNU/Linux]] distros (notably [[Debian]] and [[Gentoo]]) leave it away from of the core system. To learn about vi in general, you could try to start with [http://www.bbc.co.uk/dna/h2g2/A306857 H2G2's brief description vi], then move to [http://everything2.com/index.pl?node_id=13588 vi@Everything2.com] for commands and tutorials. [[Wikipedia:Vi]] reveals the history of Vi, while [[Wiki:ViEditor]] explains how to pronounce "vi" and links to comparisons with [[Emacs]]. There is also improved version of Vi called [[w:c:vim|Vim]].
+
{{noversion}}
 
[[Category:Development]]
 
[[Category:Development]]

Latest revision as of 22:18, 29 October 2023

Vi (pronounced "vee-eye") is short for VIsual editor, and is a classic but controversial text editor for Unix. Vi's main benefit is that it works with any ordinary terminal: the editor doesn't require a desktop environment, and can be used via telnet or ssh much like NetHack. Beyond this comparison, vi's primary source of relevance to the game is as the origin of the use of [hjkl] for movement (the programmers of vi did not care much about moving the cursor diagonally).

The programmers of Rogue likely adopted the [hjkl] movement system because their keyboards lacked both numeric keypads and separate arrow keys, and added [yubn] for diagonal movement; this yuhjklbn system was in turn adopted for NetHack.

vi is primarily used for editing nethackrc files via the vi-like editor called virus when playing on nethack.alt.org or Hardfought. If you aren't comfortable using a vi-like program to edit text, NAO and Hardfought also offer web-based configuration editors.

Usage

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.

You will find vi in many Unix systems, though some GNU/Linux distros (notably Debian and Gentoo) leave it away from of the core system. To learn about vi in general, you could try to start with H2G2's brief description vi, then move to vi@Everything2.com for commands and tutorials. Wikipedia:Vi reveals the history of Vi, while Wiki:ViEditor explains how to pronounce "vi" and links to comparisons with Emacs. There is also an improved version of Vi called Vim.