Live data from Hacker News

GNU nano 2.9.0

nano-editor.org

51–60 of 62 posts

Re: GNU nano 2.9.0

#51

Earlier quoted context omitted.

I use nano all the time. 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

This is really cool. I'm sure something similar exists (or could exist) for Emacs and Vim, right?

Emacs has Tramp built-in to allow editing remote files: https://www.gnu.org/software/tramp/

Re: GNU nano 2.9.0

#52

Earlier quoted context omitted.

I think vi is probably more ubiquitous though, especially since it’s included in busybox which powers almost all imbedded Linux hosts. Still a good idea to learn a little vim

>I think vi is probably more ubiquitous though, As I mentioned below, While it may be more ubiquitous, vi isn't present on Debian's live cd, while nano is.

That's odd, considering vi is part of the POSIX specification and all. Many distributions won't come with full vim by default, but most do install a trimmed version of it to fulfil the role of vi.

Re: GNU nano 2.9.0

#54

Nano does what is does very well. Want to quickly modify some some file it is the tool of choice in the way a hammer is the tool to drive a nail. Right tool for the right job.

It depends on your experience, familiarity with the tools, and nature of the change. For example, you might think a single character change would be faster in nano, but that’s not necessarily the case. By the time you’ve moved the cursor using the cursor keys, deleted the old character, and typed the new one, an experienced vi user could well have made the same change faster.

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.

Re: GNU nano 2.9.0

#55
post #18

Earlier quoted context omitted.

It's a simple text editor that's available out of the box in most Unix-like distros these days. So kinda like vi, except I know how to use it (and if I ever forget, it lists all shortcuts on the bottom of the screen anyway).

Actually, the Debian install cd doesn't have vi but does have nano, and vim (and neovim) is larger than nano.

The size argument alone cannot explain nano > vi preferences in d-i.

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.

Re: GNU nano 2.9.0

#57

Nano does what is does very well. Want to quickly modify some some file it is the tool of choice in the way a hammer is the tool to drive a nail. Right tool for the right job.

I dislike using nano because of this: open a narrow terminal and open a file with lines long enough to wrap. Insert a character on the wrapping line. nano will insert a line break, hard-wrapping the line. Probably you can customize this, but I don't want to have to customize an editor so it doesn't break my files.

Re: GNU nano 2.9.0

#58

Nano does what is does very well. Want to quickly modify some some file it is the tool of choice in the way a hammer is the tool to drive a nail. Right tool for the right job.

Learning some basics of vi(m) and using some plugins to enhance it can improve your productivity compared to Nano on the long term (e.g. syntax highlighting with color palettes, linter, tmux support, and what not).

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.

[1] https://www.cheatsheetapp.com/CheatSheet/

Re: GNU nano 2.9.0

#59

Earlier quoted context omitted.

It's simple, it's on every platform I ever SSH into, and it gets the job done quickly?

Exactly this reason. You just know it will always be installed. And I still type "pico".

(Assuming you're using Bash as shell)

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.

Re: GNU nano 2.9.0

#60
post #39
post #36

Earlier quoted context omitted.

It's weird how comfortable familiarity is. I approached vim similarly, I first used pico/nano to modify files here and there but mostly used GUI IDEs or editors. Switched to vim and been using it for 10+ years. 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.

The huge advantage of nano over vi in that scenario, is that nano 1) uses the conventional [i.e. as used by every editor other than vi] arrow key cursor movement and typing behavior without the need to toggle any modes etc, and 2) displays the shortcuts you need for anything else on the screen by default - things like saving, cutting/pasting, searching, and, oh yes, quitting. So, while it might not be optimal for vi…

The arrow keys work in vim too (I don't know about plain vi).
Post reply on HN