commit | f3c7676f9511e5ae1d78aa34befad8fcba463cc7 | [log] [tgz] |
---|---|---|
author | Scott Graham <scottmg@chromium.org> | Tue Sep 10 10:20:04 2019 -0700 |
committer | Commit Bot <commit-bot@chromium.org> | Tue Sep 10 21:00:16 2019 +0000 |
tree | 90ca1b1756f1880a2827e99c59080355ad786747 | |
parent | d034be3a2582aff57134fff13f55aecd8d351bb0 [diff] |
vim: Allow override of default location for gn binary With this, something like: let g:gn_path = "/work/fuchsia/prebuilt/third_party/gn/linux-x64/gn" lets gn-format.py use the correct binary for formatting. This follows the convention used by clang-format.py: https://github.com/llvm/llvm-project/blob/aee9448939cdee5064e65225d1039e7e7f0facc7/clang/tools/clang-format/clang-format.py#L40 Change-Id: Ibd729dc3458927016dfeb79f08e611caeb671dda Reviewed-on: https://gn-review.googlesource.com/c/gn/+/6120 Reviewed-by: Brett Wilson <brettw@chromium.org> Commit-Queue: Scott Graham <scottmg@chromium.org>
diff --git a/tools/gn/misc/vim/gn-format.py b/tools/gn/misc/vim/gn-format.py index 7e5d6a4..6170851 100644 --- a/tools/gn/misc/vim/gn-format.py +++ b/tools/gn/misc/vim/gn-format.py
@@ -21,6 +21,8 @@ # Change this to the full path if gn is not on the path. binary = 'gn' +if vim.eval('exists("g:gn_path")') == "1": + binary = vim.eval('g:gn_path') def main(): # Get the current text.