DEV Community

Ryan Westlund
Ryan Westlund

Posted on

Persuade me to switch away from Nano?

I've been a happy user of Nano since pretty much my introduction to Linux. People have told me for years that Nano's primitive and I should be using Vim or Emacs or something else fancy schmancy. I haven't paid them much heed for most of that time, and wrote Nano Is A Good Editor to explain why I've been so satisfied with Nano.

And believe me, I specifically went looking for articles or videos explaining why other editors are better than Nano. And in pretty much every case, the anti-Nano evangelists proved that they just don't know anything about Nano. If I ask you to tell me what Vim offers that Nano doesn't, and the first five things you list are things Nano has, then no thanks, I'll just stick with Nano.

But more recently, I did a little more searching and counted the number of things I miss with Nano. There are a lot. Most of them are very small, but together, they're enough that I might be convinced to switch... if someone convinces me that another provides a few of these improvements without adding any major downsides.

Here's the full list of things I'd like to see in an editor that Nano doesn't have (yet):

  • PCRE

  • Bracket highlighting

  • Saved macros

  • Change all (or most) config settings from inside an editor instance

  • Cursor bookmarks

Things Nano has that I absolutely must keep:

  • Modeless

  • Runs in a terminal (being able to open in a window wouldn't be bad, but I need it to be able to run in a terminal)

  • Various efficient navigation/editing hotkeys: move by word, delete word (forward or backward), smart home, cut line, indent/unindent selection, goto matching bracket, smooth scrolling, scroll the window without moving the cursor, etc.

  • Softwrap

  • Search/replace history

  • Something like Nano's statusbar with constantshow (shows your current line number, number of lines in the file, current column, columns in the line, current character position in file, number of characters in the file, and the percentage of all of these)

  • I should be able to save, switch buffers, or open a new file in a new buffer with a quick hotkey. It's okay if some of this stuff requires some config (even Nano requires a tiny bit), but good defaults speak volumes about a program.

The main reason I don't want to use Vim is because it's modal. That's not negotiable. And I don't want to use Emacs because I've heard it's also an email client, a web browser, and I've even heard some people say Emacs is an operating system. Basically, Emacs sounds like a bloatware "one program that does everything", and I'm staunchly opposed to that idea.

There are also some things people mention that might sound badass, but don't really matter to me. For example, git integration. One Vim evangelist told me you could get a plugin for Vim that would let you see the current git diff lines highlighted in the editor. Okay, wow. But how important is that? Is it so intolerable to run git diff (gtd with my alias) in a separate terminal window? I'm sure I'd probably end up using it occasionally, but it makes me uncomfortable about the design philosophy.

In general I've never been a fan of "integration" between programs or "plugins". Someone says those words and what I hear is "programs with unrelated purposes tied together" and "battallations of special cases instead of elegant design that makes them unnecessary".

Another example is the myriad of special cased move/edit commands in Vim. People tell me Vim is great because there are commands to replace a character, replace a word, delete a word, but none of those save me a single keystroke (maybe 1 in some cases) over normal stuff like ctrl-arrows and ctrl-delete that I mentioned earlier.

To be fair, some of those hotkeys mentioned (like o and O and delete-enclosure) would be somewhat helpful, but very, very minor.

Discussion (6)

riidom profile image

I onced needed to edit some file on the server at work. I never used one of the pre-installed editors on the server before (I don't quite remember, it was nano, vi or vim and something else I forgot).

I googled them and from the manuals/cheatsheets I found, nano was definitely the easiest one, if you start from 0%. Still it was a rough and extremely weird ride, and I was kinda reliefed as I was done.

So yea, that's my nano story :)

vonheikemen profile image

This sounds like a job for micro.

These are some of the features they list in their github repository.

  • No dependencies or external files are needed — just a binary
  • Multiple cursors.
  • Common keybindings (Ctrl+S, Ctrl+C, Ctrl+V, Ctrl+Z, …).
    • Keybindings can be rebound to your liking.
  • Sane defaults.
    • You shouldn't have to configure much out of the box (and it is extremely easy to configure).
  • nano-like menu to help you remember the keybindings.
  • Extremely good mouse support.
    • This means mouse dragging to create a selection, double click to select by word, and triple click to select by line.
  • Copy and paste with the system clipboard.
  • Small and simple.
  • Easily configurable.
yujiri8 profile image
Ryan Westlund Author

Thanks! I actually ended up switching.

zilti profile image
Daniel Ziltener

Sounds like Emacs is what you are looking for nonetheless. Emacs isn't bloatware, Emacs is basically a software platform that just so happens to ship with packages that are an editor, a mail client, a few small games, and a package manager.

yujiri8 profile image
Ryan Westlund Author

Well, I'd still rather use an editor that doesn't require me to add a "software platform"...

zilti profile image
Daniel Ziltener

But you don't. That's kinda the thing. By virtue of being mostly implemented in the same language you use to extend and configure it, it is inherently a "software platform". It is a similar approach that is only now picked up again by editors like Atom.