diff --git a/CHANGES.md b/CHANGES.md index 02b3fdf75d5..90195322ccc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,11 @@ - Fix incorrect custom breakpoint indices when string group contains fake f-strings (#2311) +### Integrations + +- The vim plugin now searches upwards from the directory containing the current buffer + instead of the current working directory for pyproject.toml. (#1871) + ## 21.5b2 ### _Black_ diff --git a/autoload/black.vim b/autoload/black.vim index f0357b07123..0d93aa899d0 100644 --- a/autoload/black.vim +++ b/autoload/black.vim @@ -139,7 +139,8 @@ def Black(): print(f'Reformatted in {time.time() - start:.4f}s.') def get_configs(): - path_pyproject_toml = black.find_pyproject_toml(vim.eval("fnamemodify(getcwd(), ':t')")) + filename = vim.eval("@%") + path_pyproject_toml = black.find_pyproject_toml((filename,)) if path_pyproject_toml: toml_config = black.parse_pyproject_toml(path_pyproject_toml) else: