Skip to main content

The friendly Editor

Harbin , China

Nano Editor

Installation

Install the latest version of Nano by downloading and unzipping your desired version, e.g. nano-5.9. Make sure that the following dependencies are present on your system:

sudo yum install ncurses ncurses-devel

(or libncurses-dev on Debian)

And then build the editor from source:

cd nano-5.9
./configure
make
make install

Cheat Sheet

Overview of nano's shortcuts:

File handling

Ctrl+SSave current file
Ctrl+OOffer to write file ("Save as")
Ctrl+RInsert a file into current one
Ctrl+XClose buffer, exit from nano

Editing

Ctrl+KCut current line into cutbuffer
Alt+6Copy current line into cutbuffer
Ctrl+UPaste contents of cutbuffer
Alt+TCut until end of buffer
Ctrl+]Complete current word
Alt+3Comment/uncomment line/region
Alt+UUndo last action
Alt+ERedo last undone action

Search and replace

Ctrl+QStart backward search
Ctrl+WStart forward search
Alt+QFind next occurrence backward
Alt+WFind next occurrence forward
Alt+RStart a replacing session

Deletion

Ctrl+HDelete character before cursor
Ctrl+DDelete character under cursor
Alt+BspDelete word to the left
Ctrl+DelDelete word to the right
Alt+DelDelete current line

Operations

Ctrl+TExecute some command
Ctrl+JJustify paragraph or region
Alt+JJustify entire buffer
Alt+BRun a syntax check
Alt+FRun a formatter/fixer/arranger
Alt+:Start/stop recording of macro
Alt+;Replay macro

Moving around

Ctrl+BOne character backward
Ctrl+FOne character forward
Ctrl+←One word backward
Ctrl+→One word forward
Ctrl+ATo start of line
Ctrl+ETo end of line
Ctrl+POne line up
Ctrl+NOne line down
Ctrl+↑To previous block
Ctrl+↓To next block
Ctrl+YOne page up
Ctrl+VOne page down
Alt+\To top of buffer
Alt+/To end of buffer

Special movement

Alt+GGo to specified line
Alt+]Go to complementary bracket
Alt+↑Scroll viewport up
Alt+↓Scroll viewport down
Alt+<Switch to preceding buffer
Alt+>Switch to succeeding buffer

Information

Ctrl+CReport cursor position
Alt+DReport line/word/character count
Ctrl+GDisplay help text

Various

Alt+ATurn the mark on/off
Tab Indentmarked region
Shift+TabUnindent marked region
Alt+NTurn line numbers on/off
Alt+PTurn visible whitespace on/off
Alt+VEnter next keystroke verbatim
Ctrl+LRefresh the screen
Ctrl+ZSuspend nano