Click here to Skip to main content
15,891,431 members
Articles / .NET
Technical Blog

Windows compatible keyboard layout for nano editor

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
22 Jul 2013CPOL 5.9K   2  
Windows compatible keyboard layout for nano editor.

This post is not about C#, but sometimes fortune brings you to some places, where you have never been before. For example, may be you need to install your .NET Web Service on Unix platform. Have you ever had the nightmare to edit files in vim? But not all so bad.

Nano editor is one of convenient text editors in Unix. If you ever have trouble with vim (I do) You could find nano editor very friendly. But Unix people make difficult anything that can be very easy. Keyboard layout is unbelievable inconvenient... what authors smoking? Fortunately it can be easy fixed by .nanorc file. Simply make new file .nanorc in home directory with content followed below. It will make keyboard bindings almost same as on Windows.

After restart nano editor will use standard shortcuts - Ctrl-S for save, Ctrl-O for open files, Ctrl-C for copy, Ctrl-V for paste, etc. Although there is some problem with undo/redo. Seems undo shortcut is hardcoded to Alt-U and Alt-Y for redo.

~/.nanorc

set undo
set autoindent
set mouse

bind ^S writeout main
bind ^O insert main
bind ^G gotoline main
bind ^X cut main
bind ^V uncut main
bind ^C copytext main
bind ^H replace main
bind ^Q exit main
bind ^Z undo main
bind ^F whereis main
bind F3 searchagain main
bind F1 help main

Updated layout:

  • Ctrl-Q leaved for exit for compatibility
  • Cut line replaced by Ctrl-Y, which is common for cut line
set undo
set autoindent
set mouse

bind ^S writeout main
bind ^O insert main
bind ^G gotoline main
bind ^Y cut main
bind ^V uncut main
bind ^C copytext main
bind ^H replace main
bind ^Z undo main
bind ^F whereis main
bind F3 searchagain main
bind F1 help main

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) i-BLADES
Thailand Thailand
I'm Android and Full Stack Software Engineer. 28 years in software industry, lots of finished projects. I’m never afraid of learning something new and you can see it by amount of skills in my resume.

I'm working remotely since 2009, self-motivated and self-organized.

There are no impossible projects. I have experience with Android, iOS, Web, Desktop, Embedded applications, VR, AR, XR, Computer vision, Neural networks, Games, IoT, you name it.

Comments and Discussions

 
-- There are no messages in this forum --