6

*CTRL-D* CTRL-D Scroll window Downwards in the buffer. The number of lines comes from the 'scroll' option (default: half a screen). <b>If [count] given, first set 'scroll' option to [count].</b> ... Execute 1<ctrl-d> for one time, it will set 'scroll' to 1, you can then use <c-d> and &...


5

scroll the view of the bottom window without switching to that window Something like this call win_execute(win_getid(winnr('j')), "normal! \<C-E>") winnr('j') returns Window number of a window below the current one. win_getid() translates Window number to :h winid. Then win_execute() runs an arbitrary command as if that window were active (...


4

Most likely the developer didn't feel that this feature is important enough to deserve a simple key. On the other hand it is possible to create mappings using 1<C-d> and 1<C-u> when you need it. Remember that vi was initially implemented by Billy Joy in 1976. At that time scrolling the screen might have been an expensive operation.


4

Just stumbled across this question/answer, and I think it's a terrific idea, with an ingenious solution! However, while I think the existing answer is very clever, something about it doesn't sit well with me. I don't like the fact that, while in one sense the disabling of 'virtualedit' is automatic, it's not fully automated: it relies on the user using one ...


4

I use the mouse for this. With set mouse=a I can scroll any open window from any mode (including normal mode). It’s not the purest solution, but it works very well for me.


3

Simply do this: set sidescroll=1 'sidescroll' controls "the minimal number of columns to scroll horizontally". So with a value of 1 h and l will shift the screen one column at a time. Side note: the commands zh and zl will shift the screen a column at a time but they don't move the cursor. If, for some reason, you couldn't or didn't want to change ...


3

You may be looking for zz, zt, and zb—they center (or move to the top, or to the bottom) the current line on the screen.


2

Assuming you have 2 windows. Then map like this in your .vimrc: map <F11> <C-W><C-W><C-D><C-W><C-W> It will map F11 to do these actions: <C-W><C-W> - move cursor to second window. <C-D> - scroll second window downwards half of screen. <C-W><C-W> - move cursor back to first window. Change ...


2

Normal mode For normal mode, rather than remapping scroll commands, I would use an autocommand: augroup KeepCentered autocmd! autocmd CursorMoved * normal! zz augroup END Insert mode For insert mode, as you've discovered, simple autocommands won't suffice. Instead, note that there are very few keystrokes that can cause the cursor to change lines when in ...


2

This is essentially packing @Rich's solution (temporarily setting 'scrolloff') into a function, to improve readability. I'm also defining a command and a mapping with a little bit more of flexibility (allowing a custom offset to be specified through a "count") and usability. function! ScrollOffset(offset) let save_scrolloff = &l:scrolloff let &...


2

The brute force way to do it: :let scrolloff_before = &scrolloff | set scrolloff=10 | redraw | let &scrolloff = scrolloff_before | unlet scrolloff_before This works by saving the current 'scrolloff' value in a variable, setting it to 10, redrawing the screen so the update is applied (which is necessary because we are running all the commands in a ...


1

Not an answer to your question. But thought I'd mention that this exists: https://github.com/terryma/vim-smooth-scroll


1

Orthogonally to my other answer, here's a version of SetVirtualEdit() that you can plug into your existing solution which does not require Python: function! SetVirtualEdit() abort let saved_view = winsaveview() keepjumps normal! g0 let is_on_leftmost_screen = col('.') == 1 call winrestview(saved_view) if is_on_leftmost_screen set virtualedit= ...


Only top voted, non community-wiki answers of a minimum length are eligible