From 75a9447448d2e5d7acfa925bfead4a1460e1939d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Langa?= Date: Thu, 7 Jun 2018 11:40:41 -0700 Subject: [PATCH 1/1] Don't crash the Vim plugin Fixes #312 --- plugin/black.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin/black.vim b/plugin/black.vim index 09261db..0b958b8 100644 --- a/plugin/black.vim +++ b/plugin/black.vim @@ -97,8 +97,9 @@ def Black(): start = time.time() fast = bool(int(vim.eval("g:black_fast"))) line_length = int(vim.eval("g:black_linelength")) + mode = black.FileMode.AUTO_DETECT if bool(int(vim.eval("g:black_skip_string_normalization"))): - mode = black.FileMode.AUTO_DETECT & black.FileMode.NO_STRING_NORMALIZATION + mode |= black.FileMode.NO_STRING_NORMALIZATION buffer_str = '\n'.join(vim.current.buffer) + '\n' try: new_buffer_str = black.format_file_contents(buffer_str, line_length=line_length, fast=fast, mode=mode) -- 2.39.5