[vim] indent finder using python 3

This commit is contained in:
Mathieu Maret 2022-10-03 10:19:00 +02:00
parent 662dc1c31b
commit 7de2aa447e
2 changed files with 6 additions and 6 deletions

View File

@ -65,7 +65,7 @@ def deepdbg( s ): log( VERBOSE_DEEP_DEBUG, s )
def log( level, s ): def log( level, s ):
if level <= IndentFinder.VERBOSITY: if level <= IndentFinder.VERBOSITY:
print s print(s)
class IndentFinder: class IndentFinder:
""" """
@ -452,7 +452,7 @@ def main():
args = parser.parse_args() args = parser.parse_args()
if args.version: if args.version:
print 'IndentFinder v%s' % VERSION print('IndentFinder v%s' % VERSION)
return return
if args.vim: if args.vim:
VIM_OUTPUT = 1 VIM_OUTPUT = 1
@ -469,9 +469,9 @@ def main():
fi.clear() fi.clear()
fi.parse_file( fname ) fi.parse_file( fname )
if VIM_OUTPUT: if VIM_OUTPUT:
print "%s : %s" % (fname, fi.vim_output()) print("%s : %s" % (fname, fi.vim_output()))
else: else:
print "%s : %s" % (fname, str(fi)) print("%s : %s" % (fname, str(fi)))
return return
else: else:
@ -480,7 +480,7 @@ def main():
if VIM_OUTPUT: if VIM_OUTPUT:
sys.stdout.write( fi.vim_output() ) sys.stdout.write( fi.vim_output() )
else: else:
print str(fi) print(str(fi))
if __name__ == "__main__": if __name__ == "__main__":

2
.vimrc
View File

@ -236,7 +236,7 @@ fu DetectIndent()
return return
endif endif
execute system ('python2 ~/.vim/indent_finder/indent_finder.py --vim-output --default space --default-size ' . &tabstop .' "' . expand('%') . '"' ) execute system ('python3 ~/.vim/indent_finder/indent_finder.py --vim-output --default space --default-size ' . &tabstop .' "' . expand('%') . '"' )
if &expandtab if &expandtab
let b:clang_style="{BasedOnStyle: LLVM, AlignConsecutiveAssignments: true, AllowShortFunctionsOnASingleLine: Empty, BreakBeforeBraces: Linux, BreakStringLiterals: false, ColumnLimit: 95, IndentCaseLabels: true, IndentWidth: " .&shiftwidth .", TabWidth: " .&tabstop .", UseTab: Never}" let b:clang_style="{BasedOnStyle: LLVM, AlignConsecutiveAssignments: true, AllowShortFunctionsOnASingleLine: Empty, BreakBeforeBraces: Linux, BreakStringLiterals: false, ColumnLimit: 95, IndentCaseLabels: true, IndentWidth: " .&shiftwidth .", TabWidth: " .&tabstop .", UseTab: Never}"
else else