vim-flake8 icon indicating copy to clipboard operation
vim-flake8 copied to clipboard

New user options

Open raven42 opened this issue 4 years ago • 0 comments

Fixes #100

The following options are useful when vim is configured to run :Flake8 when first opening a file with something like the following:

autocmd BufReadPost *.py call flake8#Flake8()

Always Visible Option g:flake8_always_visible

This option will always show the quickfix window even if no errors are visible. This makes is more clear to see that there are no errors seen in the file when setting flake8 to run when first opening a file. This is especially true if there are other plugins that are logged to echon which may load or run after flake8.

Auto-Update Option g:flake8_auto_update

This is to fix an issue when attempting to run :Flake8 on a file that does not yet exist on the file system. Currently, when :Flake8 is run it will trigger an update which forcefully writes out the file before running flake8 on it.

This is causing an issue when setting flake8 to run when a file is opened. This forces a new file to be created when it may not be intended. A specific use-case would be when using git to view a file from another branch. This can be done via the following (setup via a git alias):

git show some_branch:./test.py | vim -c "file some_branch:test.py" -c
"doautocmd BufRead test.py -"

This allows vim to open the contents of the file from stdin, thereby reading the contents of the git show output. If this is done, then the local copy of the file would be overwritten which could be unintended and lead to lost changes.

Ideally the update should not be performed automatically, but that would change the behavior for existing users of this plugin, however adding thie config option will at least allow for better handling of this.

raven42 avatar Jan 14 '22 18:01 raven42