Forrest logo
back to the set tool

set:tldr:bb7a3

set: Set various options, e.g. enable `vi` style line editing.
$ set -o ${vi}
try on your machine

The command "set -o ${vi}" is used to enable the vi editing mode in the command-line interface (CLI) shell.

In Unix-like systems, the CLI shell has two main editing modes: emacs and vi. The emacs mode provides editing features similar to the emacs text editor, while the vi mode emulates the functionality of the vi text editor.

When this command is executed, the "set" command is used to modify the shell options. In this case, the "-o" option is used to enable or disable specific options. The "${vi}" is a parameter expansion that dynamically sets the value of the option based on the value stored in the "vi" variable.

If the value of the "vi" variable is set to "vi", then the command will enable the vi editing mode. If the value is set to something else or empty, the command will disable vi mode.

By enabling the vi editing mode, you can use vi-like commands and key bindings to edit commands and navigate through the command-line history. This can be useful for users who are already familiar with vi or prefer its editing capabilities over emacs.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the set tool