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 use the correct binary for formatting. This follows
the convention used by

Change-Id: Ibd729dc3458927016dfeb79f08e611caeb671dda
Reviewed-by: Brett Wilson <>
Commit-Queue: Scott Graham <>
diff --git a/tools/gn/misc/vim/ b/tools/gn/misc/vim/
index 7e5d6a4..6170851 100644
--- a/tools/gn/misc/vim/
+++ b/tools/gn/misc/vim/
@@ -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.