From de271744bcb8f02335e4754906679a714bd676f4 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Wed, 11 Jul 2018 17:26:53 +0200 Subject: [PATCH] indent config by buffer --- .vim/syntax/clang-format.py | 4 ++-- .vimrc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.vim/syntax/clang-format.py b/.vim/syntax/clang-format.py index fed9356..b61c771 100755 --- a/.vim/syntax/clang-format.py +++ b/.vim/syntax/clang-format.py @@ -77,8 +77,8 @@ def main(): lines = ['-lines', '%s:%s' % (vim.current.range.start + 1, vim.current.range.end + 1)] - if vim.eval('exists("g:clang_style")') == '1': - style = vim.eval('g:clang_style') + if vim.eval('exists("b:clang_style")') == '1': + style = vim.eval('b:clang_style') # Determine the cursor position. cursor = int(vim.eval('line2byte(line("."))+col(".")')) - 2 diff --git a/.vimrc b/.vimrc index cca0d78..ca19fbb 100644 --- a/.vimrc +++ b/.vimrc @@ -189,10 +189,10 @@ augroup END " detect indentation see http://www.freehackers.org/Indent_Finder if &expandtab autocmd BufReadPost /* execute system ('python2 ~/.vim/indent_finder/indent_finder.py --vim-output --default space --default-size ' . &tabstop .' "' . expand('%') . '"' ) - autocmd BufReadPost /* let g:clang_style="{BasedOnStyle: LLVM, AlignConsecutiveAssignments: true, AllowShortFunctionsOnASingleLine: Empty, BreakBeforeBraces: Linux, BreakStringLiterals: false, ColumnLimit: 95, IndentCaseLabels: true, IndentWidth: " .&shiftwidth .", TabWidth: " .&tabstop .", UseTab: Never}" + autocmd BufReadPost /* 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 autocmd BufReadPost /* execute system ('python2 ~/.vim/indent_finder/indent_finder.py --vim-output --default tab --default-size ' .&tabstop .' "' . expand('%') . '"' ) - autocmd BufReadPost /* let g:clang_style="{BasedOnStyle: LLVM, AlignConsecutiveAssignments: true, AllowShortFunctionsOnASingleLine: Empty, BreakBeforeBraces: Linux, BreakStringLiterals: false, ColumnLimit: 95, IndentCaseLabels: true, IndentWidth: " .&shiftwidth .", TabWidth: " .&tabstop .", UseTab: ForContinuationAndIndentation}" + autocmd BufReadPost /* let b:clang_style="{BasedOnStyle: LLVM, AlignConsecutiveAssignments: true, AllowShortFunctionsOnASingleLine: Empty, BreakBeforeBraces: Linux, BreakStringLiterals: false, ColumnLimit: 95, IndentCaseLabels: true, IndentWidth: " .&shiftwidth .", TabWidth: " .&tabstop .", UseTab: ForContinuationAndIndentation}" endif map :pyf ~/.vim/syntax/clang-format.py