47

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?

Greg Woods
  • 591
  • 1
  • 6
  • 9
  • 2
    "No learning required" sounds like an unusually restrictive (and possibly unrealistic) criterion especially as you are asking for a CLI tool... – jasonwryan Oct 03 '12 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 03 '12 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 03 '12 at 20:10
  • @h3rrmiller Nano is my current choice. I didn't know about .nanorc. It may move nano closer to what I want. Thanks – Greg Woods Oct 03 '12 at 20:14
  • 3
    The shortcuts you're expecting are Microsoft's modifications on IBM's [CUA](http://en.wikipedia.org/wiki/Common_User_Access) guidelines. Neither CUA nor MS's modifications are traditional in the unix world. – Gilles 'SO- stop being evil' Oct 03 '12 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 04 '12 at 14:25
  • @Gilles'SO-stopbeingevil' IBM, CUA, Microsoft, Linux NOT. So, why on X all applications work with Ctrl-C, Ctrl-V? I assume the same key combinations on console editors. – Chameleon May 17 '21 at 22:23
  • @Chameleon Most current Unix windowed applications use relatively recent (1990s+) GUI frameworks that have adopted the Windows shortcuts. Unix console applications mostly trace back their ancestry to the 1970s or 1980s before those shortcuts existed. – Gilles 'SO- stop being evil' May 18 '21 at 07:33

18 Answers18

22

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.

PJ Brunet
  • 733
  • 8
  • 17
  • 3
    And excellent mouse support, and beautiful syntax highlighting. – PJ Brunet Dec 16 '16 at 07: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. – Aleksandr Dubinsky Jan 03 '17 at 14:31
  • Sorry to nitpick, but for actual Windows-like shortcuts (mostly ctrl+arrowkeys) you need to add a few key bindings yourself: https://github.com/zyedidia/micro/issues/1142 – phil294 Apr 13 '21 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 '21 at 22:40
  • 1
    How nice was that! I just did my edit without thinking, long term Wordstar/Windows user. Thanks you – hum3 Oct 16 '21 at 14:57
  • Works well in Termux with the new SHIFT modifier. – Alen Siljak Aug 27 '22 at 18:42
  • micro is great but copy-pasting from a Windows system or from one Linux file to another on SSH is tricky. The only way I found (on the Windows `cmd` terminal) was to [disable micro's mouse support](https://github.com/zyedidia/micro/blob/master/runtime/help/options.md). Then you can copy into the Windows clipboard by selecting with the mouse (not keys) and Right-mouse-click, and paste with Shift + Right-mouse-click from it. Essentially this makes your windows terminal do the copy-pasting, not micro, see [background info](https://github.com/zyedidia/micro/blob/master/runtime/help/copypaste.md). – bass-t Apr 25 '23 at 15:03
  • @bass-t You're right, I just tried it. `ctrl-e` > `set mouse false` > cut from the terminal > `ctrl-e` > `set mouse true` Very easy. I'm guessing you could create a macro to make this more efficient. – PJ Brunet May 31 '23 at 21:21
16

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.

dns
  • 103
  • 3
may2015visitor
  • 169
  • 1
  • 2
  • I compiled sanos but shift+arrow keys not working, also shift works for letter capitalisation, I m using putty for ssh – BioHazard Dec 25 '15 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 '16 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 '16 at 01:09
  • 1
    my god. thank you for that. tried tilde for 20 second and said "yepp, this is what I want!" cheers! – Paul Erlenmeyer Nov 09 '19 at 18:54
  • 1
    what's the advantage of tilde over micro? – user313032 Nov 30 '21 at 23:38
  • I can't find how to install tilde on Amazon Linux – mjaggard Jan 14 '22 at 18:01
10

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

J. Katzwinkel
  • 349
  • 3
  • 5
  • Nano 6.4 can be configured to fulfill all the requirements, except Ctrl+shift+z, the full mouse requirement (you can choose one or the other and switch between them), and expanding the selection. Nano can do shfit+alt+key keyboard shortcuts, but not Ctrl+shift+key. To configure Nano, you just need to read about rebinding keys in Nanorc files and realize that you can use verbatim input in the fashion of macros in your keybindings; they can execute external commands. You can configure Nano to do lots of things that traditional editors can't do, too, and some of the fancy features they can do. – Brōtsyorfuzthrāx Oct 12 '22 at 10:47
9

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

Jim Paris
  • 14,137
  • 5
  • 36
  • 35
  • 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 03 '12 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 03 '12 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 04 '12 at 21:20
  • 1
    Same here. Maybe it depends on the terminal emulator in use; mine is xterm. – Jim Paris Oct 05 '12 at 01: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 05 '12 at 07:53
  • @GregWoods As this either uses or emulates the console framework used by Borland products it is rather reasonable that it looks 90ish. – Thorbjørn Ravn Andersen Feb 02 '16 at 14:29
  • Alt-I and Alt-U to indent and unindent blocks of code. That particular feature ignores tabs, which is kindof a dealbreaker IMO. – PJ Brunet Dec 14 '16 at 01:07
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.

cas
  • 1
  • 7
  • 119
  • 185
  • 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 05 '12 at 07: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 '15 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 '16 at 01: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 '17 at 14:28
  • I was brought back to this answer by an upvote. As Gilles pointed out in his [answer](http://unix.stackexchange.com/a/49829/7696), there are CUA keybindings available for `joe`. – cas Mar 13 '17 at 12:57
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
RedGrittyBrick
  • 2,089
  • 20
  • 22
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).

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
  • 3
    Wow, there's a name for what I'm looking for "Common User Access" http://en.wikipedia.org/wiki/IBM_Common_User_Access Thanks for that! – Greg Woods Oct 04 '12 at 21:25
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.

manatwork
  • 30,549
  • 7
  • 101
  • 91
  • 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 05 '12 at 07: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

E10Labs
  • 31
  • 3
  • 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). – Nordine Lotfi Mar 25 '21 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 '21 at 03:32
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).

MrCalvin
  • 659
  • 7
  • 22
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.

user533385
  • 41
  • 3
  • 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 06 '21 at 18:10
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 ).

ernobe
  • 21
  • 2
1

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/

Liam Proven
  • 310
  • 2
  • 8
  • 2
    Tilde editor should be the right answer. This editor is really good! –  May 06 '15 at 19:27
1

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
go2null
  • 215
  • 2
  • 5
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)

BioHazard
  • 111
  • 2
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.

0

The newest kid on the block - Helix Editor

go2null
  • 215
  • 2
  • 5
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

ernobe
  • 21
  • 2