Loading ...
Sorry, an error occurred while loading the content.

Re: cursor movement over wrapped lines

Expand Messages
  • A. J. Mechelynck
    ... I use wrap too, but my vimrc includes the following for the exact ... mappings and abbreviations -------------------------- use keypad Up and Down
    Message 1 of 3 , Oct 29, 2005
    • 0 Attachment
      Tom Seddon wrote:
      > Hi,
      >
      > When vim is set to wrap lines, moving the cursor up or down (i.e., with
      > j/k or up/down arrow keys) moves it to the next line in the document.
      > This can be inefficient if the window is narrow and/or the lines long.
      > Is there some way to make the cursor move in terms of lines on screen
      > rather than lines in the document? (This is how Visual Studio .NET
      > behaves, for example.)
      >
      > I've found nothing obvious in the documentation, nor in the mailing list
      > archives. Can this be done?
      >
      > Thanks,
      >
      > --Tom
      >
      >
      >
      >
      I use 'wrap' too, but my vimrc includes the following for the exact
      reason you're mentioning here:

      ----- start
      " mappings and abbreviations
      " --------------------------
      " use keypad Up and Down to move by screen lines
      " jk still move by file lines
      map <Up> gk
      imap <Up> <C-O>gk
      map <Down> gj
      imap <Down> <C-O>gj
      ----- end

      I copy-pasted the above from my vimrc so you can copy-paste it into
      yours via the clipboard if you like them.

      See
      :help gj
      :help gk

      HTH,
      Tony.
    Your message has been successfully submitted and would be delivered to recipients shortly.