nano editor can do this (included with macOS). To get
nano to behave more like a GUI editor, you first enable “mouse support.”
Enable mouse support by adding the
nano -m foob.bar
Execute the following command to make mouse support persistent and you no longer have to add the
-m flag every execution.
echo ‘set mouse’ >> ~/.nanorc
Bonus (unrelated) stuff
There are a few other settings I personally add to make
nano just a bit better.
set autoindent. Automatically indents new lines to the same number of tabs/spaces of the previous line.
set suspend. Allows you to suspend
nano to the background with a ^ Control Z shortcut. Useful if you have go back to the shell to check something
set tabsize 4 Sets the number of spaces to insert when you press the Tab key. Very useful for scripting languages
set const. Puts a cursor position indicator at the bottom of the screen, just above the menu. It’s extremely helpful for finding that exact position you need to be.
To add these settings, you can
echo them in to the file as shown above, or simply use