This uses a fully custom function for indenting Go code in Vim.
It provides a lot more flexibility than a cindent-based approach,
so this version gets the := operator correct, as well as switch
labels and jump labels.
One outstanding TODO is to handle lines immediately after jump labels.
R=adg, n13m3y3r, jnwhiteh, dchest, rsc, rlight2
CC=golang-dev, rivercheng
https://golang.org/cl/4534047
Fmt command filters the current Go buffer through gofmt.
It tries to preserve cursor position and avoids replacing
the buffer with stderr output.
R=golang-dev, dsymonds, niemeyer
CC=golang-dev
https://golang.org/cl/4382053
This change fixes the import plugin so that the
defined commands are available when opening a new
Go buffer from within Vim itself.
R=adg, rsc
CC=golang-dev
https://golang.org/cl/3998053
Forcing the synchronization of 500 lines is both slower and
less precise than searching for a known sync point.
Unfortunately, though, the way to synchronize correctly is
using the grouphere instruction, which has a bug.
I've already proposed the fix to Vim, so future releases
should have this working. We can continue using the 500 lines
syncing for now.
This change just documents the proper way to sync.
R=adg, dsymonds
CC=golang-dev
https://golang.org/cl/4029047
New ftplugin adds Import and Drop commands for Go buffers
in Vim. These commands ensure that the provided package is
imported (or not imported) in the current Go buffer, using
proper style and ordering, without moving the cursor.
E.g.
:Import strings
:ImportAs . strings
:Drop strings
Two mappings are also introduced to help with the fmt package:
\f => :Import fmt
\F => :Drop fmt
R=adg
CC=golang-dev
https://golang.org/cl/4009043
Based on the review of CL 1723044, I've changed the installation instructions
for the vim syntax files to suggest symlinking the files rather than copying
the files. Also the wording has changed to be more consistent.
R=golang-dev, Kyle Lemons, adg
CC=golang-dev
https://golang.org/cl/1702045
This sets up vim to work out of the box with go programs as long as syntax
highlighting is enabled. Both files must be copied to the vim runtime
directory in order for the file-type detection and syntax loading to work.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/1723044