1

So I am new to Vim and I am trying to understand the language of vimrc. I have this in my vimrc:

map <F8> <C-E>: sleep 100m<CR>j<F8>

This would automatically move the cursor down when I press F8. However, what if I want the cursor to move down 1 line then move up 1 line, then down 1 line again and repeat? It's a dumb question I know, but I try to understand how the language vimscript works. Anyway, I try this:

map <F8> <C-E>: sleep 100m<CR>1j1k<F8>

That only scolls downward, not upward. I want it to move down 1 line, then up 1 line then repeat until I press Ctrl-C to cancel.

Pleast let me know your help

1 Answer 1

1

You'd need to include the whole sequence, including the opposite of <C-E>, which is <C-Y>, and also the :sleep.

map <F8> <C-E>:sleep 100m<CR>j<C-Y>:sleep 100m<CR>k<F8>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.