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 single command-line), and then resetting
'scrolloff' to the original value. Finally, we remove the variable, which isn't really necessary but it's nice to be tidy.
Obviously you don't want to type that in every time, so you can make a command by adding the following to your
command ScrollOff10 let s:scrolloff_before = &scrolloff | set scrolloff=10 | redraw | let &scrolloff = s:scrolloff_before
As we're now in a script, we can use script-local variables to decrease the chances of our variable overwriting a pre-existing one (and we don't bother to
unlet it, as it's not visible outside the script.
Or a mapping:
nnoremap <F1> :let s:scrolloff_before = &scrolloff<CR>:set scrolloff=10<CR>:let &scrolloff = s:scrolloff_before<CR>
This version doesn't need the
:redraw either, because instead of concatenating the commands with
:bar, we're entering them one at a time with (mapped) presses of the Return key.