On 7/3/06, K.S.Sreeram <[EMAIL PROTECTED]> wrote:
Hi All

In 'set wrap' mode, say I have a single long line which wraps and forms
5 screen lines. Now when I press 'j', the cursor jumps over the 5 lines
and goes to the next physical line(6th screen line).

Is it possible for me to configure vim, so that cursor movement keys go
to the next screen line, instead of the next physical line?

I have played with the 'textwidth' option, but that actually *inserts*
newlines into the text. But I don't want my long lines to be physically
broken with newlines. Any help appreciated.

I have this in my .vimrc. Press <F3> to toggle
between Up/Down action:

" alternate Up/Down arrows when lines are long
fu! ToggleLongLinesUpDown()
 if !exists("s:UpDownLongLines") || s:UpDownLongLines==0
   imap <silent> <Down> <C-o>gj
   imap <silent> <Up> <C-o>gk

   nmap <silent> <Down> gj
   nmap <silent> <Up> gk
   echo "Up/Down for long lines = new(screen lines)"
   let s:UpDownLongLines=1
 else
   nunmap <Down>
   nunmap <Up>
   let s:UpDownLongLines=0
   echo "Up/Down for long lines = vi standard"
 endif
endfunction

map <F3> :call ToggleLongLinesUpDown() <cr>

Yakov

Reply via email to