diff --git a/README.md b/README.md index d8736fe..c213966 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ Put this in your .vimrc Plugin 'Chiel92/vim-autoformat' ``` -Then restart vim and run `:BundleInstall`. -To update the plugin to the latest version, you can run `:BundleUpdate`. +Then restart vim and run `:PluginInstall`. +To update the plugin to the latest version, you can run `:PluginUpdate`. ###Pathogen Download the source and extract in your bundle directory. @@ -63,6 +63,12 @@ It's probably in your distro's repository, so you can download it as a regular p For Ubuntu type `sudo apt-get install astyle` in a terminal. Otherwise, download it here: http://astyle.sourceforge.net/. +* `clang-format` for __Objective-C__. +clang-format is a product of LLVM source builds. +If you `brew install llvm`, clang-format can be found in /usr/local/Cellar/llvm/bin/. +To to load style configuration from a .clang-format file, add to your .vimrc: `let g:format_args_objc = "-style=file"`. +Details: http://clang.llvm.org/docs/ClangFormat.html. + * `autopep8` for __Python__. It's probably in your distro's repository, so you can download it as a regular package. For Ubuntu type `sudo apt-get install python-autopep8` in a terminal. diff --git a/plugin/defaults.vim b/plugin/defaults.vim index c02b356..fa83637 100644 --- a/plugin/defaults.vim +++ b/plugin/defaults.vim @@ -13,6 +13,11 @@ if !exists("g:formatprg_args_expr_cpp") && !exists("g:formatprg_args_cpp") let g:formatprg_args_expr_cpp = '"--mode=c --style=ansi -pcH".(&expandtab ? "s".&shiftwidth : "t")' endif +if !exists("g:formatprg_objc") | let g:formatprg_objc = "clang-format" | endif +if !exists("g:formatprg_args_expr_objc") && !exists("g:formatprg_args_objc") + let g:formatprg_args_expr_objc = '"-style=\"{BasedOnStyle: WebKit, AlignTrailingComments: true, ".(&textwidth ? "ColumnLimit: ".&textwidth.", " : "").(&expandtab ? "UseTab: Never, IndentWidth: ".&shiftwidth : "UseTab: Always")."}\""' + endif + if !exists("g:formatprg_java") | let g:formatprg_java = "astyle" | endif if !exists("g:formatprg_args_expr_java") && !exists("g:formatprg_args_java") let g:formatprg_args_expr_java = '"--mode=java --style=ansi -pcH".(&expandtab ? "s".&shiftwidth : "t")'