Hi,

I have a function which removes double lines in my vhdl code when I
save my file.
It is like this:

au BufWritePre *.vhd :%s/^\n\{2,}/\r/ge

But I assume that this is also the cause that my cursor goes to the
end of my file when I save my file.

What must I do to keep the cursor where it was when I did give the save-command

Is this a save way?
I just copied some code that seems to work, but I don't know what it does.
function! Remove()
exe "normal msHmtgg"
:%s/^\n\{2,}/\r/ge
exe "normal 'tzt`s"
endfunction

au BufWrite *.vhd if ! &bin | call Remove() | endif


Rgds,
Jeri

-- 
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

Reply via email to