r221108 - clang-format: permit setting the path to clang in vimrc

Saleem Abdulrasool compnerd at compnerd.org
Sun Nov 2 13:27:59 PST 2014


Author: compnerd
Date: Sun Nov  2 15:27:59 2014
New Revision: 221108

URL: http://llvm.org/viewvc/llvm-project?rev=221108&view=rev
Log:
clang-format: permit setting the path to clang in vimrc

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.

Modified:
    cfe/trunk/tools/clang-format/clang-format.py

Modified: cfe/trunk/tools/clang-format/clang-format.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/clang-format.py?rev=221108&r1=221107&r2=221108&view=diff
==============================================================================
--- cfe/trunk/tools/clang-format/clang-format.py (original)
+++ cfe/trunk/tools/clang-format/clang-format.py Sun Nov  2 15:27:59 2014
@@ -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





More information about the cfe-commits mailing list