Format source code;
Do nothing, because this has contain a executable file!
- install
uncrustify
; - let g:uncrustify_bin_path = 'uncrustify'
Do nothing!
- define your configure;
- let g:uncrustify_cfg_path = 'xxx/your_cfg_nam.cfg'
# 由于更新uncrustify后,配置可能发生变化,所以需要将你的配置与最新的配置进行合并,所以
# 写了个小脚本
$ cd plugin
$ uncrustify --show-config > defaults.cfg
$ python merge.py
$ mv me.cfg me_old.cfg
$ mv new.cfg me.cfg
$ rm old.cfg
$ mv me_old.cfg old.cfg
- for whole file, run command:
:Uncrustify
- for selected context, run command:
:'<,'>Uncrustify
- format whole file:
nnoremap <Leader>ff :Uncrustify<CR>
- format selected context:
vnoremap <Leader>ff :'<,'>Uncrustify<CR>