Tip: vi Configuration
Published on May 25, 2008 (updated Aug 17, 2024), filed under development (feed). (Share this on Mastodon or Bluesky?)
This and many other posts are also available as a pretty, 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 small and large enterprises, 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 other areas like philosophy. Here on meiert.com I share some of my experiences and views. (I value you being critical, interpreting charitably, and giving feedback.)