Live data from Hacker News

GNU nano is my editor of choice

ariadne.space

141–150 of 236 posts

Re: GNU nano is my editor of choice

#141
post #116
post #52

Earlier quoted context omitted.

If you’ve never logged into a Linux machine without nano installed, then you probably haven’t logged into that many flavours of Linux machine. I agree this is pretty much a non issue for the average developer, but those of us who work on network infrastructure, as red-team hackers, or do any work on embedded systems can attest to how much of a pain it would be to not know how to use vi/vim.

This is even more common in the world of containers where “nice to have just for debugging” get omitted. You haven’t lived till you have to edit using only sed.

I did build a arch Linux install using cat <<EOF, grep and sed. But golly it gets tedious

Re: GNU nano is my editor of choice

#143
post #98

Earlier quoted context omitted.

Aren't casual vim users really vi users? I use emacs primarily but years ago created an extremely minimal (~20 lines) .vimrc to be installed by default on every server I work on. Some color, maybe indentation, I don't even know because I usually just use Emacs/TRAMP these days, but I'm nearly 100% sure that every config there works in vi. I would consider myself a casual vim/vi user in that I don't know the differenc…

I may be misremembering, but the biggest differences I remember between vi and vim as a semi-casual user is vi defaults to not supporting arrow keys, and doesn't tell you the mode it's in.

I can't remember the last time I used vi and was unable to use arrow keys. That includes typical Linux installations (Vim, Busybox), Solaris (default is Vim, oddly, but I just confirmed arrow keys work in /usr/xpg4/bin/vi), and various BSDs (nvi).

I'm not a power vi user, though. I usually use JOE (thanks/blame to '90s Slackware education), but occasionally vi is more convenient. It wouldn't be nearly as convenient without the arrow keys as I never learned proper typing technique.

Re: GNU nano is my editor of choice

#144

Earlier quoted context omitted.

I think you're referring to multiple cursors? Visual-Multi [0] is an amazing Vim plugin for this with advanced features like searching by regex, alignment by regex, transposition, duplication, auto-numbering, and more. You can ignore the advanced features at first, it's very intuitive: just `C-n` to find the next occurrence of the word or `\\a` to find all, and then whatever editing operation you want like `cfoobar `…

This is not multiple cursors. Ctrl+k is cut line, similar to yy Ctrl+u is paste, similar to p The difference is hitting Ctrl+k five times will put all those lines into a buffer. And Ctrl+u will paste those five lines. In vim, this is complicated. You could do 'y5' requiring to know/calculate the number of lines in advance. But more often then not you are going into visual mode, selecting everything, then y, then p. T…

Forgive me for misunderstanding the ambiguous comment, both C-k and C-u are associated with multiple cursors in VSCode [0] ;)

I use the following mappings for emacs-ish editing in insert mode:

    " emacs-style editing & motion
    inoremap  
    inoremap  
    inoremap  
    inoremap  
    inoremap  
    inoremap  
    inoremap  
    inoremap  de
    inoremap  D
    inoremap  
    inoremap  
    
    " restore support for digraphs to M-k
    inoremap  
`C-k` doesn't append to a "kill ring", but you could probably accomplish that with something like

    inoremap  "Kdd
    inoremap   "Kp:let @k=""
Or if you want it in normal mode rather than insert mode:

    nnoremap  "Kdd
    nnoremap   "Kp:let @k=""
Edit: This is the closest behavior I could get to how nano seems to do it:

    let @k=""
    let @l=""
    nnoremap   "ldd:let @k=@k.@l \| let @l=@k
    nnoremap   :if @l != "" \| let @k=@l \| end"KgP:let @l=@k:let @k=""

The bigger point I'd like to make is that it's a bit silly to complain about vim's default behavior not being as you'd like it. This is the beauty of vim (and emacs): it's a solid foundation upon which to build your ideal workflow. Few people find vim's defaults to be entirely satisfactory, but with a bit of creativity, you can make just about anything happen (and luckily, thanks to many thousands of plugin developers, you can probably find it ready-made).

[0]: https://stackoverflow.com/a/29953572/947478

Re: GNU nano is my editor of choice

#145
I admire the author's straight-up owning her choice here, in spite of the elitism that's long fueled the whole "lol you use nano!?" douchebaggery.

Perhaps worth a chuckle: I once interviewed on-site somewhere, panelist-style format with "the team" hitting me with questions all around. One of them asked about my preferred editor. I mentioned some GUI editor I was using back then (don't remember now, it's changed over the years). He laughed and said something like, "what, you!? YOU use a GUI editor, not vim!? C'mon man! You're better than that!" So I fired right back at him, jokingly: "Dude, it's an editor. Not a religion. I ain't down the the jihad, bro!"

