From: MonkeeSage Date: 2007-12-16T21:20:15+09:00 Subject: Re: autoindenting ruby On Dec 15, 11:39 pm, Ryan Davis wrote: > On Dec 15, 2007, at 13:12 , Konrad Meyer wrote: > > >> (defun iwb () > >> "Indent whole buffer." > >> (interactive) > >> (delete-trailing-whitespace) > >> (indent-region (point-min) (point-max) nil) > >> (untabify (point-min) (point-max))) > > >> it relies on ruby-mode.el to indent Ruby sources. > >> Probably something similar can be written/found for vim. > > > Yes, the vim for this is very complicated, you have to type "gg=G". > > read the code above again and tell me that 'gg=G' does all that... For vim, that function would be something like... " Indent whole buffer. function! IndentFile() let cursor = line('.') exe ":%s/\\s\\+$//" exe "norm gg=G".cursor."G" exe ":%retab" endfunction Regards, Jordan