Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.mdown
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 <C-K> :call flake8#Flake8ShowError()<cr>

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
----
Expand Down
11 changes: 7 additions & 4 deletions autoload/flake8.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down