diff --git a/CHANGES.md b/CHANGES.md index d22062ad542..a5205ba7a06 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -22,6 +22,11 @@ - Fix handling of named escapes (`\N{...}`) when `--experimental-string-processing` is used (#2319) +### 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: