Most popular Terminal editor Vi/Vim and Nano

Vi/Vim and Nano text editor

There are some of us who regularly use Terminal or are curious about how one can control their system with it. One of the primary ways to use the Terminal is to configure text files Terminal text editors and control how certain programs or system services behave. There are plenty of reasons why using the Terminal may still be better and there are almost always at least one programs need a text editor to complete the task. Two of the top choices are nano and vim.

Let's dive into the deep of these two text editor.

Vi/Vim

Vim is designed for use both from a command-line interface and as a standalone application in a graphical user interface. Vim is free and open source software and is released under a license that compatible with the GNU General Public License through a special clause allowing distribution of modified copies under the GNU GPL version 2 or any later version. It was written by Bram Moolenaar based on source for a port of the Stevie editor to the Amiga and first released publicly on 2 November 1991. Originally, the acronym stood for "Vi IMitation", but that was changed with the release of Vim 2.0 in December 1993.

Vim’s features -

  • Automatic command

  • Syntax coloring

  • Completion commands

  • Split screen

  • Digraph input

  • Higher memory limits than vanilla vi

  • Session recovery

  • Tab expansion

  • Tag system

Nano

GNU nano is a text editor for Unix-like computing systems or operating environments using a command line interface. It provides additional functionality. Nano is licensed under the GNU General Public License (GPL). It released as free software by Chris Allegretta in 1999 and became part of the GNU Project in 2001. It emulates the Pico text editor.

Nano’s features -

  • Autoconf support

  • Free license (GNU GPL)

  • Goto-line# command w/o flag

  • Case sensitive search function

  • Interactive search and replace

  • Slang and ncurses support

  • Auto Indent ability

  • Regular expression search and replace

  • Toggles for cmd line flags via Meta keys

  • Tab completion when reading/writing files

  • Soft text wrapping

To determine which one is better, let’s compare them

  • Nano/pico/alike editors for simple and quick text-editing, like changing some config values in a configuration file, it's just so simple and fast. And vim for programming in the command-line environment (also in X, if needed), because of its abilities.

  • Vim supports to OpenVMS OS, but Nano doesn't.

  • vi/vim is a very common *nix text editor, if you ever want to get serious in that area, vi/vim is what you need to learn.

  • With nano, it's easy to use and master. But, with vim, it's tough to get started with and master. The editing and command modes will confuse beginners.

  • vi retains each permutation of typed keys. This creates a path in the decision tree which unambiguously identifies any command. But GNU nano, like Pico, is keyboard-oriented, controlled with control keys.

  • Nano uses "Goto line" command and vim uses completion commands

  • Vim operates in a terminal but has a graphical menu. If you use sudo, you need to use "visudo" to configure it. So knowing the most basic fundamentals of 'vim' is a must. Also, the rescue environment probably has 'vim-minimal' as the editor.

  • Nano includes only the bare minimum of functionality needed to edit documents making it very simple.

  • Vi is based on the principle of "hjkl" - which lies under one hand and is easily reached.

  • Vim uses a sliver of the system's memory and it loads instantly, all the while delivering the same features.

  • In nano, all command characters are shown at the bottom of the editor. Almost like vi (vim), you can find nano on most Unix-like systems.

  • You'll spend a lot of time learning all the commands and modes supported in Vim.

  • nano uses meta keys to toggle its behavior.

  • In Vim, it's difficult to copy, paste, and delete.

  • While nano is fine for writing emails and blog posts, it's probably not a good editor for programmers or really anyone that needs an editor more than once in a while.

  • Vim allows users to include many features found in IDEs and competing editors but does not force them all on the user.

  • You have to learn keybindings, especially for Nano. If you’re a casual Linux user or hobbyist, nano might be all you ever need.

 

At the end, if you can live with a very steep learning curve, then you may find vim to be better suited because of its large amount of flexibility and features. However, that being said, in our opinion, the go-to editor will still be nano because there is no need too many fancy features for a Terminal text editor. Nano has a simpler interface as it can still ultimately edit what need it to edit. So, what’s your favorite one? Let us know in the comment below. Thank you!

Recommended for you