7
votes

I'm looking for a simple text editor that I can use from the command line in Linux to edit files. I'm used to editing files in windows, so I'm looking for something with the same keyboard interface. That means:

  • SHIFT+Arrow Keys/PGUP/PGDN to select text
  • CTRL+C, CTRL+X, CTRL+V to copy/cut/paste

And that's pretty much it. Surprisingly I'm having a tough time finding something like this. Vi/emacs are naturally out. Nano comes close, but has its own non-standard cut/paste/select keyboard shortcuts.

Surely this thing exists somewhere. Thanks in advance for pointing me in the right direction.

1
  • 1
    You may find it easier to use Windows than make UNIX use Windows conventions. Especially in the CLI. You'll find that edit in Windows doesn't use these conventions either. That being said, you can rebind commands in most editors including vi and emacs.
    – Warner
    Mar 20, 2010 at 16:22

7 Answers 7

12
votes

nano is as close as I've found to something I can easily transition to. It is certainly the closest command line tool to edit in DOS.

5
  • It's what I recommend, simple and easy to understand. Mar 21, 2010 at 1:42
  • Yeah, nano seems to be about the best you can get on linux. Strange that nobody's jumped on the opportunity to build a Textpad for the command line. Mar 21, 2010 at 2:15
  • I think it is easy to say lots of people have take the opportunity to build text editors a simple search of any package repositories will show you that. Most don't use Windows Notepad as an example of something worth emulating.
    – Zoredache
    Mar 21, 2010 at 3:29
  • Be careful with nano. I have edited config files before, and it added hidden newline characters, causing the conf to fail. (The conf files were nagios) Sep 16, 2010 at 2:22
  • I find Nano's keyboard mapping bonkers and just plain confusing when switching from/to it; I often end up closing windows when pressing 'CTR+W' instead of 'CTRL+F'! Best for now is this re-mapping .nanorc project - github.com/craigbarnes/nanorc. FYI - I tried fte-terminal, mcedit, and the joe editor but I think they all don't support UTF8 terminal encoding as there are rendering/key captures issues. Apr 20, 2013 at 16:13
6
votes

I highly recommend just learning vim. There are plenty of "quick start" and "quick reference" guides to get you started. You will be much happier in the long run.

http://tnerual.eriogerg.free.fr/vimqrc.html

http://fosswire.com/post/2007/11/ultra-quick-start-in-vim/

2
  • 2
    +1 When in Rome... If you are using *nix, you should learn the tools that come with it. Vi(m) has been on just about every *nix variant for the past 20 years. Mar 21, 2010 at 1:48
  • 1
    +1 Since vim/vi is default on almost all linux systems today. Mar 21, 2010 at 11:00
4
votes

cream is meant to be an easier-to-learn vim which implements the Common User Access keybindings. I haven't used it, but they have a snazzy webpage.

The downside to something like cream is that it's much less likely to be available on a given system than is vim. Either vim or vi itself is guaranteed to be installed on any unix-ish system.

If you are interested in learning vim, so as to be ready to use it or vi for those times when you need to, your best bet may be to install it on your windows system and start using it instead of notepad. There is lots to be learned, and if learn it you will be able to do things much faster than before.

Tips and resources
  • Vim's help is pretty thorough: try the command :help help to get started.
  • Undoing is easy: just press <ESC> and/or <CTRL-C>' a couple times to get back to normal mode. You can then undo any accidental changes, usingu`, until you're back to where you want to be.
  • <CTRL-R> will redo.
  • :help vimtutor will bring up a tutorial.
  • I found this visual cheat sheet invaluable when first learning vim.

After you put in a couple of hours learning basic commands, you'll probably start saving time with basic editing. Also, it's quite interesting: it makes editing a bit more like an arcade or strategy game. This aspect, i.e. preventing brain-rot and the loss in productivity that comes with perceived drudgery, may actually be more valuable than the increase in speed.

This post has more tips on learning vim: stackoverflow.com/questions/74625/what-is-the-best-way-to-force-yourself-to-master-vi

1
  • It should be noted that cream requires X11. Mar 20, 2010 at 22:26
3
votes

If you're running X windows then there are a lot of graphical editors you can run, gedit springs to mind.

You may be able to define nano's escape sequence behaviour in your .nanorc file.

I know it looks arcane, but I'd take the time to learn Vi, once you learn it, you wonder why you used anything else.

You can learn emacs, however I regard emacs to be an operating system in its own right, it's not an editor ;-).

3
  • I'm fine in VI, but really I only find myself in a Linux shell about once every six months. Step one in VI is to start typing and issue 15 random commands before accidentally typing I to start inserting, followed by an hour of research on the web to learn how to undo the commands I've accidentally issued. For my sanity, I'd prefer to have something that mimics the way that every text editor for every other OS (and every browser text field) does it. Mar 20, 2010 at 16:44
  • just because all software does it, it doesn't mean it's right. VI has steep learning curve. But once you have it cracked, you wish you'd used it years ago. Mar 20, 2010 at 19:18
  • 1
    ...and Vi is available on lots of different systems, so it's a useful skill to have.
    – Bryan
    Mar 20, 2010 at 21:22
1
vote

mcedit which comes with Midnight Commander (mc) claims to be able to do shift-arrow selection on terminals which support it, but doesn't say which those might be.

Selection works for me in xterm and gnome-terminal, but not in PuTTY (at least the way I have things configured).

0
votes

At the beginning when I started on linux, I liked http://sourceforge.net/projects/joe-editor/ might be interesting for you too. thanks

0
votes

ergomacs is an emacs clone that was made to fit your requirements (seems you were not alone).

https://ergoemacs.github.io/

Not the answer you're looking for? Browse other questions tagged .