Skip to content

Add option to skip version check #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ Name of `clang-format`. If the name of command is not `clang-format`
or you want to specify a command by absolute path, set this variable.
Default value is `clang-format`.

- `g:clang_format#check_version`

If set to `0` the version of `clang-format` will not be checked. This is useful if a wrapper
script is in use that doesn't correctly report the `clang-format` version.
Default value is `1`.

- `g:clang_format#extra_args`

You can specify more extra options in `g:clang_format#extra_args` as String or List of String.
Expand Down
4 changes: 4 additions & 0 deletions autoload/clang_format.vim
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ function! clang_format#is_invalid() abort
" XXX: Give up checking version
return 0
endif
if g:clang_format#check_version == 0
return 0
endif
if v[0] < 3 || (v[0] == 3 && v[1] < 4)
return 2
endif
Expand Down Expand Up @@ -188,6 +191,7 @@ function! s:getg(name, default) abort
endfunction

let g:clang_format#command = s:getg('clang_format#command', 'clang-format')
let g:clang_format#check_version = s:getg('clang_format#check_version', 1)
let g:clang_format#extra_args = s:getg('clang_format#extra_args', "")
if type(g:clang_format#extra_args) == type([])
let g:clang_format#extra_args = join(g:clang_format#extra_args, " ")
Expand Down
7 changes: 7 additions & 0 deletions doc/clang-format.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ g:clang_format#command *g:clang_format#command*
Name of clang-format command.
The default value is "clang-format".

g:clang_format#check_version *g:clang_format#check_version*

If set to `0` the version of `clang-format` will not be checked. This is
useful if a wrapper script is in use that doesn't correctly report the
`clang-format` version.
Default value is `1`.

g:clang_format#git *g:clang_format#git*

Name of the git command.
Expand Down