LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Blogs > deskt0plinux
User Name
Password

Notices


Rate this Entry

Improve nano and make it work with shortcuts used in windows

Posted 08-14-2012 at 04:15 PM by deskt0plinux
Updated 08-14-2012 at 04:19 PM by deskt0plinux (added note about keybinding working only for 2.x)

I use these lines in a file .nanorc in my home directory - eg:
/home/deskt0plinux/.nanorc
Code:
set autoindent
set boldtext
set brackets ""')>]}"
set const
set historylog
set matchbrackets "(<[{)>]}"
set mouse
set multibuffer
set regexp
set smarthome
set smooth
set suspend
set tabsize 4
set wordbounds
set softwrap

bind ^S writeout main
bind ^W nowrap main
bind ^F whereis main
bind ^G searchagain main
bind ^C copytext main
bind ^X cut main
bind ^V uncut main
bind ^L gotoline main
bind ^H replace main
bind ^I indent main
bind ^J unindent main
bind ^B findbracket main
bind ^Z cancel all
bind ^Y redo main
bind ^P prevbuf main
bind ^N nextbuf main
bind ^O insert main
bind M-X suspend main
bind M-Q exit main
bind M-H firstline main
bind M-E lastline main
bind F1 help main
bind F5 refresh main
For a full explanation of the options do man nanorc

Note !
Possibly the entire section with "bind ..." might not work on older versions of nano (before 2.x), that is, shortcut mapping works only since 2.x AFAIK.

----------

If you put the above file in your home directory, the following should result:

This makes nano recognise the default Windows shortcuts - Ctrl+C, Ctrl+X, Ctrl+V.

Note that Ctrl+Z may not work - undo works only in newer versions of nano (v2.2+ AFAIK).

M-X stands for Alt-X which suspends to the shell/command-line. To resume from that shell back into nano type "fg" (for "foreground").

M-Q = Alt-Q = Quit.

Happy editing!
Posted in Uncategorized
Views 1467 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 09:00 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration