43

Ok, I realise that I risk a religious war asking a question about text editors, but here goes.

Requirements

  • Mostly used for config file edits
  • Text based not GUI
  • Available for Raspian flavour of Debian
  • No learning required for a Windows/Mac GUI user (no vi/vim)
  • Makes full use of keys found on modern keyboards, i.e. home, end, pgup, pgdn, del
  • Use keyboard shortcuts found in pretty much all GUI apps, e.g. Undo (Ctrl-Z), Redo (Shift-Ctrl-Z), Select All (Ctrl-A), Cut (Ctrl-X), Copy (Ctrl-C), Paste (Ctrl-V), Expand selection (Shift-Arrow), Skip word (Ctrl-Arrow), Delete selection (Del) etc
  • Optional: mouse support for changing cursor position and selecting text

Surely this isn't a big ask in this day and age?

8
  • 2
    "No learning required" sounds like an unusually restrictive (and possibly unrealistic) criterion especially as you are asking for a CLI tool...
    – jasonwryan
    Oct 3, 2012 at 20:02
  • 1
    nano would be close. It wont have the exact same shortcuts but similar shortcuts to do the same operation. or you can create .nanorc and have custom shortcuts
    – h3rrmiller
    Oct 3, 2012 at 20:02
  • 4
    @jasonwryan As an experienced Windows (or Mac) user, I already have the learning required to use a modern text editor using only the keyboard. I'd like to use that same experience in a Linux CLI tool.
    – Greg Woods
    Oct 3, 2012 at 20:10
  • 3
    The shortcuts you're expecting are Microsoft's modifications on IBM's CUA guidelines. Neither CUA nor MS's modifications are traditional in the unix world. Oct 3, 2012 at 22:56
  • 7
    @Gilles I'm not entirely sure I agree with calling those shortcuts "Windows" shortcuts. Every common GUI application that does text editing uses those shortcuts on all the major platforms. Many of those shortcuts predate Windows as well.
    – jw013
    Oct 4, 2012 at 14:25

17 Answers 17

21

Try Micro.

https://github.com/zyedidia/micro

Micro is a terminal-based text editor that aims to be easy to use and intuitive, while also taking advantage of the full capabilities of modern terminals. It comes as one single, batteries-included, static binary with no dependencies, and you can download and use it right now.

As the name indicates, micro aims to be somewhat of a successor to the nano editor by being easy to install and use in a pinch, but micro also aims to be enjoyable to use full time, whether you work in the terminal because you prefer it (like me), or because you need to (over ssh).

Screenshots & colorschemes

It's just about perfect. Shift-arrow selection works perfectly. Control-C (cut), Control-V (paste), Control-Z (undo), Control-S (save) all work as expected. It also indents and unindents selections perfectly.

You need a terminal emulator that properly supports the shift key. Terminator works fine out of the box. Some Android-based terminals do not support shift-selection, but JuiceSSH (most popular in Google Play) works, though I haven't extensively tested it yet.

5
  • 3
    And excellent mouse support, and beautiful syntax highlighting.
    – PJ Brunet
    Dec 16, 2016 at 7:49
  • This is probably the most "modern", as evidenced by the default color scheme and choice of supported languages. However, the keybindings differ significantly from something like Sublime, it's a PIA to change them, and many keyboard shortcuts are simply not supported. Jan 3, 2017 at 14:31
  • Sorry to nitpick, but for actual Windows-like shortcuts (mostly ctrl+arrowkeys) you need to add a few key bindings yourself: github.com/zyedidia/micro/issues/1142
    – phil294
    Apr 13, 2021 at 18:34
  • Best of the best! Thank you! If you access console from PUTTY, forget it. With PUTTY you cannot work with Shift-Arrows. Try KITTY (it is a fork). If you don't want to use KITTY, then you can use mouse(!) instead of Shift-Arrows in PUTTY.
    – Chameleon
    May 17, 2021 at 22:40
  • How nice was that! I just did my edit without thinking, long term Wordstar/Windows user. Thanks you
    – hum3
    Oct 16, 2021 at 14:57
15

I have tried all of the above solutions (except the ones that are obviously stupid, like emacs or vi configurations).

