LinuxCommandLibrary

select-editor

Choose a default text editor

SYNOPSIS

select-editor

DESCRIPTION

select-editor is a user-friendly utility designed for Debian-based systems to simplify the process of choosing the default command-line text editor. It interacts with the update-alternatives system, specifically managing the 'editor' alternative group. When executed, it presents an interactive, numbered list of all available and registered text editors (e.g., nano, vim, emacs). The user simply selects their preferred editor by entering its corresponding number. This action updates the system's /usr/bin/editor symbolic link to point to the chosen application, making it the default for programs that invoke 'editor' or fall back to it when environment variables like EDITOR or VISUAL are not explicitly set.

CAVEATS

This utility is primarily found on Debian and Ubuntu distributions and their derivatives; it is not standard on all Linux distributions. It relies on text editors being properly registered as 'editor' alternatives within the update-alternatives system. User choices made through select-editor can be overridden by explicitly setting the EDITOR or VISUAL environment variables in the shell's configuration files (e.g., ~/.bashrc, ~/.zshrc).

INTERACTIVE USAGE

When you run select-editor, it operates interactively. It displays a list of numbered options, each representing an available text editor on your system. You are prompted to enter the number corresponding to your desired editor, and upon confirmation, this selection is applied immediately.

CONFIGURATION AND ENVIRONMENT VARIABLES

The selection made by select-editor is typically stored on a per-user basis, often in the ~/.selected_editor file. This file then guides the update-alternatives system for that user. While select-editor manages the /usr/bin/editor symlink, it does not directly modify the EDITOR or VISUAL environment variables. Many applications prioritize these environment variables, so for consistent behavior, users may still wish to explicitly set them in their shell's startup scripts (e.g., export EDITOR=vim).

HISTORY

select-editor emerged as a user-friendly frontend to the more complex update-alternatives command, specifically for managing the default text editor. Its development is rooted in the Debian project's philosophy of providing intuitive configuration tools. It simplifies what would otherwise require direct interaction with the update-alternatives command's --config option for the 'editor' group, making the process accessible to a wider range of users.

SEE ALSO

update-alternatives(8), editor(1), sensible-editor(1), nano(1), vim(1), emacs(1)

Copied to clipboard