GNU Nano 4.0
nano-editor.org
nano-editor.org
Finally. It was one of the most insane defaults in the history of text editors. Things like this are the reason why it's so hard to recommend nano to beginners.
if [ x$CMDSH = xshell ] ; then
grep -qP $BLKLST <<<"$CMD" && CMD='panic' # skip obviously bad commands like
rm -rf /
# (this isn't a security thing, we just want to catch stupid mistakes)
fiChecking for obvious problems should happen inside eg rm (see `rm --help | grep root`), not in a random shell script, but I didn't want to bother coming up with a better excuse to have rm -rf / inside a comment.
Usually the errors caused by syntax-unware text mangling are either obvious and harmless (so not as punchy of a example) or much more subtle than "destroys literally the entire system".
I still use nano 50% of the time because it's so easy to jump into a file, make some quick changes, and jump out. Plus the mark/cut/paste keystrokes are seared into my memory after years of use.
emacs -nw -Q
It boots up quickly and the basic editing defaults are all there. Has the advantage of being everywhere Emacs already is as wellJOVE is tiny, and has implemented a huge amount of emacs. After you spend 15 minutes or so tweaking your .joverc file you won't even notice it's not GNU.
Limiting yourself for such rare occasions just sounds wrong.
/etc/nanorc is worth a look, at least on Debian it's well commented
With the GUI version, what do you have to learn in emacs? In gvim, you have to learn how to switch between normal and insert mode, but I can't think of anything else basic that can't be done in the menus.
You can pick a new keyboard shortcut to learn every day or two, or whenever you get tired of digging through menus to use a feature. In a year you'll wonder why the hell you let negative bias/emotion keep you from learning a real editor for so long.
Now, things like Emmet and the possibility of having hundreds of simultaneous editing cursors, these things really save time, and work in an intuitive editor like SublimeText.
That's why I would like to understand where you're coming from.
First, I'd like to verify: Do you think motivation isn't a human cognition problem?
Second, it appears to me you are making a wide array of assumptions about my preferences and my goals, as well as about what I find difficult or easy.
For example, you appear to assume that were I to choose rationality (?, i.e. not carrying "negative bias/emotion") I should value speed over of a host of other qualities of interaction design.
You seem to imply that committing to a specific kind of interesting, but very quaint visual/interaction style, i.e. the interaction constraints of a terminal UI, are a price worth paying for the speed of operation gained. Am I correct that you are implying this?
Keyboard shortcuts are not an exclusive feature of terminal UIs. I have a strong preference for UIs that comply with, for instance, the well-researched heuristics from the field of human-computer interaction. Terminal UIs are generally a lot more challenging to design to comply with them (for general audiences). Also visual hierarchy and a host of other beneficial properties are harder to achieve.
https://www.nngroup.com/articles/ten-usability-heuristics/
Yet, certain types of expert users tend to prefer - in my point of view - extremely arcane UIs, as they fit those users' style of operation.
They do not seem to fit mine. I want to emphasize that these are my current preferences, and you may well be right that I would enjoy the speed of emacs/vim usage. So far though, no one has bothered to sell them to me in a way that I personally would find convincing.
This is why I recommend to anyone wanting to try a -nix like OS to learn the basic commands in both vi and nano. One or the other is shipped with every -nix like OS I've ever used. Once they get more used to the OS, go ahead and install whatever editor they want to. But logging into a fresh install of pretty much any system, one can get by with either of the two.
I wrote a console-based mail-client with lua-based scripting, over at https://lumail.org/ but I don't think I have more than 50 hard-core users. It seems like most people use mutt, and work around its annoyances, or use web-browser for their mail.
(I realize at some point notmuch came out and became popular, but I've never had a strong feeling for how popular. I think I'm a little biased since I read of people using it, but nobody "local" to me does.)
I was used to pine when mutt came out, so I always used pine or alpine. You can check both out and see which you prefer.
I still use it regularly and it still works well, but I should probably be looking for something else.
Nano can get partially there, micro is the current best though it has a few MacOS oddities around home/end but can be configured, in the past used ne.
https://gist.github.com/fevangelou/be744753730e86b8783fd481f...
EDIT
I guess I had assumed that vi/vim was significantly more widespread than nano. Maybe that's an outdated assumption? I feel like I've come across a few instances where vi has been the only choice...
Edit: I suspect it's the default because it launches with visible instructions on how to exit. Launching Vim or Emacs strands a lot of new users.
Just because the command is "vi" to invoke doesn't mean anything.
I agree, but if anyone is curious, the source is available and has a BSD style license: http://ex-vi.sourceforge.net
Also, do Macs come with vim?
Are there better, more powerful editors out there? Sure. But just like vim, you can expect to find nano pretty much anywhere, and if you need to make a quick change, say to a configuration file on a bare-bones system, that's nice.
As a developer who almost exclusively uses GUI editors (Sublime / IntelliJ) I have lost the emacs skills I gained in college, and I don't use emacs enough to remember the key strokes necessary to make it more useful than nano. It's more difficult than nano because I have to google a cheat-sheet every time I use emacs.
I never liked vim.
Nano is a great terminal editor, has enough commands to make me productive when needed, and I use it exclusively for terminal text editing.
With Emacs/VI you need to bring a HUGE mental framework to just use it.
And maybe, with luck or some years of pain training, to just EXIT it :)
---
Vim/emacs are powerful. Nice? Never. Easy? never. Good for most common editing task in the terminal?. Nope.
Claim that Vim/Emacs are good is like say "why people use Sublime Text when Eclipse is so much better?"
Except, with eclipse, you know how exit it.
That's enough to get by for quick edits. I haven't used vi a ton in my life, but I've managed to remember that much.
With nano, all is straight in the UI. That is powerful, and so obvious.
Why Vim/Emacs not have that?
The GUI app as a menu bar, a standard gui feature that includes at the far right an entry entitled HELP under which one can find a manual, docs, a tutorial, a FAQ and various other options.
Just saying that vi at its most basic level isn't bad at all. The user only has to remember i,esc,:w,:q,:q! for basic editing. That's not much.
But I do agree that it would be nice if vi / vim would simply list those commands when starting the editor for those who have never used it or haven't used it in ages.
I know other people who aren't Vim fanatics at all but have occasional work in the terminal, and they too also just learned the most basic Vim commands and have the most basic Vim configurations, if at all.
I am sure vi and emacs are much powerful than nano, but the time I'd have to invest in learning them would outweigh the benefit. I just don't edit text files enough for it to pay off.
The edge still goes to vi, especially if you log into older/legacy things, or in very resource constricted environments. It looks like busybox, for instance, has a vi but not a nano: https://busybox.net/BusyBox.html
-------------------------------
How to compile and install nano:
Download the nano source code, then:
tar xvzf nano-x.y.z.tar.gz
cd nano-x.y.z
./configure
make
make install
It's that simple. Use --prefix with configure to override the
default installation directory of /usr/local.
If you haven't configured with the --disable-nanorc option, after
installation you may want to copy the doc/sample.nanorc file to
your home directory, rename it to ".nanorc", and then edit it
according to your taste.I’m a daily Nano user and in my experience the only real headache you can run into is missing the right version or configure not finding where readline and nucrses/ncursesw are. Those are really easy to install on any platform (even from source).
There are other Linux distros too. I had openSUSE installed off there not too long back. Theres even Github projects that let you install any ISO onto WSL and wherever on your hard drive you want to install them to.
$ sudo apt update && sudo apt upgrade
Personally, I've ended up back on Debian stable for WSL, because I have reasons to use a VM rather than WSL. So WSL is now just a dumb ssh terminal into a local VM. If you're curious, the reasons are primarily to do with speed of disk access operations. I also run into some issues with several emacs add-ins that I can work around but don't care to.*I also run vcxsrv on Windows, and ssh X forwarding didn't work immediately, but a low-priority to-do is to use this to run local-VM X clients connecting to the Windows X server.
* I sometimes stop to ponder the things that I find acceptable to troubleshoot and the things I don't want to put the effort into. For reference, see above about local VM and X Forwarding....
It’s really as trivial to dist-upgrade Ubuntu on WSL as real Ubuntu.
Heck, I bet 19.04 works fine already if you dare run a beta.
yesssssssssss
Hardly any of my colleagues knows what POSIX is (and surely not in any depth, even those that do), but they still SSH and use editors that include Vim all the time...
I'd say in a company of 50+ SSHing people, around 5-6 know POSIX and its history, and usually the older ones (35+).
Especially a 2019 user, 20+ years removed from the systems, decisions, and rationales, behind POSIX.
Just try to get someone (even a seasoned Linux user) to use a POSIX-only userland (as opposed to GNU), as see how fast they'll be pulling their hair out...
The reason why this is (and also why the lines should not be longer than LINE_MAX or contain \0) is that when you simply call fgets() in a loop with LINE_MAX sized buffer, all of these things cause perfectly logical, but wrong/surprising behavior. This is the reason why almost any modern small unix tool contains something called myfgets(), getline() or whatever which wraps fgets() in loop with realloc() and correctly distinguishes eof from other errors.
No, they’re not correct, since they make files without the newline.
(I was actually very surprised when vscode _didn't_ do this!)
Edit: Which is to say, I don't think l24ztj is using "expect" in the sense of "anticipate" but rather, y'know, the other sense. (Using Wiktionary's definitions: "To consider obligatory or required" or "To consider reasonably due".)
If you want to specify the exact bytes on disk, you should use a hex/bin editor.
I should only need a hex editor if I want to make a file that can't be decoded as text under a known encoding, and no encoding I know (and certainly none that I use) has the encoding/decoding rule I mentioned above. I certainly shouldn't need one just to make a validly-encoded UTF-8 file that happens to end in a character other than a newline.
Basically, either it's part of the encoding or it's part of the text, and if it's part of the text, I ought to be able to control it. And it isn't part of the encoding.
I agree. But for me a text file that does not end in newline is badly formed. It is not a text file, it is a binary file that happens to contain some printable characters.
This is also why tools that have a Unix heritage tend to complain if there is no terminator/separator at the end of the file (even in Windows), like most C compilers.
echo 'this is a test' > test\n
and then echo was adding the newline because you didn't specify -n. echo 'this is a test\n'
doesn't produce an additional new line because -e wasn't specified.Luckily, you usually don't need to do extensive editing there, because you usually can't change much. Most of the changes you'd want to make to config files, etc. also have to go into the next deploy or through some change management process anyway.
You definitely get used to using vi, though.