Pinterest Stumbleupon Whatsapp
Advertisement

Although Linux has become easy enough for practically anyone to use without ever having to use the Terminal, there are some of us who regularly use it or are curious about how one can control their system with it. In any case, 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.

While you can easily use tools such as Gedit gedit: One Of The Most Feature-Filled Plain Text Editors [Linux & Windows] gedit: One Of The Most Feature-Filled Plain Text Editors [Linux & Windows] When you think of plain text editors, the first thing that may pop into your head is Windows' Notepad application. It does exactly what its job description states - plain features for a plain text... Read More , Leafpad Leafpad - An Ultra-Lightweight Text Editor [Linux] Leafpad - An Ultra-Lightweight Text Editor [Linux] Read More , or even Geany Geany - A Great Lightweight Code Editor For Linux Geany - A Great Lightweight Code Editor For Linux Surprisingly, Linux doesn't offer that many good IDE's (Integrated Development Environments). I believe this is because back in the day most Linux programmers took out good old Notepad (or gedit in this case), and started... Read More ; there are plenty of reasons why using the Terminal may still be better. If the Linux world has taught you anything, there’s almost always at least two programs to choose from to complete the same task.

For terminal text editing, two of the top choices are nano and vim. In order to determine which one is better, we’ll look at features and general ease of use. While system resource usage could also technically be considered in this comparison, it’s safe to assume that as terminal text editors they require a negligible amount of system resources.

History

The nano project was created in 1999 in order to emulate the Pico text editor but improve on it. nano also claims to be 2/3 to 1/8 the size of the Pico binary, which makes it very lean and usable on even the weakest systems. vim, originally developed in 1991, is based on the original vi text editor that was developed in 1976. Therefore, like nano, vim aims to improve upon the project that it’s based on. As of right now, these two along with emacs are still the top contenders for Terminal text editing.

nano

nano has always been known to be user-friendly when it comes to terminal text editors. After you open or create a file by typing a command such as nano /home/user/HelloWorld.txt, it will show you a recognizable user interface which displays the text contained within the file, along with various actions you can perform along the bottom. All of these actions are done in a CTRL + Key manner, so for example, saving a file is done via CTRL + X, which it tells you along the bottom of the terminal.

terminal_text_editor_nano

Advertisement

nano’s features include:

  • Autoconf support
  • Truly free license (GNU GPL)
  • Goto-line# command w/o flag
  • Case sensitive search function
  • Interactive search and replace
  • Slang and ncurses support
  • Autoindent abillity
  • Displayed tab width option
  • Regular expression search and replace
  • Toggles for cmdline flags via Meta keys
  • Tab completion when reading/writing files
  • Soft text wrapping (meaning that the text doesn’t wrap like it does in full-fledged document editors, but rather there is a $ at the end of the line which means there’s more text on that line that is displayed when you move the cursor to it)
  • And much more!

nano text wrapping

Overall, nano is a useful text editing tool in a Terminal to get all sorts of files edited with ease. For someone who usually messes with configuration files in Terminal, I prefer a text editor that doesn’t make it any harder on me than it already is.

vim

vim isn’t known to be very user-friendly, and that’s immediately apparent by the fact that opening a file using a command such as vi /home/user/HelloWorld.txt (vim is still opened by the vi command) shows just the text file, and practically nothing else about vim itself. This makes using vim as a first-time user extremely difficult as there’s no way of learning how to control vim except by going to read the documentation (boring) or by randomly mashing buttons while hoping that none of them royally screw up your text file or system.

terminal_text_editor_vim

Even then, things aren’t very intuitive. You can’t do any real editing without pressing “I” for Insert mode, and then Esc to get out of Insert mode. To Save, you’ll have to type in “:w” and hit enter, and “:quit” and hit enter to exit the program. What? Although it might make sense later on, it’ll be really difficult to discover all of this without reading some boring documentation. At least be happy that you’re not using the original vi, which most vim people claim is even harder to use.

vim syntax coloring

vim does have the advantage of being more powerful that nano, as you can customize it with plugins and scripts in addition to its lengthy feature list that includes:

  • Automatic commands
  • Completion commands
  • Digraph input
  • Higher memory limits than vanilla vi
  • Split screen
  • Session recovery
  • Tab expansion
  • Tag system
  • Syntax coloring
  • Among others!

Installation and Conclusion

Installing either of these applications is extremely easy as both are very well known. Just search your respective package manager for nano and vim packages, and install them. It’s as simple as that.

So which is better? If you can live with 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, my go-to editor will still be nano because I don’t need too many fancy features from a Terminal text editor. I prefer nano’s simpler interface as it can still ultimately edit what I need it to edit.

For more great Linux applications, check out out Best of Linux Software page!

Which terminal text editor do you prefer? Is ease-of-use important to you or would you rather have access to more features? Let us know in the comments!

Leave a Reply

Your email address will not be published. Required fields are marked *