vim - Linux Command - Unix Command

The Vim editor is a venerable workhorse for Linux programmers

The Vim text editor is one of the venerable applications of the Linux and Unix world. Seasoned programmers with a deep Linux history usually pick from one of two common editors—Emacs and Vim.

About Vim

Vim editor

Vim is an improved version of Vi, one of the original text editors from the early days of Linux. Like Emacs, Vim (and Vi) operate solely from a shell session, and only with the keyboard. In fact, Vim supports literally hundreds of different keybindings.

Although Vim runs in a shell session, the Gvim application "wraps" a shell session dedicated to Vim inside of a graphical program you can call from within your window manager or desktop environment.

It's a multimodal text editor, which means that one Vim session supports different modes (interaction frameworks, like insert mode and command mode). It's also a multi-buffer text editor, so you're free to work on several different documents simultaneously.

Vim supports a significant ecosystem of additional tools and an active user community through the program's website.

Major Modes

The two most common modes for Vim are command mode, in which you apply keystrokes that affect the operation of the program and insert mode, in which you apply keystrokes that affect the document in the current buffer.

To activate the insert mode, press I. To activate the command mode, press Esc. Regardless of the active mode, Vim works through multi-key commands. For example, to save the active file without prompting to confirm the overwrite, and then to exit Vim, access command mode then type :wq!.

Text Editors for Beginners

Vim (and Vi, and Emacs) both offer steep learning curves. Their logic model was set in the late 1970s and early 1980s; although these editors are among the most powerful you can use, learning them thoroughly takes a lot of time and muscle memory.

nano in the terminal

If you require only occasional use of a text editor from within a shell session, you're better served by GNU nano, which offers shortcut syntax prompts at the bottom of the screen.