top | item 1376299

Ask HN: What code editor do you use?

43 points| eob | 16 years ago | reply

I've been using TextMate for a few years now, but recently have been doing a lot of work in projects that have either 1) a lot of files or 2) really big files. Both of these situations cause TextMate to crawl to a halt.

I've used Emacs in the past, but something about the way in which you can navigate code just makes me feel less than efficient in it. Maybe I didn't take enough time to memorize all the required shortcuts. Mastering an editor that can be used over an ssh session certainly seems a plus.

So a question to all the coders out there: what editor do you use? Why did you choose it? What are the downsides?

138 comments

order
[+] andrewl|16 years ago|reply
I used to use jEdit, which is still a very nice editor. And it ran on Mac/Unix/Windows, which was good because I moved among all three systems. But the last I looked (three or four years ago) development had stalled. And I got into a job where I periodically had to SSH to various Solaris boxes and edit on the console, in Vim. I knew just enough Vim to edit config files and simple shell scripts without too much pain. Then I'd come back out to jEdit and start putting :s and other Vim commands in my files. It was hard to shift gears.

So I decided to pick an editor that I could stay with for a long time, maybe forever, because it did so many things and was so configurable. It had to run on my Mac at home, the Windows nd Unix machines at work, and also on the console. It came down to Emacs or Vim. My boss was an Emacs guy, and could do wonderful things with it. But I'd had a few RSS problems, and I'd read about what Emacs did to some users' hands. So I went with Vim, and I'm very happy with it.

Really, the only downside is that I don't have Vim everywhere, so when I'm stuck somewhere that doesn't have it my hands do the wrong thing. (Like in our crappy email system. I write long messages in Vim and paste them in, but I do short ones in the mail client. And hit escape when I'm done. And then hit cancel to say that I'm not abandoning the message.)

As far as I know, the only editor more configurable than Vim is Emacs. But Vim does do a lot. I use it for Ruby, shell scripts, HTML, CSS, XML, Perl, prose, looking around in log files, and more. It handles long files easily. You can script it with its built-in language (not as powerful as ELisp, of course) or other scripting languages.

I sometimes meet people who don't know the difference between Vi and Vim. When I say I use Vim they ask how I can get by with such a limited editor that won't split windows and doesn't have tabs and so on. So when I say Vim, I mean Vim 7.2, available at vim.org.

But Emacs and other tools are worth getting familiar with as well. It's good to not be too provincial.

[+] johnswamps|16 years ago|reply
I couldn't ever give up vi key-bindings but I liked the rest of emacs more, so I use emacs in viper-mode (comes built-in), which emulates vi. You can use emacs as a modal editor but still fall back on all the emacs functionality.

For most of the time it works like the best of both worlds, but it's not perfect . You can't use viper-mode in every mode and it's obviously not full vi(m) emulation. Installing the vimpulse.el script (google it) adds a lot of missing vim functionality though.

[+] kashif|16 years ago|reply
I have used both Emacs and Vim extensively. Personally, I find Vim groks the idea of text manipulation much better. The key binding scheme/system actually feels like something that you can build upon, bindings string together nicely.

It's also just much lighter and goes with my preference of using the simplest tool that does the job.

[+] jrockway|16 years ago|reply
I accidentally used Vim the other day. I noticed Vim now has Emacs keybindings -- C-n goes to the next line, C-p goes to the previous line, etc. For a second, I thought that C-x C-s was going to save my file and I was going to be able to exit with C-x C-c. Nope. I had to make the journey over to the ESC key. So close...
[+] MattJ100|16 years ago|reply
I somewhat suspect I'll be unique on this one here. I use nano full-time.

I use it because it is simple, it gets the job done, and I don't find that I need anything more.

It's true it's missing a couple of features commonly found in code editors. But when I start thinking code folding would be useful, I take it as a sign that this file is getting too large and would be better split. Nano also obeys the simple UI principle of having a non-modal interface. I haven't used an editor with bells and whistles for some years, and I'm liking it.

Also contrary to popular belief, nano does support syntax highlighting - this just isn't enabled by default in most distros.

Now, laugh.

[+] frossie|16 years ago|reply
Now, laugh

Well, I'll admit that was... unexpected, but I am certainly not going to laugh. After all, the best code editor is the one you feel most productive in, and you seem to have a rational explanation for it so sure, knock yourself out :-)

[+] TrevorBramble|16 years ago|reply
I actually used Nano for a long time as well! I'd been using Pine since 1994 so it always felt quite natural.

If Vim wasn't always available when Nano was, I'd still use it. ;^)

[+] pook|16 years ago|reply
Oy, a holy war is about to happen.

I'll open the Emacs lobby with http://sites.google.com/site/steveyegge2/effective-emacs and http://sites.google.com/site/steveyegge2/the-emacs-problem

To give the illusion of fairness, here is a blogpost in which I praise Vim: http://zipwith.blogspot.com/2010/05/power-of-vim.html

