Startup and Initialization Options

Vim uses different mechanisms to set up its environment at startup. It inspects command-line options. It self-inspects (how was it invoked, and by what name?). There are different compiled binaries to serve different needs (GUI versus text window). Vim also uses a sequence of initialization files in which uncountable combinations of behaviors can be defined and modified. There are too many options to cover completely; we will touch on some of the interesting ones. In the next sections, we discuss Vim’s starting sequence along the following lines:

  • Command-line options

  • Behaviors associated to command name

  • Configuration files (system-wide and per-user)

  • Environment variables

This section introduces you to some of the ways to start Vim. For a more detailed discussion of many more options, use the help command:

:help startup

Command-Line Options

Vim’s command-line options provide flexibility and power. Some options invoke extra features, whereas others override and suppress default behavior. We will discuss the command-line syntax as it would be used in a typical Unix environment. Single-letter options begin with - (one hyphen), as in -b, which allows editing of binary files. Word-length options begin with -- (two hyphens), as in --noplugin, which overrides the default behavior of loading plugins. A command-line argument of two hyphens by themselves tells Vim that the rest of the command line contains no options (this is a standard Unix behavior).

Following the ...

Get Learning the vi and Vim Editors, 7th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.