Difference between Nano and Vim
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.
Vim and Nano are completely different terminal text editors.
Nano is simple, easy to use and master while Vim is powerful and tough to master.
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.
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.