
The OP's question is still valid, but many of the answers here are for an older version of nano. I didn't test, but I'd guess you can't use the tilde operator, i.e ``sudo cp ~/.nanorc /root/ as it would likely interperet this to be/root` rather than your username as again, you're telling it "super user do cp from home directory". Note this will overwrite any existing nanorc file in /root and you must replace myUserName with your actual user name. nanorc file setup as you like, and you don't already have a /root/.nanorc file then you can just run sudo cp /home/myUserName/.nanorc /root/.

Rebinding ^M (Enter) or ^I (Tab) is probably not a good idea.
(Often, F13 to F24 can be typed as F1 to F12 with Shift.) But when any Shift+Meta bind is made, that willįN where N is a numeric value from 1 to 24. By default, each Meta+letter keystroke does the same as the corresponding Shift+Meta+letter. M-X where X is any ASCII character except [, or the word "Space". ^X where X is a Latin letter, or one of several ASCII characters ], \, ^, _), or the word "Space". Rebinds the given key to the given function in the given menu (or in all menus where the function exists when all is used). Key bindings can be changed via the following three commands: Not exactly what the OP was asking for, but for completeness you can also toggle line number on/off via the default keybinding (as of v4.8) of Alt+N.Īlternatively you can rebind this key via the man file mentioned method: REBINDING KEYS So the contents of my ~/.nanorc file are simply: 1 set linenumbers

See nanorc(5) for more information on the possible config /nano/nanorc, whichever isĮncountered first. It exists), and then the user's nanorc (if it exists), either ~/.nanorc INITIALIZATION FILE nano will read two configuration files: first the system's nanorc (if Nano -linenumbers foo.txt Via the config file(s)Īlternatively, according to the man page for nanorc, you can add set linenumbers in ~/.nanorc, $XDG_CONFIG_HOME/nano/nanorc or ~/.config/nano/nanorc. l, -l inenumbersĭisplay line numbers to the left of the text area. You can use the -l or -linenumbers flags. According to the man page for GNU nano 2.9.3 (also verified on version 4.8), you have two options for automatically opening with line-numbers shown and one for toggling them on/off once nano is open: Command Line Flags