Fact is, you can be productive in just about any editor as long as you know how to use it right.

If vim/emacs is your jam, fantastic, you have fun with that. You can brag about "productivity" all you want, but there are - demonstrably - other people out there who don't do it your way and they're equally productive, and in some cases better. Productivity isn't measured in keystrokes per second. What matters is what gets DONE.

The elitist attitude that anyone not using emacs/vim is "fail" or "noob" is just plain stupid. All that does is demonstrate that you value your own ego over the success of your team, and that you might derive pleasure from putting other people down, a significant mental health problem. It also forces people to raise their guard around you, and erodes their trust in you, especially if that attitude is reinforced in other ways. I'm not saying you can't joke around with people, and it would be short-sighted and foolish to draw any final or major conclusions on ONE thing like this alone, but if someone sincerely pulls this elitist BS on you, you'd be a fool not to raise your guard, to some degree, around that person from then on.

Re: GNU nano is my editor of choice

#146

Obligatory XKCD: https://xkcd.com/378/ "nano? Real programmers use emacs." "Hey. Real programmers use vim." Personally I use TextWrangler (BBEdit) for fun, and VS Code at work. I know how to exit vi though! "Q. How do you generate a random string? A. Put a Windows user in front of vi editor and ask him to exit." https://www.reddit.com/r/ProgrammerHumor/comments/72y7lr/q_h...

Do you write code in BBEdit? VS Code feels way more capable, at least at first glance, but I know BBEdit fans have a lot of love for it.

I ask because I'm growing a little tired of VS Code. It works nicely, but it never feels like a native editor. BBEdit, and Panic's Nova, feel like I'm actually using a Mac. I'm trying to decide if either of those are better than (or at least as good as) VS Code.

Re: GNU nano is my editor of choice

#147
post #37
post #6

The thesis of this post is roughly that nano, when configured, is enough of an editor for the author. Which is totally fine! People should be happy with their tools and not feel pressured by popularity to use what others use (vim, emacs being prime competitors in this case). Alas, nano (and pico before it) have a certain stigma among more "experienced" Unix users that more or less boils down to gatekeeping and snobbe…

The thing about that “snobbery and gate keeping” is that it’s not at all that. Maybe not everyone’s experience mimics mine but I felt like people looked down at me a bit when I was 16 for using nano on the command line. But, and here’s the kicker, if I hadnt been pushed into vim I would not be nearly as productive now. There have been countless times in my career as a sysadmin/devops/SRE where I’ve been stuck with ho…

When I was coming up, Solaris was as popular as Linux at the time. There was no option to install nano on production machines for Solaris. It was vi or find a new job.

Re: GNU nano is my editor of choice

#148
post #45
post #32

Earlier quoted context omitted.

this is less true these days w/ slim docker images that don't include any editors by default

Doesn’t POSIX designate vi as a requirement? https://ieeexplore.ieee.org/document/6880751

vi is specified by POSIX, but (at least currently) it's marked as a User Portability Utilities (UP) extension, which is optional. It is required for XSI conformance, which mandates other extensions like C-Language Development Utilities (CD). But XSI itself is mostly legacy SysV stuff; the more widely supported parts were rolled into POSIX proper and either made a requirement or grouped into their own optional extension.

In general, most utilities and functions primarily used interactively are optional in POSIX.

Re: GNU nano is my editor of choice

#150

Earlier quoted context omitted.

for me personally I noticed that using an IDE started to replace my memory in a way and I didn't like it. I noticed that when I program in languages with an IDE environment (Java in my case) I only really slowly picked up what functions were available in a libraries and I started to really dislike this reliance on constantly looking up things. When I just program without autocomplete or for that matter constantly goo…

To be fair my memory has always been terrible. I loathed times tables at school. I still don't really know them. I just feel like if I need to know I'll use a calculator and if there isn't one available I'll have other problems like clean water and food! Having a general sense of 'size of' numbers was enough and I'm pretty good at maths. I get that it impedes memorization but how does that scale to using new librarie…

>but how does that scale to using new libraries which may lack documentation?

it doesn't really that well which I guess is a drawback. I'm not dogmatic about it so what I usually do with a new larger codebase is I just open it in vscode, read around somewhat, look at the symbols and use that for a while and then when I'm kind of familiar with it I go back to emacs.

>I'm jealous of your memorization

it's was actually very difficult in the beginning and one of the reasons I started doing is because I noticed just how bad my memory and attention had gotten without tools. Even with other things, as a kid I could read for five hours straight and a few years ago I noticed I couldn't read for 30 minutes without distraction.

Post reply on HN