It works fine for me using vim 7.2.22. If I execute
:set ww+=<,>
and move the cursor to any of the lines in your preceding paragraph,
the left arrow will move the cursor to the beginning of the line and
then to the end of the preceding line.
Try starting vim like this:
vim -N -u NONE -c 'set ww+=<,>' some_text_file
The left and right arrow keys should behave as you want. If they
don't, tell us which version of vim you're using, on which platform,
and exactly what behavior you're observing. If they do, then you
have something in your ~/.vimrc or in a plugin that's interfering
with the behavior of those keys.
> 2. I always set vim to wrap lines automatically, which means a long
> line will appear several lines in the editor. When I press the
> "up"/"down" key, the cursor will move to the above or the below line.
> Here the word "line" means the vim "true" line, not the apparent lines
> shown on the screen. This is inconvenient to me. Even if I have set
> "set whichwrap+=<,>,h,l", the performance won't change.
Try this:
nmap <Up> gk
nmap <Down> gj
Regards,
Gary
Hm. In my gvim 7.2.68, when 'whichwrap' includes "h,l", hitting the h
key repeatedly moves from the start of one line to the end of the
previous one, but even when it includes "<,>", it doesn't when using
<Left> (neither in Normal nor Insert modes). OTOH, with <Right> and > it
works.
This looks like a bug to me. (Bram, what do you think?)
I checked that gvim correctly sees my left-arrow key: in Insert mode,
Ctrl-K followed by left-arrow inserts <Left> into the buffer.
>
> 2. I always set vim to wrap lines automatically, which means a long
> line will appear several lines in the editor. When I press the
> "up"/"down" key, the cursor will move to the above or the below line.
> Here the word "line" means the vim "true" line, not the apparent lines
> shown on the screen. This is inconvenient to me. Even if I have set
> "set whichwrap+=<,>,h,l", the performance won't change.
>
> Is is there some settings or plugins to work this out? Thanks!
Here, I use the following
map <Up> gk
map <Down> gj
imap <Up> <C-O>gk
imap <Down> <C-O>gj
to have <Up> and <Down> move by screen lines in both Normal and Insert
modes. In Normal mode, j and k still move by file lines.
See
:help map-overview
:help gj
:help gk
:help i_CTRL-O
Best regards,
Tony.
--
"To whoever finds this note -
I have been imprisoned by my father who wishes me to marry
against my will. Please please please please come and rescue me.
I am in the tall tower of Swamp Castle."
SIR LAUNCELOT's eyes light up with holy inspiration.
"Monty Python and the Holy Grail" PYTHON (MONTY)
PICTURES LTD
I had a spurious mapping from <Left> to <BS>, possibly set by some
plugin (but in a former session, so I don't know which plugin: ":verbose
map <Left>" answered that it was set in ~/Session.vim). Removing that
mapping cures the problem.
Best regards,
Tony.
--
"Life would be much simpler and things would get done much faster if it
weren't for other people"
-- Blore
I have
:set ww?
whichwrap=<,>,[,],~,s
*As I said*, I had a spurious mapping of <Left> to <BS> and unmapping
that (with no other change) cured the problem. Alternately, I could
probably have used :set ww+=b instead.
Best regards,
Tony.
--
There are three ways to get something done:
(1) Do it yourself.
(2) Hire someone to do it for you.
(3) Forbid your kids to do it.
'whichwrap' needs to include "<,>" for arrow keys in normal mode, and
also needs "[,]" for arrow keys in insert mode. After doing :set
ww+=<,>,[,] it works fine for me, on vim 7.2.49 - are you sure that
you don't have some other map that's interfering?
~Matt
Oops, I see that you've figured it out. GMail's threading is usually
pretty good, but the change of subject when you solved your problem
confused it, so my effort to read the full thread before replying
backfired... :)
~Matt
Ah, sorry. I get my mail from gmail by POP, and SeaMonkey had no problem
keeping the thread together.
Best regards,
Tony.
--
Jesus was killed by a Moral Majority.