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.
echo $TERM
? What is the output ofset term
in Vim?xterm
, set term isterm=xterm
set nocompatible
(i.e. no vimrc) you should have one.:set nocomptible
in vim. Also please check the values::verbose set cp? cpo?