A mistake in my previous post: my gvim edition is 7.1.314 . After some trial, I get the following solution:
set ww+=<,> imap <Left> <Esc><Left>a imap <Right> <Esc><Right>a imap <Up> <Esc>gka imap <Down> <Esc>gja Maybe this looks awkward. But it seems work right now. Thanks. On Dec 9, 3:34 pm, juner <[EMAIL PROTECTED]> wrote: > Thank you very much! I am glad that you can understand my English (I > am not an English speaker). > > Your suggestions works perfectly in normal mode. However, what I > really care is the "Edit" mode (or "Insert" mode), in which case the > cursor stops at the beginning of a line when I hold down the left > arrow key. Your second suggestion reminds me to use "imap <Up> > <Esc><Esc>gkli " to make the "up" key act the way I expected. > > I am using gvim 7.3.314 in ubuntu 8.10 . Maybe I need to try a new > version. > > On Dec 9, 3:01 pm, Gary Johnson <[EMAIL PROTECTED]> wrote: > > > On 2008-12-08, juner wrote: > > > Is there a way to make the arrow keys in vim/gvim act exactly like > > > gedit or other typical windows editors? What I want are: > > > > 1. When I press the left key, the cursor will of course move left; but > > > when it reach the beginning of a line, it stops, and it won't move to > > > the above line. Sometimes this can be quite inconvenient. However, > > > this problem can be partly solved by setting "set whichwrap > > > +=<,>,h,l" . By "partly solved", I mean this only applies to wrapped > > > lines; when the cursor reaches the beginning of a vim "true" line, it > > > won't move any more. > > > 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 --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