The best overall is tilde. Truly made to order to answer the original question posed by Greg Woods. It should be added to all the standard linux repositories.

As a long time nano user, who found his way here looking for something equally simple with a real undo/redo buffer and standard GUI editor key bindings, I heartily recommend the Sanos editor. It is tiny and does just what the original query demands. Its sole defect is there is no mouse support for placing the cursor. It is my new favorite minimal editor, and nano is going into the dustbin. You do have to compile it, but it is a trivial program to compile - a single C language source file. I compiled it to "sane" for "sanos editor" (sanos is actually a mini-os).

And now, to reiterate the question, which most replies and votes seem to ignore: the request is for a dead simple basic editor that just works and uses the standard GUI bindings (which, by the way, do not belong to Windows).

The two I recommend, and fte, are the only ones that fill the bill, and fte is too quirky in an xterm.

6
  • I compiled sanos but shift+arrow keys not working, also shift works for letter capitalisation, I m using putty for ssh
    – BioHazard
    Dec 25, 2015 at 15:55
  • This is the best answer imho. I tried both, and Shift+Arrows for selection and Ctrl+C Ctrl+V etc works in both. I had to disable conflicting keyboard shortcuts in the terminal emulator though like Shift+Up for scrolling back one line.
    – SoleSoul
    Jan 23, 2016 at 16:10
  • The interesting thing is the Sanos editor is only ~2000 lines of code, has Control-Z undo, shift-select, handles tabs well. It seems the unindent() function has a bug though. I think this would be a great starting point to build a more powerful editor.
    – PJ Brunet
    Dec 14, 2016 at 1:09
  • my god. thank you for that. tried tilde for 20 second and said "yepp, this is what I want!" cheers! Nov 9, 2019 at 18:54
  • what's the advantage of tilde over micro?
    – user313032
    Nov 30, 2021 at 23:38
9

Long story short: Use nano

You can easily customize nano to fit your requirements, especially regarding your desired keyboard shortcuts. To do so, have a look at the bind parameter which you can set in your local ~/.nanorc file. Of course, you can also download ready-made config files (see below).

You can bind key combinations modeled on Ctrl+ with a preceding ^ and Alt+ with M- ("Meta"). Unfortunately, there seems to be no way to bind combinations containing the Shift key. The nano defaults to skip wordwise are Ctrl+Space and Meta+Space. And as if that wasn't enough, you can't bind arrow keys neither. But maybe you can live with these drawbacks.

Because take a look at the bright side: As a matter of fact, there is a package on github, mostly containing improved syntax highlighting, but also coming with almost all of your desired keybindings. Install it by calling make, but be aware that your current ~/.nanorc will be overwritten during the process.

I think you should give it a try, even though that Shift+Arrow selecting seems to be one of your highest priorities. In nano, you would use Ctrl+A to initiate selection mode, so you don't even have to keep Shift pushed down all the time! And you can always use the Ctrl+Shift+X etc. shortcuts that your terminal provides. As you might have recognized, I am quite happy with nano, possibly partly due to being a former Windows user.


Edit: Here's a screenshot showing some of the pertinent key bindings in the bottom help bar.

Nano editor equipped with github.com/craigbarnes/nanorc settings package

0
9

joe is, IMO, the best of the editors-that-aren't-vi. It's a decent full-featured editor in its own right, rather than a stripped down featureless minimal editor like nano.

If invoked as jstar or joe, the default key-bindings are WordStar-like which have also been used in many other programs over the years, including the editor in the Borland Turbo Pascal & Turbo C IDEs, so should be familiar to many users. If invoked as jmac the key-bindings are emacs-like. The key-bindings are configurable and if you can't find a configuration that exactly suits you, you can add one yourself or copy-and-modify an existing one.

I'm too much of a vi user to use it myself, but I frequently recommend it to people who don't like or want to learn a modal editor like vi, with good results.

Here's the description in the debian package:

Joe, or Joe's Own Editor, has the feel of most PC text editors: the key sequences are reminiscent of WordStar and Turbo C editors, but the feature set is much larger than of those. Joe has all of the features a Unix user should expect: full use of termcap/terminfo, complete VI-style Unix integration, a powerful configuration file, and regular expression search system. It also has six help reference cards which are always available, and an intuitive, simple, and well thought-out user interface.

