1

EDIT: rewording to be not "opinion-based" any more.

What command line text editor in the Ubuntu repository has or can be set to allow the following behavior?

  • first key presses do already start text entry.
  • numpad keys are supported.
  • Cursor keys to move in lines and between lines with Ctrl-right/left to move word-wise, and Ctrl-Up/DN to scroll the text up/dn on current position.
  • Shift-cursor keys for marking text (letters,words,lines,multiple lines). Ctrl-Shift-Cursor, Shift-PageUn/Down accordingly
  • Copy and paste with Ctrl-X/C/V
  • Copy and paste with Shift-Del/Shift_Ins
  • Working Ins, Del, Pos1, End, PageUp, PageDn keys like e.g. open office
  • Alt-c to toggle column mode for marking. That is a very advanced function, so maybe optional.
  • Tab key setting need to be definable on how many column it indents
  • Ctrl-S to save

If an editor needs be configured to behave like that, it would help to know if you are aware if someone already tried/achieved something like this.

14
  • 2
    Downvoting without a comment is really lame. @catman nano is the closest thing that I've ever found for command line editing. vi makes me cry. Feb 24, 2017 at 16:40
  • 1
    I believe most people use GUI editors for power user type work, and simply get by with simple cmdline editors for convenience. This of course excludes VI(M).
    – user508889
    Feb 24, 2017 at 16:47
  • 1
    You unfortunately may have to start using vim/emacs, or change your workflow. What you're looking for sits in between what the majority of users are after. Personally, I favor sublime and git. :)
    – user508889
    Feb 24, 2017 at 17:03
  • 1
    If you do choose to go the emacs route, I suggest you break this into separate requests and ask on Emacs about how to configure each of them. As a general rule, if something is possible, emacs can do it but not necessarily easily. once you have it set up just the way you want it though, it's a dream. My point about newbie (your term, not mine) was that CLI editors tend to be powerful and configurable and that is usually mutually exclusive with "easy to use and configure".
    – terdon
    Feb 24, 2017 at 17:06
  • 2
    You can (relatively) easily configure Vim to implement the desired keyboard shortcuts. You can set insertmode in your .vimrc to make Vim behave more like a modeless editor. Note than vim.tiny is not Vim, it is a very stripped-down Vi-compatible subset. To get the real Vim you need to install it.
    – AlexP
    Feb 24, 2017 at 17:12

3 Answers 3

3

It doesn't match all your list, but ne (http://ne.di.unimi.it/) is the closest out of the box. Maybe it can be configured to do everything you want. You will probably have to venture into termcap or your terminal emulator options to get eg. Windows key supported.

1
  • 1
    Wonderful find. It does almost all of the items and offers quite a bit of configuration to modify things. Its modeless, so one does not feel trapped anywhere. Checking my Requirements above, the only thing I am missing is the easy selection by SHIFT-Cursor where it highlights the selection. It uses CTRL-B to start selection, then you move the cursor to the end of the selection (without highlighting) and press e.g. CTRL-C to copy that section. Pasting works with CTRL-V or SHIFT-INS. SHIFT-Del to cut does not work though.
    – CatMan
    Sep 18, 2017 at 21:42
1

I spent quite a bit of time on that issue started from the comments I got. From what I learned, the answer is

None.

This is based on comparing solutions to actually write a new tool.

Background info

The only candidates for modifications are emacs and vim. The effort for emacs would be more than to write an own editor for that spec. Vi would be installed on every Linux box and its configs can do quite a few things. But a solution would need fully to hide multiple mode changes from the user (e.g. for marking) and would terribly mistreat vi's concept.

This is just a note about some basic vi things that helped me a lot to get a clearer outside view on the thing. There is a build in tutorial you start with 'vimtutor'. Should run on every Ubuntu box and teaches you quickly how to use vi. However, it failed to teach me how to best ''work with vi''. I have seen countless tutorials on vi basically all talking about the same. Only this explained with examples why and how working with vi is more efficient: http://www.viemu.com/a-why-vi-vim.html. Most importantly, imho it gets clear why it is a very bad idea to use vi in any other fashion that what it had been designed for. It became clear that vi has been mastered one would use vi also in windows, because its the most superior method to modify text. Its very much as piano: Very flexible and powerful if you are good, but a long way to become good.

The designed-for-use involves

  • never use cursor keys
  • always have both hands at the keyboard.
  • always type with 10 fingers.
  • need to be able to hit any key precisely and without thinking about it
  • most pressed key should be for back from insert modes

What I am not sure if other language keyboard layouts can be used efficiently of if vi users switch to US keyboard layout..

To sum it up, the question can lead to a long and interesting tour through editors. Still I would see the benefit for have a simple common cross-plattform editor on the command line as there are many in GUI, e.g. 'gedit'. Until that I will live with 'nano'. I won't start learning vi before I am proficient with touch typing.

1

This is only to add some feedback to the selected answer from @aegwaegweg.

This editor 'ne' is definitely what I has been looking for all that time. Its 90 perfect, mostly due to technical issues in the terminal. I would say, that everyone who is interested in a consistent usablilty between GUI editors (like gedit or OpenOffice) and the command line editor should use 'ne'.

Installation in Ubuntu

sudo apt install ne

The only notable thing it does not is an intuitive selection of text with Shift-Cursor keys. However, no other editor does that. Instead it uses Ctrl-B to start marking to where ever the cursor moves. That works almost as simple as SHIFT-Cursor and is easy to remember. Only remaining drawback is that technically it seems not possible to highlight the selection block on screen. If that is solved I would score it at 100%!

Beside that it offers a ton of features including syntax highlighting and macro recording and whatsoever, so that one could use it for much more than some configuration files.

Personally, I can not understand, why Canonical does not use 'ne' as the default editor rather than nano. If Ubuntu is meant to make it easy to lean Linux, then I can see not a single advantage of nano over ne. Even the name is shorter :-)

CatMan

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.