Friday, April 30, 2010

Keeping screen position

I don't like when I'm jumping between two files and if I need to edit a
line at the bottom and see some text at the top, vim re-centers screen
after ctrl-^ so I have to scroll again. I made a little mapping that
remembers and restores screen:

nnoremap <silent> <c-^> msHmt<c-^>:normal! 'tzt`s<CR>

It works great nearly always but on a rare occasion, it seems like it
jumps to the top of file. Or a couple screenfuls up, or something like
that. It happens rarely enough that I can't figure out what causes this
and yet often enough to be annoying; and it always happens when I'm too
busy with something else to investigate.

I'm hoping someone here might be able to spot the problem with this
mapping. Much thanks in advance!

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: