Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Recently i try to learn something about the unix. when i try to edit something using the vi command, it is very difficult for me since i have to switch the edit mode and control mode time by time. It is very inconvenient. Is it that i miss something or it is originally like that? Is there anyway to improve that? Thank you :)

share|improve this question

migrated from Mar 24 '10 at 1:11

This question came from our site for professional and enthusiast programmers.

@Tom: don't be mean to newbies... – Thomas Mar 23 '10 at 18:08
@Thomas: stop talking to yourself. – Paul Ruane Mar 23 '10 at 18:12
Recently, I tried to delete a line in Notepad++ with <Esc>dd and wondered a while, why in my line two literal ds showed up... – Boldewyn Mar 29 '10 at 14:50

That's the way vi works.

A good solution, when you're beginning using it, is to print a cheat-sheet of keyword shortcuts, and hand it on the wall next to your desk ;-)

As an alternative, you could use something "simpler", like nano -- if installed on your system.

But, considering vi is installed on pretty much all unix/linux systems, taking a bit of time to learn at least the basics is definitely not a bad idea ;-)

share|improve this answer
joe and pico are also good accessible editors; joe is often the only editor available on embedded systems since it's very small. – Ether Mar 23 '10 at 17:50

Easy Option

As a short-term measure, you can run Vim in "easy mode" with:

vim -y

This will start vim in insert-mode, so that you generally just type text straight in, and use the cursor keys to move around, like in most other editors.
(Quitting the editor is weird in this mode: easy enough with the GUI, though the command-line version needs something like Ctrl-O, Z, Q)

But I urge you to take the time to learn to use Vim (and Vi) properly, because once you get the hang of it (and that could take a few weeks) you'll find you can make quite complex edits much more quickly in Vim than in other editors.


If it's a properly installed Vim, you can run the vimtutor command from the shell.

This will guide you through basic movement, quitting, and simple editing.

There are many "cheat sheets" for Vi and Vim: This one may help you visualize all the keyboard commands.

Once you're a bit more confident in Vim,

:help 02.1

will show you a more in-depth guide to using Vim as a first-timer, but that guide fails as a tutorial by not explaining how to move down the page until about six pages in.

share|improve this answer

Vi (and Vim) is a mode based editor by default. This is something a lot of users value, me included. If you however want a modeless editor, you might want to take a look at Emacs instead. It is also a very capable text editor (among other things, thanks to it being extendable by using Emacs Lisp).

Nano might be an alternative as well, it is a lot more simple than Vi(m) and Emacs but it does what it's supposed to do (edit text).

share|improve this answer

No, you didn't miss anything, that's just how vi works. Once you get used to it, there's no hassle at all, and you prefer having the different modes. Notably, that you can use so many more keys to do things, such as hitting x instead of delete to remove a character, can make editing much faster, since your hands aren't moving all across the keyboard.

If you don't like it, give emacs or nano a try. Nano's supposed to be quite easy to learn & use.

share|improve this answer

One way to deal with the modal behavior of vim is to be in command mode by default. Only when you insert some text, you switch into input mode, but get right out of it as soon as you're done: you type a sentence and hit ESC right away. That way, you don't have to think so much about which mode you're in: you're in command mode unless you're typing input.

Once you get more proficient with the editor and get to use its powerful editing commands, inserting text will become just another command to you like many other commands, and they're all initiated from command mode.

share|improve this answer

Do the official tutorial that is included with vim, it will take under an hour for a beginner and will give you a very good insight of what vim is capable of doing

share|improve this answer

Do you mean that it's cumbersome switching between insert mode and command mode using i and esc all the time? I'm afraid that's just the way vim works...

share|improve this answer

It is supposed to be that way. It's actually very powerful when you get used to it. My advice would be (1) to get a good cheat sheet and paste it up next to your workstation and (2) use nothing but vim for editing for a while until your fingers learn how to use it.

Cheat sheet (available in several languages).

share|improve this answer

Why not just try using pico? It's a simple, fairly beginner-friendly text editor that comes with most Linux distributions (not sure about other unices). Type "pico" at the shell to launch it.

share|improve this answer

You must log in to answer this question.