" Vim indent file " Language: C++ " Maintainer: Konstantin Lepa " Last Change: 2010 May 20 " License: MIT " Version: 1.1.0 " " Changes {{{ " 1.1.0 2011-01-17 " Refactored source code. " Some fixes. " " 1.0.1 2010-05-20 " Added some changes. Thanks to Eric Rannaud " "}}} if exists("b:did_indent") finish endif let b:did_indent = 1 function! GoogleCppIndent() let l:cline_num = line('.') let l:orig_indent = cindent(l:cline_num) if l:orig_indent == 0 | return 0 | endif let l:pline_num = prevnonblank(l:cline_num - 1) let l:pline = getline(l:pline_num) if l:pline =~# '^\s*template' | return l:pline_indent | endif " TODO: I don't know to correct it: " namespace test { " void " ....<-- invalid cindent pos " " void test() { " } " " void " <-- cindent pos if l:orig_indent != &shiftwidth | return l:orig_indent | endif let l:in_comment = 0 let l:pline_num = prevnonblank(l:cline_num - 1) while l:pline_num > -1 let l:pline = getline(l:pline_num) let l:pline_indent = indent(l:pline_num) if l:in_comment == 0 && l:pline =~ '^.\{-}\(/\*.\{-}\)\@