Difference between Nano and Vim

126,625

Solution 1

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.

Solution 2

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.

Solution 3

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.

Solution 4

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.

Solution 5

I read through the other posts. Initially I would have agreed with them. However, I have taken the time to really learn nano. It is actually quite powerful. For example, you can have syntax highlighting. You just need to configure your .nanorc file. And there are many samples that come on the server in the /usr/share/nano location. Just add an include /usr/share/nano/sh.nanorc line to your ~/.nanorc file for bash shell highlighting.

There are a large number of additional keyboard commands that you can use. I made myself a whole page of shortcuts. It is very much like using Wordstar or other text based word processors of the old days. I find now that I install nano on servers it is not on as one of my first steps because it has become so intuitive for me, and so much more efficient than vi/vim. I would not say it is more powerful, but it is as powerful.

Start with this nano cheat sheet to find a large number of the commands. If you have used emacs you will find this is very similar, but in my mind easier. I don't fault people that still use vim. There have been holy wars for years for vim vs emacs. Adding nano has just added a third very powerful editor to that discussion. But do not discount it as a weak beginners tool.

The big difference is that vim is modal and nano is not. So with vim you are constantly changing between command mode and edit mode. In nano, as in emacs, you are in one mode and your commands use special key combinations. As you use the editor more you will start to learn all the most used commands. And if you use it a lot you will learn most of them. One other note is that for the read file function there are two mode for that. Either it will read a file into the current edit buffer, or into a new buffer to go between. Make sure to look that one up.

Share:
126,625

Related videos on Youtube

Maxsash
Author by

Maxsash

As of Jan 2016, I am an electronics engineering student with increasing interests in robotics and coding. So i started ubuntu. Have written a bit of code, and into other artistic stuff like guitar and sketching. As far as i can tell i have progressed really quickly on getting acquainted with the new OS. :)

Updated on September 18, 2022

Comments

  • Maxsash
    Maxsash over 1 year

    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?

    • muru
      muru about 8 years
      Entirely your wish.
    • Edward Torvalds
      Edward Torvalds about 8 years
      if you want to know the difference you should use them both and see for yourself
    • Hi-Angel
      Hi-Angel about 8 years
      Also don't confuse vi and vim. The latter is improved version, which has many cool things, for example «text objects».
    • Sergiy Kolodyazhnyy
      Sergiy Kolodyazhnyy about 8 years
      nano has smaller learning curve cumpared to vim, vi takes getting used to even more i suppose. Knowing both however will be quite useful.
  • muru
    muru about 8 years
    nano supports syntax highlighting: askubuntu.com/q/90013/158442. Correspondingly Vim supports all of the last four features mentioned for nano.
  • Neil
    Neil almost 5 years
    "we don't use terminal editors for normal edits or coding". Uhm... :)
  • William Kinaan
    William Kinaan almost 5 years
    Vim supports goto line, which comes from its parent vi, which comes from its parent Ex. Simple type :31 in the moral mode