views:

118

answers:

2

When cursor is at middle of screen and i scroll down, the cursor moves upwards on the screen. I don't want it to do that.

How can i scroll without changing cursors on-screen position?

Solution, added after answer:
noremap <C-k> 14j14<C-e>
noremap <C-l> 14k14<C-y>

+1  A: 

If you want to both move the cursor and the viewport with the cursor anywhere in the screen, perhaps you should set up some custom key bindings to do both at once.

Such as:

:nnoremap <C-M-u> j<C-e>

This will move the cursor down (j) and move the viewport (Ctrl-e) whenever you press Ctrl-Alt-u (only in normal mode).

wds
+1  A: 

There are two ways I can think of: ctrl-E and ctrl-Y scroll the buffer without moving the cursor's position relative to the window. I think that is what you want. Also, if you set scrolloff to a large number, you will get the same effect as ctrl-E and ctrl-Y with the movement keys. scrolloff setting will make it hard to get the cursor to move vertically relative to the window though. (Use something like :set so=999, so is an abbreviation for scrolloff.)

:help 'scrolloff'
:help scrolling
Alok