vim: remove previous code indentation and convert to another

Posted by ramgorur on Super User See other posts from Super User or by ramgorur
Published on 2012-11-25T08:51:27Z Indexed on 2012/11/25 11:08 UTC
Read the original article Hit count: 188

Filed under:
|
|
|

I have a c project with multiple files (more than 100), the codes are written in Whitesmiths style, but I want to change them into K&R style indentation. Is it possible to do using vim in an automated way ?

For example I have a emacs-lisp script to achieve this --

(progn 
  (find-file "{}") 
  (mark-whole-buffer) 
  (setq indent-tabs-mode nil) 
  (untabify (point-min) (point-max)) 
  (indent-region (point-min) (point-max) nil) 
  (save-buffer))

I was wondering if there is a similar trick that could be done with vim.

© Super User or respective owner

Related posts about linux

Related posts about vim