Vim is a configurable text editor whose name means Vi Improved. It preserves the modal editing model associated with the original vi editor and adds features such as multilevel undo, syntax support, scripting, and an extensive help system.
Advanced Text-Fu · Lesson 3
Vim (Vi Improved)
Learn what Vim is, how it relates to vi, and how to open files, help, and guided practice.
Relating Vim and vi
vi describes both a historical editor and a common command interface. On one Linux system, vi may start Vim in a compatibility-oriented mode; on another, it may start a different vi implementation. Do not assume that every vi command provides every Vim feature.
Check what the current shell resolves:
$ command -v vim
/usr/bin/vim
$ command -v vi
/usr/bin/vi
The resolved path does not by itself identify whether vi and vim are the same implementation. type -a vi vim and the editor's version output can provide more detail.
What does the name Vim mean?
Which command checks whether Bash can currently resolve the name vim?
Opening Vim and Files
Start Vim with an unnamed buffer:
$ vim
Pass a pathname to edit that file:
$ vim filename.txt
If filename.txt exists and is readable, Vim loads its content into a buffer. If the path does not exist, Vim opens a new buffer associated with that name; no file is created until you successfully write the buffer.
Vim does not bypass filesystem permissions. Opening a file does not guarantee that your account can save changes to its pathname.
What normally happens when vim draft.txt names a path that does not yet exist?
Using Built-In Learning Resources
If the Vim installation includes vimtutor, run it from the shell for an interactive practice lesson:
$ vimtutor
Inside Vim, enter Normal mode with Esc, type :help, and press Enter to open the help system. A specific topic can follow the command:
:help user-manual
:help :write
Help tags are precise, so punctuation can matter. Use Ctrl+] on a help link to follow it and Ctrl+T to return.
Which shell command starts Vim's guided tutorial when it is installed?
Practicing with a Disposable File
Begin with a file in a directory you own:
$ printf 'alpha\nbeta\n' > vim-practice.txt
$ vim vim-practice.txt
The following lessons introduce searching, navigation, insertion, editing, and saving. Until you know how to leave safely, remember that Esc returns to Normal mode and :q! followed by Enter abandons unsaved changes in the current window. Use that command only when discarding those changes is intentional.
In a disposable practice file, which Vim command quits the current window and discards its unsaved changes?
To practice opening, editing, and saving with Vim, try this hands-on lab:
- Edit Text Files in Linux with Vim and Nano - Practice creating files, editing text, saving files, and navigating with both Vim and Nano in a real Linux environment.
Lesson complete
You finished Vim (Vi Improved)
You can now identify Vim, open a buffer, and find safe learning resources.
Explain how Vim relates to vi without assuming one implementation.
Check whether the
vimcommand is available.Open an existing file or a new named buffer.
Start
vimtutoror open Vim's built-in help.Abandon unsaved practice changes only when intended.
Keep your learning progress
Create a free account to save this lesson and continue learning on any device.
Create a free account