From: Ɓukasz Langa Date: Thu, 7 Jun 2018 18:40:41 +0000 (-0700) Subject: Don't crash the Vim plugin X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/75a9447448d2e5d7acfa925bfead4a1460e1939d?hp=ef362b4ea84669ed38ea108aee4117e8fadf1cf0 Don't crash the Vim plugin Fixes #312 --- 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)