Joe has a great screen update optimization algorithm, multiple windows (through/between which you can scroll) and lacks the confusing notion of named buffers. It has command history, TAB expansion in file selection menus, undo and redo functions, (un)indenting and paragraph formatting, filtering highlighted blocks through any external Unix command, editing a pipe into or out of a command, and block move, copy, delete or filter.

Through simple QEdit-style configuration files, Joe can be set up to emulate editors such as Pico and Emacs, along with a complete imitation of WordStar, and a restricted mode version (lets you edit only the files specified on the command line). Joe also has a deferred screen update to handle typeahead, and it ensures that deferral is not bypassed by tty buffering. It's usable even at 2400 baud, and it will work on any kind of sane terminal.

It is, AFAIK, packaged for all distros, and source is available at http://joe-editor.sourceforge.net/ - the debianised source should compile on Raspian if there isn't already a binary package.

5
  • 1
    Thanks for suggestion. It may be useful to someone, but I never liked the Wordstar style shortcuts. I may reconsider when I need a more feature rich editor.
    – Greg Woods
    Oct 5, 2012 at 7:59
  • 14
    -1: Joe's keyboard shortcuts seem to be just as "unorthodox" as vim's or nano's. For example, CTRL+A doesn't 'select all', CTL+F doesn't 'find'.
    – Garrett
    Aug 28, 2015 at 21:08
  • I have used Joe since 1994, and I don't think this is the best answer to the question, although Joe is relatively easy compared to Vim. I noticed Joe is missing from some distros now, but you can easily get "Jupp" (based on Joe) with yum or apt-get. Jupp does have SHIFT-selection. Cut and paste is a little weird with Jupp, but it's easy to learn, Control-J for help.
    – PJ Brunet
    Dec 14, 2016 at 1:00
  • 3
    Sorry, but does this really answer the question? joe is just as difficult to exit from as vim, and Windows hotkeys don't work.
    – mafu
    Jan 12, 2017 at 14:28
  • I was brought back to this answer by an upvote. As Gilles pointed out in his answer, there are CUA keybindings available for joe.
    – cas
    Mar 13, 2017 at 12:57
8

Try the FTE Text Editor. There are multiple versions available; the one you want is probably sfte which is in Debian's fte-terminal package.

enter image description here

7
  • A nice suggestion, but just trying a Shift+DownArrow to select text caused a load of 'FIXME' messages corrupting the screen. The shortcuts are straight from the eighties... Ctrl-Ins for copy? Alt-Backspace for Undo? Some of the options are pure linux geek: "Copy - Append"? I shouldn't have to read the manual for a Copy command! On the plus side I liked the directory browser when you start up.
    – Greg Woods
    Oct 3, 2012 at 21:23
  • 1
    Weird. The first thing I tried was Shift+DownArrow to select text, followed by Ctrl-C and Ctrl-V to copy and paste, since I figured that's what you'd try too. They all worked for me.
    – Jim Paris
    Oct 3, 2012 at 23:31
  • Hmm. Odd. I was in the terminal version which I obtained with sudo apt-get install fte-terminal. I'll give it another go when I have a few minutes.
    – Greg Woods
    Oct 4, 2012 at 21:20
  • 1
    Same here. Maybe it depends on the terminal emulator in use; mine is xterm.
    – Jim Paris
    Oct 5, 2012 at 1:23
  • that makes sense, because Diakonos didn't work properly either. I'll have to look through the options available in PuTTY
    – Greg Woods
    Oct 5, 2012 at 7:53
6

Cream is a configuration of vim that is modeless and which uses all the keyboard shortcuts like Ctrl+X, Ctrl+V that you might expect.

Unlike Vim it isn't alien to people used to Windows GUI applications like Notepad. If you can use Notepad you can use Cream.

  • Can be used for config file edits
  • Text based as well as GUI
  • Available for Raspian flavour of Debian
  • No learning required for a Windows/Mac GUI user
  • Makes full use of keys found on modern keyboards, i.e. home, end, pgup, pgdn, del
  • Use keyboard shortcuts found in pretty much all GUI apps, e.g. Undo (Ctrl-Z), Redo (Shift-Ctrl-Z), Select All (Ctrl-A), Cut (Ctrl-X), Copy (Ctrl-C), Paste (Ctrl-V), Expand selection (Shift-Arrow), Skip word (Ctrl-Arrow), Delete selection (Del) etc
  • Mouse support for changing cursor position and selecting text
