Tip: vi Configuration
Published on May 25, 2008 (updated Aug 17, 2024), filed under development. (Share this post, e.g. on Mastodon or on Bluesky.)
This and 133 other posts are also available as a well-behaved ebook: On Web Development.
Long story short: Itâs easy to modify the vi editorâs standard configuration. The most useful changes probably relate to encoding (UTF-8) and display of line numbers. In order to do that, go to your home directory (enter cd), create a file called .exrc (or, for Vim, .vimrc) unless it already exists (enter vi .exrc, press i or a, paste the following, and save by pressing esc and entering :wq):
:set encoding=utf-8
:set number
Thatâs it. If youâre interested in additional options, perhaps have a look at a vi cheatsheet (PDF). It includes additional :set parameters (you can enter these in command mode, too). Or check out a book about viâyes, the editor infamously, âunofficially pronounced âsixâ because of the feeling one gets when using vi that it may be the text editor of the antichrist.â
Update (February 17, 2013)
Hereâs my vi configuration, a few years later:
:set encoding=utf-8
:set number
:syntax on
This also enables syntax highlighting.
About Me
Iâm Jens (long: Jens Oliver Meiert), and Iâm a web developer, manager, and author. Iâve worked as a technical lead and engineering manager for companies you use every day and companies youâve never heard of, Iâm an occasional contributor to web standards (like HTML, CSS, WCAG), and I write and review books for OâReilly and Frontend Dogma.
I love trying things, not only in web development and engineering management, but also in philosophy. Here on meiert.com I share some of my experiences and perspectives. (I value you being critical, interpreting charitably, and giving feedback.)
