GNU nano 2.9.0
nano-editor.org
nano-editor.org
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.
VISUAL=vim visudo
or EDITOR=vim visudo
According to the man page, VISUAL is preferred.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.
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.
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.
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 ~/.bashrcAnd I still type "pico".
If you want to get rid of this habit put this in /usr/local/bin/pico.sh or ~/bin/pico.sh
#!/bin/bash echo "Type nano instead of pico..." sleep 5 nano $*
Put in ~/.bashrc alias pico=~/bin/pico.sh (or /usr/local/bin/pico.sh)
Make sure to chmod +x the shell script.
You can also simply call it pico instead of pico.sh; then you won't have to use the ~/.bashrc addition.
Its everywhere, its quick, and unless you've done some pretty nutty stuff in your configs, basic usage is the same between a heavily customized vi and the vi you find bundled with every is bundled windows and gentoo. (Not to disparage any preference for emacs; it just seems a bit much to have to fall back to an entirely different editor seems a bit much)
It's akin to the same justification for why I wouldn't bother opening a random tiny file in Xcode or IntelliJ IDEA.
I don't use Emacs as just a simple text editor. I can probably count the times I've typed `emacs some/file/path.whatever` into the shell on one hand.
et() {
emacsclient -tty --alternate-editor '' "$@"
}
.. for using Emacs in the terminal a-la vim/nano. When you close the file you opened, you'll be right back where you left-off in the shell. I still tend to use a long-running GUI instance as you describe, but for jumping into config files from a terminal to edit a line or two, it's great.vim-tiny and nano sizes are nearly the same; nvi is smaller; I'm pretty sure the "vi" applet in busybox would be much smaller.
Over the last 20 years of using Linux I haven't learned vi and emacs above basic editing and saving files.
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.
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.
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.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.