]> granicus.if.org Git - clang/commitdiff
clang-format: permit setting the path to clang in vimrc
authorSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 2 Nov 2014 21:27:59 +0000 (21:27 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 2 Nov 2014 21:27:59 +0000 (21:27 +0000)
If g:clang_format_path is set in the vimrc, that path will take precedence over
the hard coded path (which is reliant on the PATH environment variable).  This
provides an easy mechanism for switching the selected clang-format binary during
development.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221108 91177308-0d34-0410-b5e6-96231b3b80d8

tools/clang-format/clang-format.py

index 3bb89e04b19f2e2a8b27512f2e937b57272c55a3..03493560f43bd64ac6fb95d9afb1f80900fd193d 100644 (file)
@@ -23,8 +23,11 @@ import subprocess
 import sys
 import vim
 
+# set g:clang_format_path to the path to clang-format if it is not on the path
 # Change this to the full path if clang-format is not on the path.
 binary = 'clang-format'
+if vim.eval('exists("g:clang_format_path")'):
+  binary = vim.eval('g:clang_format_path')
 
 # Change this to format according to other formatting styles. See the output of
 # 'clang-format --help' for a list of supported styles. The default looks for