Text editor

A text editor is Article description::a program to create and edit text files. Although it is not impossible to edit files without using one, text editors make it easy, and are handy for editing configuration files.

The Gentoo @system set contains the package to make sure at least one editor is installed.

Default, fallback, and virtual packages
As with most things Gentoo, text editor choice is up to the user. As a text editor will be necessary during and just after installation, the virtual package, (part of the system set), will pull in  (as the first "any of many" dependency of the ebuild) as a fallback - until another "virtual/editor" package is emerged.

Thus, after a stage 3 installation, the command will be available once chrooted to a newly installed Gentoo. As the stage 3 tarballs only contain packages that are strictly necessary for every system, Nano will be the only text editor available in the stage 3 chroot. A replacement editor may be emerged on the new system, as soon as the Gentoo ebuild repository is installed and optionally updated.

The default editors for the CLI will be used by many programs to determine which text editor to start up, when needed. Programs such as CLI file managers will use this default, or when invoking an editor from bash using + +. The default editors are set using the VISUAL and EDITOR environment variables. Generally, VISUAL will take precedence over EDITOR, which is used for less capable terminals.

See the setting system default section.

Available software
Text editor options can be found online in the app-editors category or by running:

CLI editors
See the vi article for more vi(like) editors.

Visudo editor
Due to the sensitive nature of it may only edited via the  command which in turn is limited to a predefined selection of editors. Type for more information.

Setting system default
A system wide default text editor is defined in the file, for example:

The system default editor can be set with the utility, which modifies this file automatically. To list available editors (install editor of choice for it to become available with ):

If using Vim or Neovim, select vi, then see the this article.

To set a new editor, replace  in the following command with a number corresponding to the text editor of choice:

Next, the environment must be updated by running the following command:

User's EDITOR environment variable will now have the default value selected. Users may change this value however, in a running shell, or automatically on login shell startup.

The old method of setting the EDITOR variable in is no longer supported. See this article for details.

Binary files
Many text editors won't be able to handle binary files. Use a hex editor for such files.

If binary data gets improperly output to the terminal, it can sometimes "garble" the display, see this section of the terminal emulator article for help.