29

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?

  • 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 '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 3 '12 at 20:02
  • 2
    @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 '12 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. – Gilles Oct 3 '12 at 22:56
  • 4
    @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 '12 at 14:25

13 Answers 13

12

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.

  • 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 1:09
11

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.

  • 2
    And excellent mouse support, and beautiful syntax highlighting. – PJ Brunet Dec 16 '16 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. – Aleksandr Dubinsky Jan 3 '17 at 14:31
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.

  • 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 '12 at 7:59
  • 11
    -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 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 '17 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 '17 at 12:57
7

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

  • 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 '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 3 '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 4 '12 at 21:20
  • 1
    Same here. Maybe it depends on the terminal emulator in use; mine is xterm. – Jim Paris Oct 5 '12 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 '12 at 7:53
6

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

5

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
  • 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 '16 at 5:43
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).

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.

  • 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 '12 at 7:55
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 ).

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/

  • 1
    Tilde editor should be the right answer. This editor is really good! – Francisco de la Peña May 6 '15 at 19:27
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)

  • 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 '15 at 20:48
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

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
  • Apparently it's in Debian testing and has mouse support, but I haven't tried it yet. – PJ Brunet Dec 13 '16 at 20:39

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.