This post lists the Vim commands to set up and fix a buffer so that it adheres to Linux kernel coding style guidelines.
Commands
Set up options
:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab cindent
Fix the Existing Buffer (now that the options are in effect)
:%retab
Remove white space on save
:autocmd BufWritePre * %s/\s\+$//e
Set a 80 char column visual guide
:set cc=80
Execute All Commands At Once
:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab cindent cc=80 | %retab | autocmd BufWritePre * %s/\s\+$//e
Note
You can put this line directly into your personal Vim initialization file: ~/.vimrc
References
Comentários