Skip to content

Commit a8fa766

Browse files
Freed-Wu1ambd4
andcommitted
✨ Support customization of cmd arguments
Co-authored-by: lttzz <[email protected]>
1 parent 423f183 commit a8fa766

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

autoload/cppinsights.vim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ call g:cppinsights#utils#plugin.Flag('g:cppinsights#cmd', 'insights')
1313
""
1414
" Configure what window name use for split window. See |%:r|.
1515
call g:cppinsights#utils#plugin.Flag('g:cppinsights#window_name', '%:r-insights.cpp')
16+
""
17+
" Configure extra arguments used by `insights`. See `insights --help`.
18+
" Such as `-- -std=c++17`.
19+
call g:cppinsights#utils#plugin.Flag('g:cppinsights#extra_args', '')
1620

1721
""
1822
" Main function for |:Insights|.
@@ -22,7 +26,7 @@ function! cppinsights#main(bang) abort
2226
else
2327
let l:null = '/dev/null'
2428
endif
25-
let l:cmd = g:cppinsights#cmd . ' ' . expand('%') . ' 2>' . l:null
29+
let l:cmd = g:cppinsights#cmd . ' ' . expand('%') . ' ' . g:cppinsights#extra_args . ' 2>' . l:null
2630
try
2731
let l:text = trim(system(l:cmd))
2832
catch /^Vim\%((\a\+)\)\=:E677:/

doc/cppinsights.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ Default: 'insights' `
2929
Configure what window name use for split window. See |%:r|.
3030
Default: '%:r-insights.cpp' `
3131

32+
*cppinsights:g:cppinsights#extra_args*
33+
Configure extra arguments used by `insights`. See `insights --help`. Such as
34+
`-- -std=c++17`.
35+
Default: '' `
36+
3237
==============================================================================
3338
COMMANDS *cppinsights-commands*
3439

0 commit comments

Comments
 (0)