89 points · by protomyth · 9y ago · 59 comments
First modify the buffer somehow. It really doesn't matter if you just type in "test"
Hit ^X to exit nano. When it asks you if you want to save the buffer hit Y
Save the file as "zzy" and press ENTER to trigger the Easter egg
^X+Y+zzy is likely a reference to xyzzy, a cheat code originally used in Colossal Cave Adventure[1]
1: https://en.wikipedia.org/wiki/Xyzzy_%28computing%29?wprov=sf...
PS: You can quit this text-animation by any keypress and then store the actual file zzy, if required.
Every once in awhile I encounter an OS where visudo or something else defaults to nano and I feel so awkward just trying to make simple changes and save the file.
So, while it might not be optimal for vi users, it is at least accessible to pretty much everyone regardless of their background. Whereas for someone not familiar to vi, getting thrown into the dreaded : prompt can be a frustrating nightmare.
VISUAL=vim visudo
or EDITOR=vim visudo
According to the man page, VISUAL is preferred.That said, I prefer Sublime/Vim (Sublime also has these plugins), but Nano is a decent alternative and resembles the first text editor I ever used. Sublime is lightning fast for me, but it isn't open source.
To break the habit of firing up Nano I symlinked it from /usr/local/bin/nano to /usr/bin/vim. If you use Vim regularly, the shortcuts will stick in your head whereas if you resort to Nano you won't memorise them for long. If I ever still require Nano then I can execute it by executing /usr/bin/nano
For people on a Mac, I can recommend the app CheatSheet [1] available in Homebrew. If you're lost in an application holding Command (⌘) for a few sec will represent you with a cheatsheet of shortcuts. It won't work with CLI apps though.
We can all think of far more complicated changes that are considerable more efficient in vi. So the question is 'given perfect familiarity with the tools, and all else being equal, what kind of changes, if any, are more suitable for nano rather than vi.
None of that is to say that nano doesn’t have a place.
So, when i heard of micro i switched immediately, I just find the default copy/cut/paste and the mouse functionalities very comfortable.
sed -i s,^EDITOR=nano$,EDITOR=vim ~/.bashrc CTRL-X [y/n/c];
ALT-A and CTRL-K
CTRL-W and CTRL-R
...pretty much covers 99.9% of the commands I ever use in it.If I need to do quick editing, nano is perfect. If I need to do anything more complex, I'd use rmate[1] + rsub[2] with sublime text.
1: https://github.com/aurora/rmate 2: https://github.com/henrikpersson/rsub
I also often use it to look inside random files on my Mac that won't open anywhere else (e.g. .xml, .json, files without extension names).
As I mentioned below, While it may be more ubiquitous, vi isn't present on Debian's live cd, while nano is.
It does everything you need it to do for quick configuration edits, and doesn't get in your way.
Have you ever tried to use the equivalent 'ee' editor that comes installed on other
NIX? It's painful.I could use vi/vim, but I'm just too lazy to teach myself or use "vimtutor" to actually learn how to use it. I know just enough to open/modify/save/exit, which I think is just good enough for a quick edits.
Over the last 20 years of using Linux I haven't learned vi and emacs above basic editing and saving files.