4
  • Took me a while to find it, cream -v gets you into the text mode, and F12 gets you a menu.
    – PJ Brunet
    Dec 14, 2016 at 5:43
  • It does not look like you can run cream in a terminal environment. Raspbian version says Sorry. 'cream' can only be run in an X environment. and the source binary runs gvim at its core.
    – phil294
    Apr 13, 2021 at 19:44
  • Ok, so turns out that if you replace gvim with vim, it seems to work alright.
    – phil294
    Apr 13, 2021 at 20:16
  • hmm 36MB for a text editor? Feb 4 at 14:15
4

Emacs comes with a CUA bindings mode. Add the line

(cua-mode 1)

to your ~/.emacs.

Joe is a small-to-medium text-mode editor with configurable keybindings. There is a set of CUA bindings (not in the standard distribution, I think, so install them in your home directory).

1
3

Diakonos also conforms to most of the requirements:

Frustrated by those other console editors? You already know what keys to press in your GUI applications to open, save, copy, cut, paste and undo. Why should your console text editor behave differently? Answer: it shouldn't.

Welcome to Diakonos, the console text editor with a key mapping you practically already know. Easy to use and easy to configure, but potent in the hands of power users.

Debian package exists, I have no information about that requested flavor.

1
  • Thanks for the suggestion. I could apt-get in Raspian. Still can't shift-select and other functions. But as @jim-paris suggested, it's likely a terminal emulator problem.
    – Greg Woods
    Oct 5, 2012 at 7:55
3

This is exactly why we at e10labs wrote CTE, you'll love this. https://cte.e10labs.com

Details:

Cᴛᴇ is a text editor for the Unix terminal, like nano and vi, but is better as there is no learning curve. It behaves like a modern application with mouse, menus and dialog boxes. This makes it like Linux Gedit, Kate, a web browser, Microsoft Notepad or Word. For example: To find some text one presses Ctrl-F and a dialog box appears.

Cᴛᴇ is distributed as a single binary, ready to run, with no dependencies, or a .deb or .rpm with the same.

https://cte.e10labs.com/

CTE screenshot

2
  • This is pretty interesting. Never heard of this before. Although, the keybinding does look like the one of nano (aside from the search keys, and maybe some other ones). Mar 25, 2021 at 19:41
  • Click on the menus to see most of the key bindings, they are standard, e.g. Ctrl-S to save; unrelated to nano. We have added indenting, that behaves as one expects in cte v3.1; we think this makes cte the best, tilde configures the tab width which is a mistake [tabs are always 8 wide], the indent width is separate, enjoy. cte.e10labs.com
    – E10Labs
    Apr 28, 2021 at 3:32
2

Have a look at the Sanos editor:

http://www.jbox.dk/sanos/editor.htm

Only a 28k binary can do what all those other editors try to -- and fail.

It does exactly what the OP asked for:

Shift+arrows to highlight text

Ctrl-X,C,V for cut/copy/paste

You can also have several open files simultaneously, and "pipe" commands into it. For example, press Ctrl-P and at the prompt enter:

cat yourfile

and it will insert yourfile at the position of the cursor. This way the full power of the bash commands are at your disposal ( use grep to get only specific parts of the file inserted ).

2

The following has been tested using nano from a terminal in MS-Windows.
It will get your nano one step closer supporting the "universal" shortcuts for copy/cut/paste etc. (at least in the Windows world).
Add these lines to the nano configfile /etc/nanorc

bind ^c copy main
bind ^v paste all
bind ^x cut main
bind ^z undo main
bind ^y redo main
bind ^f whereis main
bind F3 findnext main
bind ^h replace main
set zap
set tabsize 4
#set linenumbers

Notes:

  • set zap will change the behavior of DELETE and BACKSPACE to what a normal windows user expect i.e. the selected text will be deleted, which is not the default behavior.
  • copy and cut behave rather strange. If you haven't selected any text it will copy/cut the whole line!
  • If your nano version is < 3.00 then you have to use copytext instead of copy and uncut instead of paste. RHELish distros (RHEL, CentOS, Oracle Linux) still use the old version (as per 20 september 2020).

