Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am open a file in vi:

vi index.php

Here the problem is: when I press the down arrow and it prints 'B'. Why it prints 'B'?

share|improve this question
    
You should not ask something like this on AU but try to find a how-to on vi with google. There are plenty of how-to's on the web. lowfatlinux.com/linux-editor-vi.html computerhope.com/unix/uvi.htm and not only in English but also in your language. –  Rinzwind Nov 21 '12 at 8:44
    
Is there any specific reason for wanting to use vi as editor? I find using gedit (for simple text files) or jedit or geany (for html, php, css files) much easier and user-friendly. –  To Do Nov 21 '12 at 10:10
2  
@Rinzwind I don't understand how this question is off topic here? Google sent me here, from here I should go back to Google. Sounds like a vicious circle. –  Radu Rădeanu Oct 5 '13 at 7:55
    
@RaduRădeanu is has nothing to do with Ubuntu :+ –  Rinzwind Oct 5 '13 at 8:27
2  
@Rinzwind As far as I know, Ubuntu comes with vi preinstalled. Now these questions about default behavior of Ubuntu programs are off topic here? –  Radu Rădeanu Oct 5 '13 at 8:47

2 Answers 2

up vote 5 down vote accepted

There are three modes in vi editor namely:

  • command mode
  • input mode
  • default mode.

When youu open a file, you are in default mode. Now if you want to go to a specific position in your text, just use arrow keys or use h, j, k, l keys. Note that this would work only when you have not pressed i (or any other input mode entering command like a, A, I).

The reason for 'B' may be because the arrow keys in input mode don't function as arrow keys, so just press Esc to go into default mode any time. When to shift to input mode press i or a, and to navigate just press i key and use arrow keys or h, j, k, l.

share|improve this answer

Also try vim.

$ sudo apt-get install vim

There are many good vim/vi tutorials on youtube, or the web generally. For your problem, see here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.