Skip to content

Instantly share code, notes, and snippets.

@franz-josef-kaiser
Last active April 8, 2024 09:27
Show Gist options
  • Star 45 You must be signed in to star a gist
  • Fork 20 You must be signed in to fork a gist
  • Save franz-josef-kaiser/43c045190356b0d5778c to your computer and use it in GitHub Desktop.
Save franz-josef-kaiser/43c045190356b0d5778c to your computer and use it in GitHub Desktop.
nano keyboard shortcuts

^ = Ctrl key M = Alt key

^G      (F1)            Display this help text
^X      (F2)            Close the current file buffer / Exit from nano
^O      (F3)            Write the current file to disk
^J      (F4)            Justify the current paragraph

^R      (F5)            Insert another file into the current one
^W      (F6)            Search for a string or a regular expression
^Y      (F7)            Move to the previous screen
^V      (F8)            Move to the next screen

^K      (F9)            Cut the current line and store it in the cutbuffer
^U      (F10)           Uncut from the cutbuffer into the current line
^C      (F11)           Display the position of the cursor
^T      (F12)           Invoke the spell checker, if available

^_      (F13)   (M-G)   Go to line and column number
^\      (F14)   (M-R)   Replace a string or a regular expression
^^      (F15)   (M-A)   Mark text at the cursor position
        (F16)   (M-W)   Repeat last search

M-^             (M-6)   Copy the current line and store it in the cutbuffer
M-}                     Indent the current line
M-{                     Unindent the current line

^F                      Move forward one character
^B                      Move back one character
^Space                  Move forward one word
M-Space                 Move back one word
^P                      Move to the previous line
^N                      Move to the next line

^A                      Move to the beginning of the current line
^E                      Move to the end of the current line
M-(             (M-9)   Move to the beginning of the current paragraph
M-)             (M-0)   Move to the end of the current paragraph
M-\             (M-|)   Move to the first line of the file
M-/             (M-?)   Move to the last line of the file

M-]                     Move to the matching bracket
M--             (M-_)   Scroll up one line without scrolling the cursor
M-+             (M-=)   Scroll down one line without scrolling the cursor

M-<             (M-,)   Switch to the previous file buffer
M->             (M-.)   Switch to the next file buffer

M-V                     Insert the next keystroke verbatim
^I                      Insert a tab at the cursor position
^M                      Insert a newline at the cursor position
^D                      Delete the character under the cursor
^H                      Delete the character to the left of the cursor
M-T                     Cut from the cursor position to the end of the file

M-J                     Justify the entire file
M-D                     Count the number of words, lines, and characters
^L                      Refresh (redraw) the current screen

M-X                     Help mode enable/disable
M-C                     Constant cursor position display enable/disable
M-O                     Use of one more line for editing enable/disable
M-S                     Smooth scrolling enable/disable
M-P                     Whitespace display enable/disable
M-Y                     Color syntax highlighting enable/disable

M-H                     Smart home key enable/disable
M-I                     Auto indent enable/disable
M-K                     Cut to end enable/disable
M-L                     Long line wrapping enable/disable
M-Q                     Conversion of typed tabs to spaces enable/disable

M-B                     Backup files enable/disable
M-F                     Multiple file buffers enable/disable
M-M                     Mouse support enable/disable
M-N                     No conversion from DOS/Mac format enable/disable
M-Z                     Suspension enable/disable
@pamir-s
Copy link

pamir-s commented Apr 2, 2019

very useful, gives extra power.
Though most prefer Vi, but without a backup text editor like nano, things are always guaranteed to work out.

@stonecorleone
Copy link

What is M-W in mac?

@franz-josef-kaiser
Copy link
Author

@stonecorleone Option + W.

@aslugo
Copy link

aslugo commented Nov 23, 2022

What is M-W in mac?

Did you ever find out? I'm trying to figure this out

@aslugo
Copy link

aslugo commented Nov 23, 2022

@stonecorleone Option + W.

Option + W results in ^W "Where is"
I think @stonecorleone is asking for "Next" which is M-W, not ^W

@adrianmihalko
Copy link

M-W is Vim/Emacs notation, where M means Meta (a key present on MIT and Sun keyboards).

On IBM-compatible keyboards – depending on, e.g., your window manager and terminal emulator – you can invoke the shortcut with Alt + W (hold, tap), Win + W (hold, tap) or Esc, W (tap, tap).

@samal-rasmussen
Copy link

M is the escape key 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment