Live data from Hacker News

GNU nano is my editor of choice

ariadne.space

61–70 of 236 posts

Re: GNU nano is my editor of choice

#61

no matter what you editor you use, set EDITOR to whatever you want, then when you want to edit files as root do `sudo -e /path/to/file` thanks me later

How is it better than `sudo vi /path/to/file`?

`sudo vi` runs vi as root, which means 1) it won't have your users configurations, and 2) it's probably way the hell over-privileged for what you are trying to do.

`sudoedit` (and equivalently `sudo -e`) makes a copy of the file that you can edit and then copies it back as root iff it's changed.

Re: GNU nano is my editor of choice

#62
post #25

Earlier quoted context omitted.

It’s not really gatekeeping or snobbery to say that knowing vim is more useful simply because I can log into any Linux machine on the planet and edit a text file without having to install an editor.

Every Unix machine (Mac or Linux) that I've ever tried to use nano on has had it preinstalled. I'm sure not all of them have it preinstalled, but it's common at least in mainstream distros

In the late aughts, I found myself at the keyboard of a Solaris system that only had ed. I was there to get the network configured and it didn't have an optical drive, so there was no way but forward.

More recently, I've found myself inside a container which didn't have any editors. I got the job done with echo, head and tail. Delightful.

Re: GNU nano is my editor of choice

#63
post #43

I think I'm getting enough of these editor posts. It's just a tool and I'd rather see more language war posts.

Aren't languages just tools, too?

Yeah, that's the point. Since they are both tools, I'd rather see more tool war posts regarding languages. At least people will quickly deviate to language theory or quirks in languages so that we can learn a lot.

Re: GNU nano is my editor of choice

#64
post #30

Earlier quoted context omitted.

As much as we all enjoy low effort posts, there are a number of shortcuts to move around, as well as the general "find" option. https://www.nano-editor.org/dist/latest/cheatsheet.html

If we're gonna learn a stack of key combo shortcuts, why not go with a editor that was designed with that in mind (i.e. key combos organized into a hierarchy rather than a huge flat mess)?

Note: I'm not saying nano is perfect but these are some nice features.

The key bindings are at the bottom of the screen.

Example: https://imgur.com/tFVNFc4

^ is CNTRL.

> why not go with a editor that was designed with that in mind (i.e. key combos organized into a hierarchy rather than a huge flat mess)?

Nano has a tree-like structure. There are a a few root commands for common things but a menu like "replace" has these options shown: https://imgur.com/5IKRyeC

In this screen you can see "M" which means the ALT key. These names (^, M) are not ideal but they have their roots in the originally common teletype names (control, meta). It's not the best but it's easy once you remember those two things since you need to remember nothing else.

An important note about these menus: they remember your previous insert. If you click the up arrow key you can go back in time to previous searches just like your terminal. It's how I could say that 4 searches ago I looked for `affinity_test`.

Also, nano supports all of the standard navigation you will be used to. Things like:

  - Page Up/down: Go up/down an entire page of text.
  - Arrows: Navigate text one character/line at a time.
  - Scroll Wheel: Move cursor up/down for each input. 
  - ctl + left/right arrow: Move one "word".
  - Home / End keys: beginning and end of line.
So, the things you already know from all other programs directly apply. The things that aren't the same that you will use are at the bottom of the screen or behind a "CNTRL+G" menu that is at the bottom of the screen. All for giving up ~3 vertical lines of text. I just checked and at my default font size I can fit 57 lines on my monitor so I'm giving up 5% of my screen so anyone, regardless of skill level, can sit down at my computer and know how to operate the text editor.

Re: GNU nano is my editor of choice

#65
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…

I'm glad for nano users because the popularity of their editor probably won't ever mean stuff that won't work with mine.

Re: GNU nano is my editor of choice

#66
post #4

I've been a really big fan of Micro[1]. A single binary with excellent out of the box features. Mouse mode, syntax highlighting, tabs etc [1] https://github.com/zyedidia/micro

but are there vim keybindings?

From the faq.

Does micro support Vi keybindings?

Currently micro does not have any sort of Vim emulation. However, this is the next major feature that is planned, so stay tuned.

Re: GNU nano is my editor of choice

#67

So I have a question and I'd like to understand if possible. To me programming isn't text editing. Granted, we use text to write most code outside of say Pike but effectively most programming is working with symbols right? Like .subst is meaningless as an operation on a string but .substring(0, 1) is meaningful. So I don't really get the advantage of such, to my mind, rudimentary text editors. At a minimum surely bei…

The advantage is you don't become dependent on an IDE. Ever seen someone who can't write anything without all the IDE aids to fill in code for them?

when do you ever not have one? work isn’t like camping or something. you always have your computer

Re: GNU nano is my editor of choice

#68
post #25

Earlier quoted context omitted.

It’s not really gatekeeping or snobbery to say that knowing vim is more useful simply because I can log into any Linux machine on the planet and edit a text file without having to install an editor.

Every Unix machine (Mac or Linux) that I've ever tried to use nano on has had it preinstalled. I'm sure not all of them have it preinstalled, but it's common at least in mainstream distros

Most non-copyleft (permissive free software and proprietary software) tries to stay as far away as possible from the GPLv3 license. Because of this, macOS ships gnu nano 2.0.6 whereas the latest is 5.8. FreeBSD doesn't even have nano installed by default.

Re: GNU nano is my editor of choice

#69

So I have a question and I'd like to understand if possible. To me programming isn't text editing. Granted, we use text to write most code outside of say Pike but effectively most programming is working with symbols right? Like .subst is meaningless as an operation on a string but .substring(0, 1) is meaningful. So I don't really get the advantage of such, to my mind, rudimentary text editors. At a minimum surely bei…

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 libraries which may lack documentation? I'm jealous of your memorization of those string methods, every time I switch to JavaScript I feel lost because I don't recall substr Vs subString Vs substring etc!

Post reply on HN