Wednesday, February 15, 2006

Effective Text Editing

I ran across this article I thought I'd share:  Seven habits of effective text editing.  It's written by the author of VIM (Vi Improved) but the techniques apply to all good text editors.  The techiques are:

Move Around Quickly - Use the editor to jump quickly to your destination.  This involves not only search but also backet matching, jumping to symbols, etc.

Don't Type It Twice - Search and Replace, Completion, Macros, etc.

Fix It When It's Wrong - Syntax highlighting

A File Seldom Comes Alone - An editor should support quickly moving between files and viewing more than one file at a time.

Let's Work Together - Can you integrate your editor with other programs? 

Text Is Structured - Can your editor integrate with your build system?  Does it recognize errors? 

Make It A Habit - Spend some time learning your editor.  If you never read the docs, you'll never find where the editor can help you save time.

If you are using an editor which doesn't allow for these techniques, you might consider switching.  A friend turned me onto VIM some time back and I've started to become proficient with it.  The learning curve is a little steep but the payoff is big.  It's also really lightweight which is nice in today's era of heavy-footprint editors.  Right now I have VIM (well, GVIM), MS Word, and Visual Studio.Net 2003 running.  Their memory usage in megs is 5, 23, and 18.  By comparison, Notepad appears to take about 3 megs.


  1. The built-in editor in VS2005 for C# is really good.  There is NO WAY any external editor can beat it for productivity because of its dynamic knowledge of your source code.  The completion, navigation, and code refactoring tools make code editing really fast.

    Armed with these tools, I just have to laugh at those that claim they can edit in <some other editor> faster.  There is no comparison.  Notepad?  Yeah right.

    VS2005's editor also meets all the habits you listed, also.

  2. Re: tzagotta

    The problem with VS is that it takes a long time, compared to some other editors, to load. Once you're there, it's not bad, but if I'm browinsg around a source tree and want to look at some specific file it's overkill.  It's like cutting down a tree with a B2 bomber or something.

    I also find myself really really missing the hjkl movement in VS. :)

  3. For C# code, the newest iteration of Visual Studio is very slick.  It is tightly bound to the compiler and, as such, is able to do a lot that can't be done in a standalone editor.  If you are editing other languages or working in an environment that doesn't VS2005 doesn't support, look around and find a good one.  The important takeaway shouldn't be which particular editor to use, but rather that you should be using one with power and you should practice enough to use that power.  

    If you think notepad is a powerful enough editor for you, you aren't using your editor correctly.

  4. Per Bill's comment above, I did a little timing.  From a cold start, VIM takes 1 second to launch.  VS 2003 takes about 30 seconds and VS 2005 takes 15 seconds.