Thursday, October 27, 2011

Re: Shortcut to indent xml

> "full file indent
> fun BenIndent()
> let oldLine=line('.')
> normal gg=G
> execute ':' . oldLine
> endfun
> "map -- :call BenIndent()<Bar>normal zz<CR>
> map -- :call BenIndent()<CR>

You could also just use:
map -- gg=G
(or even =%)

> I use the above code to indent other file format. I see xml can be
> indented in the following URL. However, I want to be able to indent
> xml as well when I press '--'. Does anybody if there is a way to do
> so?

If you have in your vimrc:
filetype plugin indent on
Your mapping should work as expected (at least it works here)

--
Ivan Sichmann Freitas
GNU/Linux user #509059

No comments: