Hi all,

What is the difference between vi or nano for editing a file? In your own opinion? I always used vi for editing files but some people say it's better to use nano. Is it just the user preference?

Recommended Answers

All 8 Replies

It's basically user preference. Vi is meant to be a very comprehensive editor, and it has tons of commands and special features. Nano is more of a basic text editor (think "notepad in the terminal", i.e., nothing more than copy-paste, exit-save). I generally prefer nano because for the times that I need a terminal-based text editor, I usually don't need a very complicated editor, and I don't like having to remember all the commands when all I ever need to do is write some text and then "save-and-exit" (and nano has a command-reminder at the bottom). I guess if you are used to vi (and know the commands) it is "better" than nano in the sense that it has more features, but to me, it's needlessly feature-rich for most things I do in a terminal-based text-editor.

I'll comment as a vi (vim, actually) user.

As mike_2000_17 mentions, when you are talking simply about 'notepad in the terminal' there is more overhead to vi - edit mode vs. command mode is a good example. However, if you prefer to do most editing in the terminal vi has a rich set of tools that are available (but not necessary). At a minimum, the syntax highlighting alone is often beneficial.

I think that, with little exception, there is not much differencce between the basic functionality of most editors. It really boils down to what you spend the time to become comfortable with. If you take the time to learn vi inside and out you will feel limited when you dont have access to it. If you master the emacs environment, kate, the visual studio editor, or any other fully functional editor you will become more productive with that tool.

If all you really want to do is place text to a file all tools are about the same and nano probably brings the least 'baggage' in the terminal setting.

Ohh crap, here we go with a potential flame/argument/back-and-forward/opinion thread. Oh well, it's been civilised so far, let's keep it that way.

I've used both vi and nano and prefer nano simply because I find it more user friendly. Then again, I never do serious editing in a terminal.

Until I got to grips with vim, I used to use nano quite a lot for editing text files on the command line. It took a little while to get my head around using vim, but learning to use it properly was time well spent IMHO!

Nowadays, I seem to spend a LOT of time with vim in the terminal. In fact I'd now go as far as saying it is my favourite text editor full-stop. Since learning to use vim, I've found that I can be far more productive using vim than any other editor I have tried before. But that's just my experience. Your mileage may vary! Heh heh!

I've even started using vim extensively on my Windows machine at work (via Cygwin terminal). On my 2nd monitor, I always have two cygwin terminals open. One for diffing/editing files in vim and another for running scripts and grepping through our code-repositories. Going off-topic here, but using grep seems to be much faster than using VS's built in search functionality. Often, when wanting to look something up in VS - I have to wait for the intellisense database to finish rebuilding. And it always seems to rebuild itself at the most inopportune moments. Whereas grep just starts searching instantly and generally tends to return results quicker than VS's search functionality. I only tend to use VS for debugging nowadays!

Getting back on topic:
At the end of the day a text editor is a text editor. Just another tool in the toolbox. As the others have said, for simple tasks you probably don't need anything more complicated than nano. But if you want something more powerful, or you have more complicated editing needs; I'd heartily recommend vi or vim!

I'm currently taking the plunge and trying to learn emacs too - which can also be ran from the command line. But I am having touble remembering all of the strange, esoteric and somewhat counter-intuitive keyboard shortcuts. In fact, I'm having far more trouble getting used to emacs than I had getting used to vim!

I've just started trying to relearn Lisp. And emacs has really good Lisp integration, especially with the Slime plugin installed. So using emacs kinda makes sense for coding in Lisp. But again, the unusual keyboard combos are really throwing me!

Member Avatar

I've fallen in love with sublime. But it depends on what you are doing as well.


You cannot use sublime in the terminal. I think this discussion is about terminal-based text editors, such as nano, pico, vi, and emacs.

You can't use nedit in a console terminal either, but it is a great editor! I use it for almost all of my programming since it has syntax support for most computer languages out there, including c, c++, bash, php, java, make, et al.

And yes, text editor preferences tend to generate major wars! :-) Find what works well for you, and occasionally try something else to see if you might like it better.

And yes, text editor preferences tend to generate major wars! :-)

A computer geek is not really a computer geek without the occasional text-editor flame-wars! ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.