On 9/18/06, Yakov Lerner <[EMAIL PROTECTED]> wrote:
On 9/18/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> is it possible to tell vim(7) *not* to jump to the next line
> when using object motion (w,b..) such as vim behaves when using l or h ?
If you want w or b to be locked within 1 line, this can be
done using n-mappings.
Does this do what you wanted:
"------- remap w and b to make them line-locked ----------------
nnoremap <silent>w :call LineLocked_w()<cr>
function! LineLocked_w()
let x = winsaveview()
normal! w
if line('.') != x['lnum']
call winrestview(x)
endif
endfun
nnoremap <silent>b :call LineLocked_b()<cr>
function! LineLocked_b()
let x = winsaveview()
normal! b
if line('.') != x['lnum']
call winrestview(x)
endif
endfun
" Following this pattern, you can remap other
" ops to be line-locked
Yakov