<commit_before>"============================================================================
"File:        syntastic.vim
"Description: vim plugin for on the fly syntax checking
"Maintainer:  <NAME> <<EMAIL>>
"Version:     2.1.0
"Last Change: 14 Dec, 2011
"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.
"
"============================================================================

if exists("g:loaded_syntastic_plugin")
    finish
endif
let g:loaded_syntastic_plugin = 1

let s:running_windows = has("win16") || has("win32") || has("win64")

if !s:running_windows
    let s:uname = system('uname')
endif

if !exists("g:syntastic_enable_signs")
    let g:syntastic_enable_signs = 1
endif
if !has('signs')
    let g:syntastic_enable_signs = 0
endif

if !exists("g:syntastic_enable_balloons")
    let g:syntastic_enable_balloons = 1
endif
if !has('balloon_eval')
    let g:syntastic_enable_balloons = 0
endif

if !exists("g:syntastic_enable_highlighting")
    let g:syntastic_enable_highlighting = 1
endif

if !exists("g:syntastic_echo_current_error")
    let g:syntastic_echo_current_error = 1
endif

if !exists("g:syntastic_auto_loc_list")
    let g:syntastic_auto_loc_list = 2
endif

if !exists("g:syntastic_auto_jump")
    let syntastic_auto_jump=0
endif

if !exists("g:syntastic_quiet_warnings")
    let g:syntastic_quiet_warnings = 0
endif

if !exists("g:syntastic_stl_format")
    let g:syntastic_stl_format = '[Syntax: line:%F (%t)]'
endif

if !exists("g:syntastic_mode_map")
    let g:syntastic_mode_map = {}
endif

if !has_key(g:syntastic_mode_map, "mode")
    let g:syntastic_mode_map['mode'] = 'active'
endif

if !has_key(g:syntastic_mode_map, "active_filetypes")
    let g:syntastic_mode_map['active_filetypes'] = []
endif

if !has_key(g:syntastic_mode_map, "passive_filetypes")
    let g:syntastic_mode_map['passive_filetypes'] = []
endif

command! SyntasticToggleMode call s:ToggleMode()
command! SyntasticCheck call s:UpdateErrors(0) <bar> redraw!
command! Errors call s:ShowLocList()

highlight link SyntasticError SpellBad
highlight link SyntasticWarning SpellCap

augroup syntastic
    if g:syntastic_echo_current_error
        autocmd cursormoved * call s:EchoCurrentError()
    endif

    autocmd BufReadPost,BufWritePost * call s:UpdateErrors(1)
    autocmd BufWinEnter * if empty(&bt) | call s:AutoToggleLocList() | endif
    autocmd BufUnload,BufWinLeave * lclose
augroup END


"refresh and redraw all the error info for this buf when saving or reading
function! s:UpdateErrors(auto_invoked)
    if &buftype == 'quickfix'
        return
    endif

    if !a:auto_invoked || s:ModeMapAllowsAutoChecking()
        call s:CacheErrors()
    end

    if g:syntastic_enable_balloons
        call s:RefreshBalloons()
    endif

    if g:syntastic_enable_signs
        call s:RefreshSigns()
    endif

    call s:AutoToggleLocList()

endfunction

function s:AutoToggleLocList()
    if s:BufHasErrorsOrWarningsToDisplay()
        call setloclist(0, b:syntastic_loclist)
        if g:syntastic_auto_jump
            silent! ll
        endif
    elseif g:syntastic_auto_loc_list == 2
        lclose
    endif

    if g:syntastic_auto_loc_list == 1
        if s:BufHasErrorsOrWarningsToDisplay()
            call s:ShowLocList()
        else
            "TODO: this will close the loc list window if one was opened by
            "something other than syntastic
            lclose
        endif<commit_msg>ops, forgot to check buftype before calling lclose, avoid calling it if not needed.<commit_after>"============================================================================
