+ vim-clang-format plugin

This commit is contained in:
Stefan Liebl 2023-08-24 18:48:32 +02:00
parent fe1588978c
commit 525874c9de
4 changed files with 11 additions and 18 deletions

@ -0,0 +1 @@
Subproject commit 6b791825ff478061ad1c57b21bb1ed5a5fd0eb29

View File

@ -33,11 +33,6 @@ if (g:os == 'linux')
endif
setlocal suffixesadd=.h
" set clang-format for gq, if exists
if exists('*ClangFormat()')
setlocal formatexpr=ClangFormat()
endif
" commenting
" ----------
let b:commentstring = "\/\/"

View File

@ -210,19 +210,6 @@ endfunction
" Formatting Functions
" --------------------
" hint: formatexpr=ClangFormat() is set in ft/c.vim
command! ClangFormat call ClangFormat()
function ClangFormat()
if (v:count > 0)
let startline = v:lnum
let endline = v:lnum + v:count
let l:lines = startline.':'.endline
else
let l:lines='all'
endif
py3file /usr/share/vim/addons/syntax/clang-format.py
endfunction
" delete all multiple empty lines
command -range=% DelAllMultipleEmptyLines call DelAllMultipleEmptyLines(<line1>,<line2>)
function DelAllMultipleEmptyLines(fromline, toline)

View File

@ -61,6 +61,7 @@ packadd! tcomment
packadd! termdebug
packadd! vc
packadd! vimagit
packadd! vim-clang-format
packadd! VisIncr
packadd! xml
packadd! yapf
@ -288,6 +289,15 @@ command PyFlake Flake8
" -----
command PyIsort Isort
" -----------
" ClangFormat
" -----------
let g:clang_format#command = 'clang-format-15'
let g:clang_format#detect_style_file = 1
let g:clang_format#auto_format = 1
let g:clang_format#auto_format_on_insert_leave = 1
let g:clang_format#auto_formatexpr = 1
" -------------
" YouCompleteMe
" -------------