I am trying to create an Emacs like Ctrl-l
feature, similar to Vim's H, M and L. For those who don't now, these keys jump to top, middle, and bottom of the window. I already have something but I am missing the "if" part.
function! ToggleHML()
let l:winheight = winheight('%')
let l:top = 1
let l:middle = l:winheight / 2
let l:bottom = l:winheight
if ...
endfunction
I think I have to create another variable to keep the state until the next function call, but I don't know how to.
Another thing I ended up thinking, exec a normal command inside the function. Something like:
:exec 'normal! H'