<commit_before>"============================================================================
"File:        cpp.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer:  <NAME> <<EMAIL> at <EMAIL> dot <EMAIL>>
"License:     This program is free software. It comes without any warranty,
"             to the extent permitted by applicable law. You can redistribute
"             it and/or modify it under the terms of the Do What The Fuck You
"             Want To Public License, Version 2, as published by Sam Hocevar.
"             See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================

" in order to also check header files add this to your .vimrc:
" (this usually creates a .gch file in your source directory)
"
"   let g:syntastic_cpp_check_header = 1

if exists('loaded_cpp_syntax_checker')
    finish
endif
let loaded_cpp_syntax_checker = 1

if !executable('g++')
    finish
endif

function! SyntaxCheckers_cpp_GetLocList()
    let makeprg = 'g++ -fsyntax-only '.shellescape(expand('%'))
    let errorformat =  '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'

    if expand('%') =~? '\%(.h\|.hpp\|.hh\)$'
        if exists('g:syntastic_cpp_check_header')
            let makeprg = 'g++ -c '.shellescape(expand('%'))
        else
            return []
        endif
    endif

    return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction<commit_msg>add header include search to cpp syntax checker<commit_after>"============================================================================
"File:        cpp.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer:  <NAME> <k<EMAIL>2 at gmail dot com>
"License:     This program is free software. It comes without any warranty,
"             to the extent permitted by applicable law. You can redistribute
"             it and/or modify it under the terms of the Do What The Fuck You
"             Want To Public License, Version 2, as published by <NAME>.
"             See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================

" in order to also check header files add this to your .vimrc:
" (this usually creates a .gch file in your source directory)
"
"   let g:syntastic_cpp_check_header = 1
"
" To disable the search of included header files after special
" libraries like gtk and glib add this line to your .vimrc:
"
"   let g:syntastic_cpp_no_include_search = 1
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
" In order to force syntastic to refresh the header includes simply
" unlet b:syntastic_cpp_includes. Then the header files are being re-checked
" on the next file write.
"
"   let g:syntastic_cpp_auto_refresh_includes = 1
"
" Alternatively you can set the buffer local variable b:syntastic_cpp_cflags.
" If this variable is set for the current buffer no search for additional
" libraries is done. I.e. set the variable like this:
"
"   let b:syntastic_cpp_cflags = ' -I/usr/include/libsoup-2.4'

if exists('loaded_cpp_syntax_checker')
    finish
endif
let loaded_cpp_syntax_checker = 1

if !executable('g++')
    finish
endif

let s:save_cpo = &cpo
set cpo&vim

function! SyntaxCheckers_cpp_GetLocList()
    let makeprg = 'g++ -fsyntax-only '.shellescape(expand('%'))
    let errorformat =  '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'

    if expand('%') =~? '\%(.h\|.hpp\|.hh\)$'
        if exists('g:syntastic_cpp_check_header')
            let makeprg = 'g++ -c '.shellescape(expand('%'))
        else
            return []
        endif
    endif

    if !exists('b:syntastic_cpp_cflags')
        if !exists('g:syntastic_cpp_no_include_search') ||
                    \ g:syntastic_cpp_no_include_search != 1
            if exists('g:syntastic_cpp_auto_refresh_includes') &&
                        \ g:syntastic_cpp_auto_refresh_includes != 0
                let makeprg .= syntastic#SearchHeaders()
            else
                if !exists('b:syntastic_cpp_includes')
                    let b:syntastic_cpp_includes = syntastic#SearchHeaders()
                endif
                let makeprg .= b:syntastic_cpp_includes
            endif
        endif
    else
        let makeprg .= b:syntastic_cpp_cflags
    endif

    return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

let &cpo = s:save_cpo
unlet s:save_cpo

" vim: set et sts=4 sw=4:
{'fraction_non_alphanumeric': 0.1619151251360174, 'fraction_numerical': 0.003264417845484222, 'mean_word_length': 3.212648945921173, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4192213', 'n_tokens_mistral': 1420, 'n_tokens_neox': 1352, 'n_words': 439}