Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have recently started using Ubuntu and hence, the terminal.

As text editor, I have used the pre-installed nano. Now I wonder whether I should install and use vim as well.

What are each of those text editors' special features, advantages and disadvantages? Which one is better suited for newcomers, and for what use cases would the other be preferable?

share|improve this question

closed as primarily opinion-based by muru, Thomas W., guntbert, Charles Green, Pilot6 Jan 28 at 19:57

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
Entirely your wish. – muru Jan 28 at 13:02
1  
if you want to know the difference you should use them both and see for yourself – edward torvalds Jan 28 at 13:20
    
Also don't confuse vi and vim. The latter is improved version, which has many cool things, for example «text objects». – Hi-Angel Jan 28 at 13:57
    
nano has smaller learning curve cumpared to vim, vi takes getting used to even more i suppose. Knowing both however will be quite useful. – Serg Jan 28 at 14:13
up vote 4 down vote accepted

Vim and Nano are completely different terminal text editors.

To differentiate, it will be better to list some features of them. Since we don't use terminal editors for normal edits or coding, I'm listing some of the most interesting features that help for the way we use them today.

Nano:

  • Easy to use and master.
  • Nano has most of the shortcuts listed at the bottom of the window, making it extremely simple to use.
  • Search function
  • Search and replace
  • "Goto line" command
  • Automatic indentation

Vim:

  • Tough to get started with and master. The editing and command modes will confuse beginners.
  • Session recovery
  • Split screen
  • Tab expansion
  • Completion commands
  • Syntax coloring

Although I hated Vim when I first met it, now I prefer it over Nano.

share|improve this answer
    
Very nice list of features, +1. But you should prefer Markdown formatting over HTML tags in your posts whenever possible. Here is the related help center site about Markdown syntax on Ask Ubuntu which will help you to improve your future posts. :-) – Byte Commander Jan 28 at 17:19
4  
nano supports syntax highlighting: askubuntu.com/q/90013/158442. Correspondingly Vim supports all of the last four features mentioned for nano. – muru Jan 28 at 17:48
    
Thank you @ Byte Commander. Will take care of it hereafter. – Jithin Pavithran Jan 28 at 18:49

In a nutshell: nano is simple, vim is powerful.

If you only want to simply edit some textfiles, nano will be enough. In my opinion, vim is pretty advanced and complicated to use. You should expect some time to get into it before you're able to properly use it.

Funny (but not too unrealistic) quote about vim: (source)

I've been using vim for about 2 years now, mostly because I can't figure out how to exit it.

share|improve this answer
1  
thanks, and loved that quote btw :) – Maxsash Jan 28 at 16:11

They're both text editors, but the similarity pretty much ends there. It may seem strange that two text editors could be so different. The key is that they're both specialized text editors, made for two very different tasks. nano and vim (or rather, pico and vi, which they imitate) were designed for writing e-mails and programs, respectively.

You're not meant to spend a lot of time in nano: you go in, you type up your e-mail message (or whatever you were writing), and you get out quickly. Everything is based around getting you in and out as quickly as possible, so you can get back to whatever else you were doing. It goes so far as to list all the functionality at the bottom of the window, so you don't have to waste time looking up help screens. Of course, there's only so much room at the bottom of the window, and so functionality is constrained to whatever can be expressed, alongside all other functionality, in two lines of text. The result is extremely convenient for some things.

You're meant to spend much (if not almost all) of your time in vim, so it tries to stay out of your way while helping you sling large chunks of text around quickly. A basic startup screen gives almost no information, and when you open a file you get only slightly more about where you are. And in both cases, you can't type text straight away: you start in "normal mode" and have to press i to go into "insert mode" first (there are also a few other letters you can press instead of i, offering some variations on this theme, and there are also some other modes I haven't mentioned). The learning curve is extremely steep: it comes with vimtutor to help people out, but some people have gone so far as to write entire games dedicated solely to learning vim's interface. Think about that for a second. An entire game, just to learn how to use a text editor. And people pay for it.

There is no question that nano is better for the newcomer. I'm something of a vim-zealot, and even I can't dispute that one. I've seen vim turn newcomers off of Linux in general. And if you don't plan to do a lot of text-editing, or your text-editing tasks are all fairly light (like, say, writing e-mails), then nano may be all you need.

That said, while mastering vim takes a long time, the return on investment is high. I realize that the rest of this post sounds kind of down on vim, but that's not my intent. You just need to know what you're getting into, because vim is hard. But even its default configuration contains functions that automate a lot of common (and very repetitive) text-editing tasks: you can do with a few keystrokes things that could take many minutes, or even hours, if you had to do them all manually. There are plugins and scripts that take this even further. If you're going to be doing a lot of programming, or similarly long and involved tasks (dissertations, novels, etc), then vim is ultimately the better choice, but you should still figure out nano first: if an emergency comes up and you need to do something before you've figured out the basics of vim, you'll want to be able to drop into something you're comfortable with.

Bottom line: start with nano, and move to vim if nano gets tedious.

share|improve this answer

You don't need vi or vim if you like nano.

Nano is easier to use if you are not familiar with vim.

Vim is similar to vi, which is universal (it installed on almost all unix-like systems), but if you never used it before, you will need to look at some documentation/tutorial before you will be able to do anything with it.

share|improve this answer

Vim is very powerful, but hard to learn. It is so called «modal editor» — as opposed to a common editor which is nano. Vim allows you to have all the text within a few key clicks, so if you're able to touch-type, your movement with pure keyboard would be even faster than with mouse.

So, if you're not writing much — e.g. like programmers — then you could just stick with whatever common editor. Otherwise I suggest you to learn that Vim. For example I am using Emacs with Evil mode (which emulates Vim), it is cool.

A side effect of learning Vim which nobody for some reason mention — if you're not able to do touch-type, but want to learn it, just learn Vim, and use it everyday. Vim forces you to move without arrows part (h,j,k,l instead), and as you can't look at the keyboard every time you move, you would be forced to learn more and more key locations. This is how I learned touch-type by the way ☺

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.