Nano

From Tux
Revision as of 15:33, 13 January 2018 by Williams (talk | contribs)
Jump to: navigation, search

nano is an open-source text editor that can be used to write programs.

Background

Pine was a text-based email client written in 1989 and released publicly in 1992 by the University of Washington. For writing emails, Pine had an integrated text editor called Pico -- short for Pine composition. Due to how easy Pico was to use, people began using it outside of Pine for more general things such as writing documents and code. Unfortunately, the licensing terms for Pico were not acceptable for the open-source software movement, and thus an open-source clone, nano, was created.

Pros

  • Between emacs, vim, and nano, nano is likely the easiest editor for first-time users
  • Simple key combinations for commands
  • Features:
    • Syntax highlighting for programming
    • Cut & paste
    • File insertion
    • Position saving between sessions
    • Word wrap
    • Adjustable scrolling
    • Find & replace
    • Line/column display
    • Automatic indentation
    • Jump to line/column

Cons

  • Not as full-featured for programming as other editors such as vim or emacs

Usage instructions...

.nanorc

.nanorc refers to a file that can be placed in your home directory that will enable certain features in nano by default. By default nano will have few, if any, option enabled. All of these options can be enabled via flags when launching nano, or the .nanorc file can be created/modified such that the options do not have to be included manually.

For example, nano -S file.cpp will open file.cpp with smooth scrolling enabled, however the set smooth option can be placed in .nanorc so that nano file.cpp without the flag will still have smooth scrolling enabled.

Some useful .nanorc features are as follows:

  • set smooth - To enable smooth scrolling. By default, when scrolling down or up past the viewable area, nano will load multiple lines. If you want to have it only go up or down by 1 line instead, enable this option
  • include /usr/share/nano/c.nanorc - Includes features that enable syntax highlighting in C/C++
  • set tabsize n - Sets the tab size to n columns instead of the default 8
  • set undo - Enable undo/redo functionality

More .nanorc options can be found here: https://www.nanoeditor.org/dist/v2.1/nanorc.5.html