Comment by p4bl0

1 year ago

Hi HN!

When I wrote this answer and Kate [1] to the "Leaving Neovim for Zed" link [2] earlier today I wrote a small footnote about the nano text editor:

    I must say here too that nano is actually an underappreciated gem.
    It supports a lot more features than people generally imagine:
    syntax hilighting, line numbering, auto-indent, multi buffers,
    mouse support, keyboard macros, …
    it's actually a decent simple code editor!

The fact is that nano is installed on most Linux systems nowadays since it has replaced vi as the default text editor in most distributions for years now. That means most of us are probably using it quite frequently, possibly without even thinking about it when it is called by default (e.g., when using visudo, or when editing a commit message for a git merge operation on a remote host we SSH'd into), but also some of us may be explicitly using it to edit remote config files, or editing file as root even locally, or maybe even for programing?

I actually do use it to program when I'm live coding in front of my student because I can open it in tmux which allows me to have the same editor on my laptop's screen and on the big display my students see (also it's good for them to see that it is possible even in 2024 to code using simple tools that runs on your own computer rather that editing files on GitHub or wherever…).

Anyway, this lead me to wonder how to showcase and discuss nano's features, and of course what's best than the official documentation of the .nanorc config file? Hence the submitted link to its man page :).

Be sure to not miss the "REBINDING KEYS" section of the man page which lists the various and sometimes quite advanced editing functions most people ignore that nano has!

So, below is my .nanorc file. What does yours look like?

    # editing
    
    set softwrap
    set atblanks
    
    set autoindent
    set trimblanks
    set tabsize 4
    set tabstospaces
    extendsyntax makefile tabgives " "
    
    set cutfromcursor
    set zap

    set smarthome
    
    set nonewlines
    
    # editor
    
    set minibar
    set indicator
    set linenumbers
    set positionlog
    set constantshow
    set stateflags
    
    set mouse
    
    set backup
    set historylog
    
    set multibuffer
    
    # colors
    
    set titlecolor bold,white,latte
    set statuscolor white,latte
    set errorcolor bold,lightwhite,red
    set selectedcolor lightwhite,slate
    set stripecolor ,yellow
    set scrollercolor latte
    set numbercolor latte
    set keycolor latte
    set functioncolor lightblack
    set minicolor bold,white,latte
    set promptcolor bold,white,latte
    
    # key bindings
    
    bind M-/ comment main
    bind M-w copy all

[1] https://news.ycombinator.com/item?id=41284322