If you have issues selecting text in nano with shift+arrow-keys then be aware this doesn't seem to be related to nano but your terminal program.
In my case it didn't work in PuTTY, but it did work in Kitty (a fork of PuTTY, Windows-version / Linux-version).

2

mcedit is the best editor. At least will send you to 90s with the UI. Enables SHIFT-arrows selection on some terminals, very Norton Commander interface, Fx keys, CtrlO to see the shell. Remembers the position when coming back, recognizes highlighting even for unlikely files (without extension). Unfortunately its clipboard is internal, which is highly confusing. That mean you will end up in three way selection: CtrlC + CtrlIns + CtrlShiftIns (terminals own copy).

Another solution is to keep shell open in far2l. Far Manager for Linux. Its editor has flagship DOS/Windows quality: character + word + page + EOF movement and horizontal/vertical non/persistent selection. Utilizing every possible combination of keyboard modifiers and arrows. Classic natural hyperproductivity.

1
  • In 2021, and with a decent terminal emulator, shift-arrows work for me in mcedit. Also, ctrl-c, ctrl-x, ctrl-v, ctrl-z, ctrl-y and mouse control (selection) can be configured to work like in GUI applications.
    – korkman
    May 6, 2021 at 18:10
1

The answer is kitty+tilde (KiTTY is a fork from version 0.66 of PuTTY) guys ! My whole life has been a lie : D

http://www.9bis.net/kitty/?page=Download

It has fixed shift+arrow keys bug delivered with putty (also shift+arrow keys was not working in other ssh clients)

2
  • It seems at least a part of the problem does come from the terminal, so i'll look forward to trying this out.
    – Greg Woods
    Dec 28, 2015 at 20:48
  • Did you try it yet?
    – pabrams
    May 24 at 5:19
0

Le is another solution. It is like Norton Commander ( of Midnight Commander fame ) but perhaps more intuitive.

In MC you press F3 to begin and end region selection, then use F5 or F6 to copy or move it. On le F5 begins selection and if you move forward, F6 will end it. If you move forward past a previous selection, F6 will add everything up to it, or if you move backward and press F5 everything up to it will be added. So you can use F5 or F6 as it if it were F3 in MC. If you press F5 and move backwards and press it again it selects that region. If you press F6 and move forward and press it again it selects that region.

To install use:

apt-get install le

or download the source and build ( I've tested it on Debian sid ):

http://lav.yar.ru/download/le/le-1.14.9.tar.gz

Here's the Debian package: http://packages.debian.org/sid/le

0

I have tried Nano, Joe, Pico etc. While they are easier than Emacs or Vi[m], they all have weird, idiosyncratic UIs unlike any other program since the 1980s.

But there are modern, CUA-compliant editors for Linux out there!

Someone recommended FTE. It is long-unmaintained, but there is a current fork called eFTE: http://sourceforge.net/projects/efte/

It's pretty good; for instance, it is able to trap the Alt key for menu access even when running in an X terminal-emulator window.

There is another one that I rather like as well, called Tilde, which is currently maintained and has recent packages available. http://os.ghalkes.nl/tilde/

1
  • 1
    Tilde editor should be the right answer. This editor is really good!
    – user114395
    May 6, 2015 at 19:27
0

Recently came across MinEd [http://towo.net/mined/]

# Option "emul": emulation mode, especially control key function mapping; 
# takes a single-letter value: 
# e: emacs mode 
# s: WordStar mode 
# w: Windows keyboard mode 
# W: Windows behaviour (-w, CRLF for new files, cmd.exe with ESC !) 
# p: pico mode 
# m: mined default 
#emul m
1
  • Apparently it's in Debian testing and has mouse support, but I haven't tried it yet.
    – PJ Brunet
    Dec 13, 2016 at 20:39
0

Fiflo is the minimalistic solution. Supported keyboard shortcuts: Ctrl+Arrows Ctrl+Backslash Ctrl+D Ctrl+O Ctrl+Q Ctrl+O Ctrl+F1-F4.

I use it because I don't have time to open the etc/nanorc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.