vim - Toggling scrollbind has weird sideeffects -
inspired https://stackoverflow.com/a/18466534/42580 inserted .vimrc
nmap <f2> :windo set invscrollbind<cr>
hitting <f2>
toggles scrollbind on , off on windows. but there weirdness going on understand:
- both when turning on , off focus moves active window 1 @ lower right corner. want focus stay!
- if bind 2 windows, scroll down 1 screen , unbind (with ) expect no visual change. unfocused window scrolled position had before bind (one screen up). why , how avoid this?
your 2nd problem cannot reproduce.
your 1st problem because used windo
, windo
go through windows , execute command, , @ end leave focus on last window. can move previous window after 've done windo
. <expr>
map can help:
nnoremap <expr> <f2> ":windo set invscrollbind\<cr>:".winnr()."wincmd w\<cr>"
Comments
Post a Comment