I'm a Windows user coming to Ubuntu's Bash thanks to WSL. Now I need to edit some files and I really hate Vi. Do I just have to deal with it, or is there a simpler alternative?

The features I am looking for are:

  • CLI based
  • easy to use (typing and editing should be similar to Notepad)
  • simple editing capabilities are enough

I will try to master Vim, but I need to make a quick edit right now!


Solution 1:

If you are looking for an alternative editor, you are not alone. Basically life is too short to learn vi and I say this being a software developer for a living. However you should learn how to exit it because it's a problem for one out of 20k programmers. Also performing some basic append/insert operation might be worth learning, because on some stubborn servers you won't find any other editor.

Now, the answer to your question is probably nano.

If you are running some automated build script, using git or running other commands, they might open vim without you wanting it. You can prevent this by running the following before proceeding:

export EDITOR=nano

Solution 2:

It is a matter of opinion.

Beginners use nano.

vim ("vi improved") has a bit of a learning curve but it is very powerful. See this beginner's guide for vim or any other vim guides or the vim tutorial vimtutor (included in vim).

For now I highly suggest nano

nano -B /path/to/file/to/edit

-B makes a backup

Commands are issued with the control key and are listed at the bottom of the editor window.

There' a a guide on syntax highlighting see: How do I enable syntax highlighting in nano?

nano

emacs is an alternate to both vim and nano and has many benefits as well. emacs is more complex than nano. You can see emac's tour.

Just for completeness, vim + themes such as Zenburn can be quite helpful

Zenburn

Solution 3:

as a windows power user, after trying vim and nano I found out that I need something in between, complexity-wise. so I tried slap and It was the exact thing that I was looking for.

slap image

slap is a Sublime-like terminal-based text editor that strives to make editing from the terminal easier. slap has first-class mouse support, even over SSH connection.


installation:

curl -sL https://raw.githubusercontent.com/slap-editor/slap/master/install.sh | sh

Solution 4:

Have you ever been frustrated that your text editor wasn’t doing what you wanted? Angered that you can’t remember...

  • ...how to find help?
  • ...what :wq means?
  • ...any of the little lisper that you read as an undergrad?

A small, brave world awaits!

While we're advocating for our favourite lightweight text editors, let me recommend the eXcellent, tiny, and fast xo (exofrills).

It's a single Python 3 file, and it has good support for syntax highlighting through Pygments (although not perfect with non-Python):

enter image description here

It also has extremely simple and useful key combinations which can be readily and easily changed to your heart's content:

enter image description here

Other features:

  • Less than 850 lines of code in a single file!
  • Syntax highlighting!
  • Regular expression matching and replacing!
  • Search history caching!
  • WTFPL licensed!
  • Fully customizable!
  • Start at non-origin locations!
  • Hop between words on a line!
  • Jump to anywhere in the file!
  • Whole file insertion!
  • Beginner friendly - maybe you are new to words!
  • Copy and paste text!
  • Line and column status!
  • Only one row of non-text editing space!
  • Both saving & loading!

The Python3 source is on github, and you can install it more easily using:

sudo apt install python3-pip
sudo pip3 install exofrills 

exofrills: your text has been edited...but you are still hungry.

Disclaimer: I am in no way affiliated with the exofrills project.