Windows compatible keyboard layout for nano editor





5.00/5 (1 vote)
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