vim: update docs for autoformatting

This updates documentation for autoformatting GN files within vim. This
updates the included formatter to recommend `:pyxf` over `:pyf` to use
whichever version of python is included in vim (python2 or python3).

This updates the README to recommend google/vim-codefmt, since this is
python2-3 compatible, and supports more functionality (like
autoformatting on save) than the included formatter.

Test: Upload to gerrit > open file > click "gitiles"
Change-Id: Iebb52931939a4d0df407f39fab202137105ca7c8
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/7301
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
diff --git a/misc/vim/README.md b/misc/vim/README.md
index f9684b4..26433f6 100644
--- a/misc/vim/README.md
+++ b/misc/vim/README.md
@@ -27,3 +27,39 @@
 " ...
 filetype plugin indent on " or a similar command to turn on filetypes in vim
 ```
+
+## Formatting GN files
+
+### vim-codefmt (recommended)
+
+[vim-codefmt](https://github.com/google/vim-codefmt) supports the GN filetype
+natively. Add the following to your `.vimrc`:
+
+```vim
+" Install vim-codefmt and its dependencies
+Plug 'google/vim-maktaba'
+Plug 'google/vim-codefmt'
+
+" Install this plugin:
+Plug 'https://gn.googlesource.com/gn', { 'rtp': 'misc/vim' }
+
+" Optional: configure vim-codefmt to autoformat upon saving the buffer.
+augroup CodeFmt
+  autocmd!
+  autocmd FileType gn AutoFormatBuffer gn
+  " Other file types...
+augroup END
+```
+
+This will autoformat your files every time you save. If you prefer not to format
+files upon saving, vim-codefmt can format the buffer by calling `:FormatCode`.
+
+### Included format integration
+
+If you cannot include vim-codefmt, you can use the limited `gn format`
+integration included in this plugin. Add the following to your `.vimrc`:
+
+```vim
+" Replace <F1> with whichever hotkey you prefer:
+nnoremap <silent> <F1> :pyxf <path-to-this-plugin>/gn-format.py<CR>
+```
diff --git a/misc/vim/gn-format.py b/misc/vim/gn-format.py
index d292e6d..7d07d43 100644
--- a/misc/vim/gn-format.py
+++ b/misc/vim/gn-format.py
@@ -8,7 +8,7 @@
 # - Change 'binary' if gn is not on the path (see below).
 # - Add to your .vimrc:
 #
-#   map <F1> :pyf <path-to-this-file>/gn-format.py<CR>
+#   map <F1> :pyxf <path-to-this-file>/gn-format.py<CR>
 #
 # gn format currently formats only a complete file so visual ranges, etc. won't
 # be used. It operates on the current, potentially unsaved buffer and does not