Advanced Text-Fu · Lesson 3 of 13
Vim (Vi Improved)
0 / 5 checkpoints answered
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.
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.
CheckWhat does the name Vim mean?
press 1/2/3 to answer · → next lesson
CheckWhich command checks whether Bash can currently resolve the name vim?
press 1/2/3 to answer · → next lesson
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.
CheckWhat normally happens when vim draft.txt names a path that does not yet exist?
press 1/2/3 to answer · → next lesson
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.
CheckWhich shell command starts Vim's guided tutorial when it is installed?
press 1/2/3 to answer · → next lesson
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.
CheckIn a disposable practice file, which Vim command quits the current window and discards its unsaved changes?
press 1/2/3 to answer · → next lesson
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.
Summary
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.
Lesson complete
You finished Vim (Vi Improved). Nice work — keep the momentum going.