"File:        syntastic.vim
"Description: vim plugin for on the fly syntax checking
"Maintainer:  <NAME> <martin.grenfell at gmail dot com>
"Version:     2.1.0
"Last Change: 14 Dec, 2011
"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.
"
"============================================================================

if exists("g:loaded_syntastic_plugin")
    finish
endif
let g:loaded_syntastic_plugin = 1

let s:running_windows = has("win16") || has("win32") || has("win64")

if !s:running_windows
    let s:uname = system('uname')
endif

if !exists("g:syntastic_enable_signs")
    let g:syntastic_enable_signs = 1
endif
if !has('signs')
    let g:syntastic_enable_signs = 0
endif

if !exists("g:syntastic_enable_balloons")
    let g:syntastic_enable_balloons = 1
endif
if !has('balloon_eval')
    let g:syntastic_enable_balloons = 0
endif

if !exists("g:syntastic_enable_highlighting")
    let g:syntastic_enable_highlighting = 1
endif

if !exists("g:syntastic_echo_current_error")
    let g:syntastic_echo_current_error = 1
endif

if !exists("g:syntastic_auto_loc_list")
    let g:syntastic_auto_loc_list = 2
endif

if !exists("g:syntastic_auto_jump")
    let syntastic_auto_jump=0
endif

if !exists("g:syntastic_quiet_warnings")
    let g:syntastic_quiet_warnings = 0
endif

if !exists("g:syntastic_stl_format")
    let g:syntastic_stl_format = '[Syntax: line:%F (%t)]'
endif

if !exists("g:syntastic_mode_map")
    let g:syntastic_mode_map = {}
endif

if !has_key(g:syntastic_mode_map, "mode")
    let g:syntastic_mode_map['mode'] = 'active'
endif

if !has_key(g:syntastic_mode_map, "active_filetypes")
    let g:syntastic_mode_map['active_filetypes'] = []
endif

if !has_key(g:syntastic_mode_map, "passive_filetypes")
    let g:syntastic_mode_map['passive_filetypes'] = []
endif

command! SyntasticToggleMode call s:ToggleMode()
command! SyntasticCheck call s:UpdateErrors(0) <bar> redraw!
command! Errors call s:ShowLocList()

highlight link SyntasticError SpellBad
highlight link SyntasticWarning SpellCap

augroup syntastic
    if g:syntastic_echo_current_error
        autocmd cursormoved * call s:EchoCurrentError()
    endif

    autocmd BufReadPost,BufWritePost * call s:UpdateErrors(1)
    autocmd BufWinEnter * if empty(&bt) | call s:AutoToggleLocList() | endif
    autocmd BufUnload,BufWinLeave * if empty(&bt) | lclose | endif
augroup END


"refresh and redraw all the error info for this buf when saving or reading
function! s:UpdateErrors(auto_invoked)
    if &buftype == 'quickfix'
        return
    endif

    if !a:auto_invoked || s:ModeMapAllowsAutoChecking()
        call s:CacheErrors()
    end

    if g:syntastic_enable_balloons
        call s:RefreshBalloons()
    endif

    if g:syntastic_enable_signs
        call s:RefreshSigns()
    endif

    call s:AutoToggleLocList()
endfunction

function s:AutoToggleLocList()
    if s:BufHasErrorsOrWarningsToDisplay()
        call setloclist(0, b:syntastic_loclist)
        if g:syntastic_auto_jump
            silent! ll
        endif
    elseif g:syntastic_auto_loc_list == 2
        lclose
    endif

    if g:syntastic_auto_loc_list == 1
        if s:BufHasErrorsOrWarningsToDisplay()
            call s:ShowLocList()
        else
            "TODO: this will close the loc list window if one was opened by
            "something other than syntastic
            lclose
        endif
{'fraction_non_alphanumeric': 0.12381827731092437, 'fraction_numerical': 0.008140756302521009, 'mean_word_length': 4.057768924302789, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, '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': '1508284', 'n_tokens_mistral': 2598, 'n_tokens_neox': 2487, 'n_words': 633}