YAPF clears the buffer on formatting
Open
Nobody has claimed this yet.
bug
- Dominant language
- Vim Script
- Stars
- 1.1k
- Forks
- 102
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
I have set yapf as my default formatter in .vimrc and whenever I save a .py file, it clears the buffer. And if I change it to black or autopep8, it doesn't.
To Reproduce
Minimal vimrc:
Plug 'google/vim-maktaba'
Plug 'google/vim-codefmt'
Plug 'google/vim-glaive'
call plug#end()
call glaive#Install()
augroup autoformat_settings
autocmd FileType bzl AutoFormatBuffer buildifier
autocmd FileType c,cpp,proto,javascript,arduino AutoFormatBuffer clang-format
autocmd FileType dart AutoFormatBuffer dartfmt
autocmd FileType go AutoFormatBuffer gofmt
autocmd FileType gn AutoFormatBuffer gn
autocmd FileType html,css,sass,scss,less,json AutoFormatBuffer js-beautify
autocmd FileType java AutoFormatBuffer google-java-format
autocmd FileType python AutoFormatBuffer black
autocmd FileType rust AutoFormatBuffer rustfmt
autocmd FileType vue AutoFormatBuffer prettier
augroup END
OS (version)
Windows 10
NVIM v0.4.3 and vim-plug
yapf 0.30.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the AutoFormatBuffer path used by the Vim plugin and reproduce the report using YAPF 0.30.0 on Windows 10 with the provided minimal vimrc. Compare its behavior with the listed black and autopep8 formatters; done means saving a Python buffer preserves its contents while applying YAPF formatting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, vim
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100