diff --git a/README.mdown b/README.mdown index 1d2d764..1e8cf11 100644 --- a/README.mdown +++ b/README.mdown @@ -70,6 +70,12 @@ To customize whether the quickfix window opens, set `g:flake8_show_quickfix`: let g:flake8_show_quickfix=0 " don't show let g:flake8_show_quickfix=1 " show (default) +To customize wheather the quickfix window stays open even when no errors are found, set +`g:flake8_always_visible`: + + let g:flake8_always_visible=0 " don't show quickfix window if no errors (default) + let g:flake8_always_visible=1 " show quickfix window even if no errors + To customize whether the show signs in the gutter, set `g:flake8_show_in_gutter`: let g:flake8_show_in_gutter=0 " don't show (default) @@ -109,6 +115,14 @@ To show the error message of the current line in the ruler, call `flake8#ShowErr " add binding to call the function nnoremap :call flake8#Flake8ShowError() +To disable the auto-save option (vim `update`) while running `:flake8#Flake8()` use the +`g:flake8_auto_update` option. This can be disabled to prevent auto-saving a file if the +Flake8 command is run as part of an `autocmd` for instance. This will prevent overwritting +of the file. Note however, that flake8 will be run on the existing file on the file system, +and not the current buffer when this option is disabled: + + let g:flake8_auto_update=0 " Disable auto-save when running Flake8 + let g:flake8_auto_update=1 " Enable auto-save when running Flake8 (default) Tips ---- diff --git a/autoload/flake8.vim b/autoload/flake8.vim index c407b9b..ea1a76a 100644 --- a/autoload/flake8.vim +++ b/autoload/flake8.vim @@ -79,6 +79,7 @@ function! s:Setup() " {{{ call s:DeclareOption('flake8_quickfix_location', '', '"belowright"') call s:DeclareOption('flake8_quickfix_height', '', 5) call s:DeclareOption('flake8_show_quickfix', '', 1) + call s:DeclareOption('flake8_always_visible', '', 0) " markers to show call s:DeclareOption('flake8_show_in_gutter', '', 0) call s:DeclareOption('flake8_show_in_file', '', 0) @@ -89,6 +90,8 @@ function! s:Setup() " {{{ call s:DeclareOption('flake8_pyflake_marker', '', '"F>"') call s:DeclareOption('flake8_complexity_marker', '', '"C>"') call s:DeclareOption('flake8_naming_marker', '', '"N>"') + " other configuration options + call s:DeclareOption('flake8_auto_update', '', 1) "" setup markerdata @@ -134,7 +137,7 @@ function! s:Flake8() " {{{ let l:old_t_te=&t_te " write any changes before continuing - if &readonly == 0 + if &readonly == 0 && s:flake8_auto_update update endif @@ -166,12 +169,12 @@ function! s:Flake8() " {{{ let l:results=getqflist() let l:has_results=results != [] - if l:has_results + if l:has_results || s:flake8_always_visible " save line number of each error message for result in l:results - let linenum = result.lnum + let linenum = result.lnum let s:resultDict[linenum] = result.text - endfor + endfor " markers if !s:flake8_show_in_gutter == 0 || !s:flake8_show_in_file == 0