From b432593cd0e91f2b0eb9bba5d106b563cd98e916 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Wed, 29 Aug 2012 02:35:38 +0200 Subject: [PATCH] Add c mode for apple --- vim/ftplugin/c.vim | 31 +++++++++++++++++++++++++++++++ vim/ftplugin/cpp.vim | 1 + vim/ftplugin/objc.vim | 1 + 3 files changed, 33 insertions(+) create mode 100644 vim/ftplugin/c.vim create mode 120000 vim/ftplugin/cpp.vim create mode 120000 vim/ftplugin/objc.vim diff --git a/vim/ftplugin/c.vim b/vim/ftplugin/c.vim new file mode 100644 index 0000000..a58c2a9 --- /dev/null +++ b/vim/ftplugin/c.vim @@ -0,0 +1,31 @@ +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +if findfile("Makefile", ".;/") != '' + let &l:makeprg="make -f ".findfile("Makefile", ".;/") +endif + +function! XCodeFold(lnum) + let line = getline(a:lnum) + if line =~ '^.pragma mark -' + return '<1' + endif + if line =~ '^.pragma mark' + return '>1' + endif + return '=' +endfunction + +function! XCodeFoldText() + let text = v:folddashes . " [ " + let text .= substitute(getline(v:foldstart), '#pragma mark ', '', 'g') + let text .= " ] " . string(v:foldend - v:foldstart + 1) . " lines " + return text +endfunction + +setl foldexpr=XCodeFold(v:lnum) +setl foldtext=XCodeFoldText() +setl foldmethod=expr + diff --git a/vim/ftplugin/cpp.vim b/vim/ftplugin/cpp.vim new file mode 120000 index 0000000..64e3fd4 --- /dev/null +++ b/vim/ftplugin/cpp.vim @@ -0,0 +1 @@ +c.vim \ No newline at end of file diff --git a/vim/ftplugin/objc.vim b/vim/ftplugin/objc.vim new file mode 120000 index 0000000..64e3fd4 --- /dev/null +++ b/vim/ftplugin/objc.vim @@ -0,0 +1 @@ +c.vim \ No newline at end of file -- 2.20.1