In vim, when I go to a marker, is there a way to tell vim to scroll it to the middle automatically instead of me doing z.
or zz
again?
or is there an event from vim when I go to marker like vim buffer events?
Commands to run pre and post inbuilt commands seems like a powerful thing. So there might be a plugin to do this. Couldn't find a query for google for this.
To scroll to the middle of the screen, we have to first identify the element upto which we want to scroll on the page. Then pass scrollIntoView and the web element as parameters to the executeScript method. JavaScript command scrollIntoView can have multiple optional parameters.
We can scroll to the middle of the screen with Selenium webdriver using the JavaScript Executor. Selenium can execute JavaScript commands with the help of the executeScript method.
TaskDock is a free app, and you can use it to customize the taskbar. It does not have the bells and whistles that TaskbarX offers, but it gets the job done. Hopefully, one of these methods will help you get mid-positioned taskbar icons.
If this is just for moving to a marker with '
and friends (or just a few more select motions), you can override the original commands with custom mappings like this:
:nnoremap <expr> ' "'" . nr2char(getchar()) . 'zz'
:nnoremap <expr> ` "`" . nr2char(getchar()) . 'zz'
These basically turn (typed) 'a
into (executed) 'azz
; the complication here is that the '
command waits for the typed mark; the mapping does this via getchar()
before assembling and returning the full command. The <expr>
makes Vim execute the right-hand side as an expression and use the result, instead of directly executing it.
To keep the cursor in the middle of the window at all times, set the 'scrolloff'
option to a high value (like 999
) instead.
Speaking of events, there's CursorMoved
that is triggered after each move; unfortunately, there's no indication which command caused the move.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With