Jens Meiert

Tip: vi Config Modification

Jens Meiert, May 25, 2008.

This entry is filed under Web Development.

Long story short and assuming this is not too well-known: You can easily modify vi editor’s apparent standard configuration, and the most useful changes probably affect UTF-8 encoding and display of line numbers. In order to do that, simply go to your home directory (enter cd), create a file called .exrc (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 might at least make it worthwhile to have a look at some vi Cheatsheet (PDF); it already includes additional :set parameters (that you can enter while in command mode, too). Or you consider to buy a book about this editor that is unofficially pronounced ‘six’ because of the feeling one gets when using vi that it may be the text editor of the antichrist.

Read More

Enjoy the most popular posts, probably including:

Comments

  1. On May 25, 2008, 20:36 CEST, Jens Nedal said:

    So there we have another vi user 8)
    In our current work configuration which involves a team of 4 in the programming department, mostly PHP but also some Java and ofcourse the usual standards and accessbility compliant frontend output in HTML, CSS and Javascript/AJAX, 3 of us use vim as our chosen editor in a Windows environment and ofcourse also when working form the console.

    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.

  2. On May 27, 2008, 9:42 CEST, Jens Meiert said:

    Jens, yah, vi is a usability nightmare but still awesome :) Love to see your vim settings though!

  3. On June 8, 2008, 18:58 CEST, Martin said:

    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.

  4. On June 9, 2008, 19:39 CEST, Jens Meiert said:

    Martin, although this might not hold true anymore (so please correct me), vi is available on more systems than vim. I like the idea of focusing on a tool that I can use everywhere (except on Windows).

    By the way, to use n spaces for indentation (instead of Tab), add the following lines as well (using 2 spaces for indentation):

    :set expandtab
    :set tabstop=2

Leave a Comment

Leave a Comment

Respect the comment guidelines. XHTML allowed: <a href=""> <abbr title=""> <blockquote> <code> <em> <strong>

Found a mistake? Reward! Email me, jens@meiert.com.

You are here: meiert.com – Archive for 2008 – Tip: vi Config Modification

Last update: May 25, 2008. Copyright 2000-2008 Jens Meiert. Legal notice.