I have, for many years, mapped the space key to page-down. I love this mapping, except when I don't love it.
Specifically, I don't love it when I accidentally press the space key, which happens more than I care to admit.
I'm toying with a workaround that so far seems OK: I use two key mappings that will restore my window after an accidental space key: One maps the space key to call winsaveview(), then press page-down; the other maps 'qqq' to call winrestview()). My vimrc has the mappings as follows..
"--- This is to restore the window view if SPACE key is accidentally pressed map <Space> :let winrestdict = winsaveview()<CR><pagedown> map qqq :call winrestview(winrestdict)<CR>
(I use 'qqq' simply because it is quick and easy to type)
The above solution appears to work for me, so feel free to use it if nobody has an alternative.
My question is this... is there a cleaner way (i.e., without having to define the two key mappings above) to accomplish my goal of returning the cursor (and view) to exactly the previous location after pressing a page-down.
Note: Page-down (Ctrl-F) doesn't get added to the jump list, so Ctrl-O is not a solution.
(although maybe there's a setting to add page-down to the commands that update the jump list? I couldn't find anything like this)