From 84463180857ef0bfd93a19807e448bfec277939c Mon Sep 17 00:00:00 2001 From: Alex Dunn Date: Thu, 8 Jan 2015 01:48:38 -0800 Subject: [PATCH] Fix #34: Add Objective-C Support --- README.md | 3 +++ plugin/defaults.vim | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/README.md b/README.md index 38aa1bc..7a8eccd 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,9 @@ 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 specify custom clang-format options, add to your .vimrc: `let g:format_args_objc = "-style=file"`. clang-format 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")'