Skip to content

Commit

Permalink
Fix g:black_fast and g:black_(skip)_string_normalization opts
Browse files Browse the repository at this point in the history
  • Loading branch information
Rowan Rodrik van der Molen authored and ambv committed Aug 26, 2020
1 parent e268cba commit 5f78401
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions plugin/black.vim
Expand Up @@ -41,15 +41,20 @@ endif
if !exists("g:black_linelength")
let g:black_linelength = 88
endif
if !exists("g:black_skip_string_normalization")
let g:black_skip_string_normalization = 0
if !exists("g:black_string_normalization")
if exists("g:black_skip_string_normalization")
let g:black_string_normalization = !g:black_skip_string_normalization
else
let g:black_string_normalization = 1
endif
endif

python3 << EndPython3
import collections
import os
import sys
import vim
from distutils.util import strtobool


class Flag(collections.namedtuple("FlagBase", "name, cast")):
Expand All @@ -62,15 +67,13 @@ class Flag(collections.namedtuple("FlagBase", "name, cast")):
name = self.var_name
if name == "line_length":
name = name.replace("_", "")
if name == "string_normalization":
name = "skip_" + name
return "g:black_" + name


FLAGS = [
Flag(name="line_length", cast=int),
Flag(name="fast", cast=bool),
Flag(name="string_normalization", cast=bool),
Flag(name="fast", cast=strtobool),
Flag(name="string_normalization", cast=strtobool),
]


Expand Down

0 comments on commit 5f78401

Please sign in to comment.