Cheat sheet for nano

The GNU nano editors default keybindings and their functions. Keybindings can be edited and changed.

Cheat sheet for nano

The GNU nano editors default keybindings and their functions.
Keybindings can be edited and changed in ~/.nanorc or ~/.config/nano/nanorc. To do so, copy the /etc/nanorc to either

The Cheat sheet

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

Editing
Ctrl+K   Cut 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+Q   Start 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+Del   Delete word to the right
Alt+DelDelete current line

Operations
Ctrl+T   Execute 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+B   One 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+G    Go 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+C   Report cursor position
Alt+DReport line/word/character count
Ctrl+GDisplay help text

Various
Alt+ATurn the mark on/off
TabIndent marked region
Shift+Tab   Unindent marked region
Alt+VEnter next keystroke verbatim
Alt+NTurn line numbers on/off
Alt+PTurn visible whitespace on/off
Alt+XHide or unhide the help lines
Ctrl+LRefresh the screen