indent config by buffer

This commit is contained in:
Mathieu Maret 2018-07-11 17:26:53 +02:00
parent 68ef92751b
commit de271744bc
2 changed files with 4 additions and 4 deletions

View File

@ -77,8 +77,8 @@ def main():
lines = ['-lines', '%s:%s' % (vim.current.range.start + 1, lines = ['-lines', '%s:%s' % (vim.current.range.start + 1,
vim.current.range.end + 1)] vim.current.range.end + 1)]
if vim.eval('exists("g:clang_style")') == '1': if vim.eval('exists("b:clang_style")') == '1':
style = vim.eval('g:clang_style') style = vim.eval('b:clang_style')
# Determine the cursor position. # Determine the cursor position.
cursor = int(vim.eval('line2byte(line("."))+col(".")')) - 2 cursor = int(vim.eval('line2byte(line("."))+col(".")')) - 2

4
.vimrc
View File

@ -189,10 +189,10 @@ augroup END
" detect indentation see http://www.freehackers.org/Indent_Finder " detect indentation see http://www.freehackers.org/Indent_Finder
if &expandtab if &expandtab
autocmd BufReadPost /* execute system ('python2 ~/.vim/indent_finder/indent_finder.py --vim-output --default space --default-size ' . &tabstop .' "' . expand('%') . '"' ) 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 else
autocmd BufReadPost /* execute system ('python2 ~/.vim/indent_finder/indent_finder.py --vim-output --default tab --default-size ' .&tabstop .' "' . expand('%') . '"' ) 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 endif
map <C-K> :pyf ~/.vim/syntax/clang-format.py<CR> map <C-K> :pyf ~/.vim/syntax/clang-format.py<CR>