Tip: vi Configuration
Post from May 25, 2008 (↻ December 12, 2016), filed under Web Development.
This and many other posts are also available as a pretty, well-behaved e-book: On Web Development.
Long story short: It’s easy to modify vi editor’s standard configuration. The most useful changes probably relate to encoding (UTF-8 preferred) and display of line numbers. In order to do that, simply go to your home directory (enter cd), create a file called .exrc 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. General interest in vi suggests to have a look at some vi Cheatsheet (PDF). It includes additional
:set parameters (you can enter these in command mode, too). Or you get a book about vi—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
The only change was to enable syntax highlighting.
About the Author
Jens Oliver Meiert is a technical lead and author (sum.cumo, W3C, O’Reilly). He loves trying things, including in the realms of philosophy, art, and adventure. Here on meiert.com he shares and generalizes and exaggerates some of his thoughts and experiences.
If you have any thoughts or questions (or recommendations) about what he writes, leave a comment or a message.
On May 25, 2008, 20:36 CEST, Jens Nedal said:
So there we have another vi user 😎
We do have a heavily configured .vimrc with various settings, like some autocompletion for function commentaries, which help keeping the phpdoc tree nice and clean and some other nifty stuff.
Before i ever used vi i usually tagged along with some editors that had decent highlighting.
vi is just very powerful and once you get around the “quirk” of only using keyboard commands for everything but marking text with your mouse, it is absolutly worthwhile and i would never move away from it again ever.
Why not use vim, that’s basically the same, just with more features, such as tabbed editing, etc.
In that case, the configuration file’s called .vimrc.