I am working on a ChromeOS computer with both Vi and Vim. When I open up the editor to an existing document, I type A to begin editing. When I try to move around with my arrow keys, the following happens:

vim and vi arrow keys

I have tried both Vim and Vi, and both of the have this problem. How do I move around in my document while editing it?

  • 4
    Related (though not an exact duplicate, as this is about vi, not Vim): Fix arrow keys displaying A, B, C, D in vi (not in vim). Commented Dec 26, 2015 at 16:45
  • 1
    In the shell, what is the output of echo $TERM? What is the output of set term in Vim?
    – muru
    Commented Dec 26, 2015 at 17:09
  • @muru $TERM is xterm, set term is term=xterm
    – Elliot A.
    Commented Dec 27, 2015 at 2:13
  • If you don't have set nocompatible (i.e. no vimrc) you should have one.
    – FDinoff
    Commented Dec 27, 2015 at 5:13
  • 3
    Use :set nocomptible in vim. Also please check the values: :verbose set cp? cpo? Commented Jan 22, 2016 at 12:44

3 Answers 3


I do need to point out the elephant in the room: You shouldn't be navigating in insert mode.

Insert mode is for inserting text. While many implementations of vi allow you to navigate (using the arrow keys) while in insert mode, the recommended, normal method of navigation is to navigate in normal mode. Normal mode should be the mode you are normally in, hence the name.

The topic of modal editing vs. arrow keys is well described (at a beginner level) under "Misconception #1" in this excellent article.

As an additional point of background, the terminals upon which vi was originally designed didn't even have arrow keys. On some old keyboards the HJKL keys are additionally labelled with arrows; I don't actually know if this came before or after vi but I suspect the former.

I highly recommend working your way through the vimtutor (on the command line) and reading through the above linked article to start getting a handle on the power of modal editing. I suspect that the problem of non-functioning arrow keys will drop into total insignificance once you get a feel for the powerful motion commands available in normal mode. I know I personally never use arrow keys while editing text in Vim, and I feel handicapped when using other editors where I must use the arrow keys to navigate.

This site itself will also be of great assistance; for instance, here are a couple posts you may find helpful:

As to the nitty-gritty of Chrome OS and how it interprets arrow key presses in your terminal, I suspect that debugging it will go beyond the scope of this site. If you are truly determined to use arrow keys in vi, perhaps you will have better luck with the keyboard-to-terminal debugging issue amongst the knowledgeable people over at superuser.com. Best of luck to you whatever you decide, and I hope you may come to appreciate the power of Vim even with non-arrow-key only usage patterns. :)

P.S.: The most basic motion commands there are, are h, j, k, l. To these you can add <Space>, <Backspace>, <Return> and -, and of course the great favorites w, b, e and their whitespace-separated-word counterparts W, B, E. If you add in sentence motions ( and ), paragraph motions { and }, searching the word under the cursor forward or backward with * and # respectively, and same-line character search with f, t, F, T, ; and ,, and if you actually learn all of those well, or even most of those (which won't take you very long, actually)...I can promise you with total confidence that you will never go back to using arrow keys to navigate text within Vim.

This isn't even a complete list of motion commands; far from it. To see a more complete list along with documentation for each, start Vim, type :help motion.txt, and use j and k as your "down" and "up" keys to scroll through the document.

  • 2
    "You shouldn't be navigating in insert mode" - > Because pressing the down arrow twice is somehow not as fast as pressing <Esc>jji. Never mind that <Esc> is also outside the home row, just like the down arrow. Commented Jan 29, 2016 at 2:19
  • 1
    @Carpetsmoker, if a down arrow keystroke could be properly replayed as part of a dot command, I would probably do that sometimes. Since it can't...I don't bother with arrow keys; <C-o>2j is still faster.
    – Wildcard
    Commented Jan 29, 2016 at 2:40
  • 1
    Also, I haven't touched the <Esc> key a single time since learning that <C-[> does the same thing.
    – Wildcard
    Commented Jan 31, 2016 at 7:49
  • 1
    I've mapped my caps lock key to <kbd>esc</kbd>, it's useful in everything not just vim.
    – minseong
    Commented Nov 9, 2017 at 10:06

An alternative to @wildcard's answer is to just edit or create ~/.vimrc and put the following line in there :

set nocompatible
  • 1
    If you have a vimrc at all, nocompatible will be automatically set, and setting it yourself has side-effects. For that reason, current advice is to create a vimrc but not put :set nocompatible in it.
    – D. Ben Knoble
    Commented Feb 15, 2022 at 14:58
  • I'm sorry, but you're wrong @D.BenKnoble. I just tested what you said, and creating an empty .vimrc does not fix the issue at all (it would have been very weird). But adding the line in it does.
    – Orabîg
    Commented Feb 16, 2022 at 11:54
  • This may depend on your version. But see :help compatible which definitely states that when a vimrc is present this option is automatically set.
    – D. Ben Knoble
    Commented Feb 16, 2022 at 12:30
  • If it is confirmed that it is not always the case, where's the point of this comment ?
    – Orabîg
    Commented Feb 16, 2022 at 15:14
  • 1
    From :h 'compatible' When a vimrc or gvimrc file is found while Vim is starting this option is switched off this is always the case. The issues here are that 1) setting nocompatible is not a universal way to fix OP's issue 2) setting 'nocompatible` in your vimrc is useless as the doc says.
    – statox
    Commented Feb 25, 2022 at 9:30

First thing I do is vi ~/.vimrc echo "set nocompatible" > ~/.vimrc

PS. It is incredible how people ignore the simple fact that vi is totally unusable since decades. It was great in 1980s but not in 2000s (and now is already 2022).

  • Welcome to Vim :-). I have the impression that your answer is very similar to this one. I would recommend to be careful with opinion in answer they tend to offense and create usefulness debate ;-) Commented Oct 5, 2022 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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