Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New user options #97

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

New user options #97

wants to merge 4 commits into from

Conversation

raven42
Copy link

@raven42 raven42 commented Jan 14, 2022

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.

The following options are useful when vim is configured to run `:Flake8`
when first opening a file via the following:

```vim
autocmd BufReadPost *.py call flake8#Flake8()
```

Add option for `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 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flake8 plugin automatically writes buffer even if not intended
2 participants