> I have this code:
>
> function! UpdateTag()
> exe "normal m'"
> exe ':%s/foo/bar/g'
> exe "normal `'"
> endfunction
> augroup UpdateTag
> autocmd! BufWrite * silent call UpdateTag()
> augroup END
>
> It doesn't work exactly as expected. It sets the mark, perform the
> substitution, jump back to the mark but it loses the window scrolling
> position.
>
> Is it possible to get the window current scrolling position (for
> example, in this screenshot http://i.imgur.com/Hkaoz.jpg I would like
> to get "339") and to set it (not :339 because I don't want to get the
> cursor on line 339, I want 339 to be the top line of the window) ?
See
:help winsaveview()
:help winrestview()
Regards,
Gary
--
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:
Post a Comment