[+] eob|16 years ago|reply
Thanks for the links. I don't mean to start a holy war, though they are fun :) I'm looking more for a reasoned discussion of the pros and cons of different editing environments.
[+] jb55|16 years ago|reply
Vim is like a virus that plants itself directly into your brain. Using it has crippled my ability to use "normal" text editors. No longer am I satisfied with default application navigation controls. I can't use a browser without Vimperator installed. How can this madness be stopped!?
[+] mapleoin|16 years ago|reply
learn emacs. Yeah, I know what that sounds like. You don't have to also use it forever, just for, say, 6 months. Then you use both at the same time. You're brain will have rewired a pretty sturdy understanding of different ways to edit and you'll be able to switch painlessly between emacs, vim and non-editors (like the HN textbox).

Well anyway, it worked for me. I have no trouble switching between the 3 editing modes while I program, edit configs and write email (thunderbird for now).

[+] Schmidt|16 years ago|reply
There is no way, just give in! Soon you will be sitting in Awesome or xmonad or wmii, using vimperator for browsing and vim for everything else ;)
[+] ivanzhao|16 years ago|reply
it's not madness. humans are capable of so much if we put a bit devotion into it (e.g. hard-waring finger movement X with vim procedure Y, or even touch typing)

this makes me wondering the limit of human interfaces. how far can we transform into cyborgs through just "practicing"?

[+] madrik|16 years ago|reply
Madness? This is VIM!
[+] WesleyJohnson|16 years ago|reply
I always hesitate to post on these types of questions: everyone seems to be Java, Ruby, Python, etc and I feel like the Microsoft stack outcast!

Visual Studio 2010 at home and 2008 at work. We're primarily .NET so the two just kind of go hand in hand. I'm also spoiled by intellisense.

I also use Eclipse at work since we've been doing a lot with GWT on the client side (thought still using .NET on the backend).

Finally, I'll often use notepad++ for anything JavaScript simply because it takes far too long to load up VS when I want to do something small/edit a file/etc.

[+] Vitaly|16 years ago|reply
I used TextMate for a couple of years but lately switched back to vim. This time I invested in a good vim setup with plugins to fill in places where it wasl lacking compared to TextMate. the config can be found at http://github.com/astrails/dotvim There is a (rather long) README with explanations of what is there and short instructions of basic use.
[+] eob|16 years ago|reply
Thanks a lot for sharing Vitaly. I think one of the hardest things about moving to the emacs/vim world is the fact that, in addition to learning the editor, you also have to find a good .emacs/.vim file to start yourself out with.
[+] weaksauce|16 years ago|reply
That is a great vim setup you have there. Thanks for sharing that!
[+] gurraman|16 years ago|reply
I've been using vim for about ten years now. A few of my favorite things about the editor: it features the best application navigation that I've ever been exposed to (I also use vi-like navigation in readline, Firefox and mutt); it can open large files without breaking a sweat; it has a great many useful features for quickly modifying text (q, =, gq, cit, ci(, ci' etc) -- something I spend about 50 % of my time at work doing; it's almost always available, I merely download my settings and it feels like home; it features a great ui and I love how close the editor lives to the shell.

The only thing I do not like about vim is that auto-indentation and syntax highlighting feel a bit "shaky". I find many of the editors mentioned here more consistent in that regard.

[+] btilly|16 years ago|reply
On a work email list I wound up writing something that answers the question fairly clearly:

  vi I use to write my code for work,
  It's modal and quite light, so quick to type
  I'm glad to use it for the great big perk
  That it lives up quite nicely to its hype

  But emacs I do not so choose for me,
  I fear the chords would sorely hurt my hands
  And carpal tunnel is so bad you see
  That misery makes it for me be banned.

  I know this is not good according to
  The cult of emacs users that I find
  Would tell me to not speak until I knew
  Why theirs was the best editor for mind

  But I cannot agree with them and so
  vi I use and now will say no mo!
[+] mceachen|16 years ago|reply
I'm finding RubyMine to be great for rails webapp development. Hopping through a project to method or class or migration definitions, the "view model dependency diagram", and good git integration make for a pretty nice IDE.

The main good thing about vi is that it's ubiquitous. You really should know how to use it, at least cursorily.

You can certainly use emacs over ssh (and you know about ssh's X11 forwarding, which let's you run a remote pointy-clicky editor rendered locally?).

Depending on your network and the files you're playing with, sshfs might be a relevant tool to view the files "locally".

If the files are really big, man the "split" command.

[+] jarin|16 years ago|reply
I use TextMate for most things, Espresso for working on HTML mailers and (some) static sites, XCode for iPhone/iPad, and Eclipse for my most hated projects (Adobe Flex/AIR mostly. I don't hate Flex, I just hate Eclipse).

I use Inconsolata font at 14pt and a modified Monokai theme (with darker background) whenever possible.

About once a year or so I decide I'm going to switch to vim. I spend about a week getting my vimrc and plugins set up and use it for a couple more weeks, before I eventually get sick of keyboard navigation and NERDTree and go back to TextMate. I know that with MacVim I get things like scrollwheel support and mouse navigation, but if I'm using those anyway I might as well use them in TextMate and get back my tab triggers and other shortcuts.

It's always good to brush up on vim once in a while though, since it often comes in handy when you need to edit config files on a server or when you are collaborating with a developer who uses vim exclusively. I also wish TextMate had split panes and some of the keyboard shortcuts (o, O, I, and A come to mind), but overall my productivity is better with TextMate.

[+] bilban|16 years ago|reply
Maybe you just need to bin the mouse for a week. That is the thing that gets in the way for me, and when it's present, I start using the damn thing. The one thing it feels good for is copy and paste, a necessity when copying outside vim.
[+] vtail|16 years ago|reply
> I've used Emacs in the past, but something about the way in which you can navigate code just makes me feel less than efficient in it.

Have you ever tried IDO, http://www.emacswiki.org/emacs/InteractivelyDoThings?

[+] jrockway|16 years ago|reply
Indeed. I don't even have to think about files anymore, thanks to eproject. If I want to edit my module Foo::Bar, I just say visit-project-file (C-c C-f), type in ::Ba or some other convenient substring, and hit enter. Now I'm there.

And that's the worst case. If I want to see the definition of some function that the point is currently near, I just press M-. to visit it. And M-* to pop back to where I was before.

[+] mixmax|16 years ago|reply
Notepad++ because it's relatively simple and gets the job done. I like unbloated minimalism.
[+] geedee77|16 years ago|reply
I use Notepad++ as well most of the time for this exact reason. It's minimalist enough but still has useful features such as colouring keywords which I miss when I use just notepad.
[+] shiloa|16 years ago|reply
I do most of my coding at work (rails, python, ruby, js, html, css), where we have ubuntu machines - I LOVE gedit and simply can't do without it. It has a powerful plugins system, and there's a good repo at github.com/lexrupy/gmate that contains some of the best. There's a port for it on a mac, but I tend to stick to TextMate when on OSX (my home computer).

Some of my can't-do-without features are: delete line, duplicate line, shift-line (up/down), select word, multi-edit (on gedit), word complete (circle through options bash style) and snippets. If I had to pick between gedit and TextMate, I'd probably go with gedit, but only because I spend a lot more time on it on a daily basis. I'm sure if I had TM at work, I'd probably understand what all the hype is about.. :)

[+] jjanzer|16 years ago|reply
If you like gedit you should give geany a try.
[+] tgittos|16 years ago|reply
I don't use a single editor.

Currently I'm using Visual Studio for all .NET related things, because it's a nice, overall IDE.

I'm also getting into C++, for which I use vim in Ubuntu (although I am far, far from being a decent vim user). I couldn't stand the way it tried to handle everything by default and felt like it was interfering with my understanding of C++ dev. I also didn't like the way the VS solution layout doesn't match the disk layout. I wanted to get more down and dirty with my compiler, and possibly learn make.

I also interchangably use Notepad++, Textmate and e-texteditor depending on what's available on the machine I'm on.

[+] kentosi|16 years ago|reply
Your question's made me realise something I completely wasn't aware of! In my many years of coding I always seem to have 2 separate editors open: one for coding and one for editing.

Currently at work, it's eclipse for Java development, and Textpad for all quick editing, regular expressions, mass find/replace across files, large files, etc.

[+] eob|16 years ago|reply
That's an interesting observation. Before going back to school, I worked at a place where Eclipse was the gospel. And Eclipse is a wonderful tool when you're a Java coder, but I often found myself doing exactly the same thing (except with TextMate for the mac) -- when I needed to hack up a file to make changes, I'd copy everything into TextMate, run a bunch of RegEx search and replace jobs, and then paste it back into Eclipse.
[+] kprobst|16 years ago|reply
Visual Studio 2008/2010 for C# stuff, vim for everything else. TextPad is my general-purpose text manipulation tool. along with the Win32 ports of the *nix toolchain.
[+] cowmixtoo|16 years ago|reply
Komodo Edit works well on all platforms and support 'scp' for file access.
[+] jobenjo|16 years ago|reply
After a long stint with Vim (and a brief one with eclipse), I too have been using Komodo Edit.

The vim bindings are good. The app is OS X is fine. (Though I had to hack the source to make the "Go To file" not look in the history, which was bothering me with my many branches). Also removed anti-aliasing, which is awful for code IMHO.

It crashes from time to time, but I think it's the best all around choice right now for good vi bindings, sensible auto-completion, multi-language support, etc.

Plus I like that it's cross-browser and open source, in case I ever want to leave OS X for something better.

[+] mbenjaminsmith|16 years ago|reply
Komodo Edit (Mac) with the Vim bindings turned on. It's lightweight with some advanced features like code completion and basic project management (find & replace in project, etc).
[+] jimmysanchez|16 years ago|reply
UltraEdit for me! Works great for large files and all my day-to-day editing.

http://www.ultraedit.com/products/ultraedit.html

If you work with large files a lot, you may want to check this out:

http://www.ultraedit.com/support/tutorials_power_tips/ultrae...

I also LOVE the scripting. I've written a lot of custom scripts to automate repetitive tasks.

The only downside, it's not free like many of the other editors listed here; however, it is well worth the money.