1
0
mirror of https://github.com/golang/go synced 2024-11-05 18:46:11 -07:00
Commit Graph

36 Commits

Author SHA1 Message Date
David Symonds
8ecc4cb41e misc/vim: update installation instructions to work better with some Linux distributions.
Fixes #3308.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7301086
2013-02-18 14:03:47 +11:00
Andrew Radev
c8fe9c7606 misc/vim: fix reimport guard and remove K mapping.
The "did_ftplugin" lines were ineffective and the "K" mapping was too
invasive, which is why it was removed.

R=golang-dev, dsymonds, minux.ma
CC=golang-dev
https://golang.org/cl/6823044
2012-10-29 22:10:59 +11:00
David Symonds
adcf0a2aa0 misc/vim: fix Drop for imports after the first group.
Previously, an import block such as
	import (
        	"net"

                "stack"
        )
would not permit ":Drop stack" to work because we were aborting
the scan early, which is only correct when Import is in operation.

R=golang-dev, franciscossouza
CC=golang-dev
https://golang.org/cl/6532053
2012-09-20 08:11:07 +10:00
Tobias Columbus
5e8de365dc misc/vim: fix for autocompletion
Vim autocompletion respects the $GOPATH variable and does not
    ignore dashes ('-'), dots ('.') and underscores ('_') like found
    in many remote packages.
    Environment variable $GOROOT is determined by calling
    'go env GOROOT' instead of relying on the user's environment
    variables.

    Fixes #3876
    Fixes #3882

R=golang-dev, franciscossouza, dsymonds, minux.ma
CC=golang-dev
https://golang.org/cl/6443151
2012-08-28 03:59:16 +08:00
David Symonds
3294404900 misc/vim: fix :Import insertion heuristic.
If a factored import group has a blank line, assume it is dividing
separate groups of imports (e.g. standard library vs. site-specific).
        import (
                "bytes"
                "io"

                "mycorp/package"
        )

The most common case is inserting new standard library imports,
which are usually (stylistically) the first group, so we should drop
"net" in the above example immediately after "io".

Since this logic is getting non-trivial, add a test.

R=golang-dev, minux.ma, franciscossouza
CC=golang-dev
https://golang.org/cl/6445043
2012-07-30 08:48:51 +10:00
Yasuhiro Matsumoto
2fc5dd66df misc/vim: restore fileencodings.
Currently, ftdetect/gofiletype.vim set fileencodings to open the file as
utf-8 encoding event if the file does not contain multibyte characters.
But fileencodings is global option.

$ vim foo.txt
:set fileencodings
utf-8,ucs-bom,cp932

$ vim foo.go
:set fileencodings
utf-8

This change restore fileencodings before opening the file.
Also added specify fileformats=unix.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5718045
2012-03-14 18:43:01 +11:00
Paul Sbarra
41f4ba3ae5 vim: fix go filetype detection
The filetype needs to be set during BufRead in order for the did_filetype() check to prevent the file being detected as a conf file.  One example where this can occur is if a cgo file has a #include at the top of the file.  The # is detected in vim's generic configuration (conf file) toward the bottom of filetype.vim

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5496066
2011-12-19 10:42:32 +11:00
David Symonds
782fd1fc98 misc/vim: add error type.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5331046
2011-11-01 21:47:07 -04:00
Jongmin Kim
0d8fb375ed misc/vim: Add rune keyword
According to adding rune type

R=adg, dsymonds
CC=golang-dev
https://golang.org/cl/5319048
2011-10-27 09:13:06 +11:00
Dave Cheney
57d07e32d8 misc/vim: add highlighting for delete
R=golang-dev, n13m3y3r
CC=golang-dev
https://golang.org/cl/5303050
2011-10-19 18:30:06 -02:00
Paul Sbarra
3dc3fa0d8c vim: Send GoFmt errors to a location list
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5043046
2011-09-23 09:38:10 +10:00
Yasuhiro Matsumoto
d2a45dbf08 misc/vim: command complete using autoload helper function.
R=golang-dev, dsymonds, jnwhiteh, n13m3y3r, gustavo
CC=golang-dev
https://golang.org/cl/4837051
2011-08-18 11:50:55 +10:00
Yasuhiro Matsumoto
b32e210586 misc/vim: Godoc command.
vim command 'Godoc' to see godoc.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4815071
2011-08-03 16:46:35 +10:00
Yasuhiro Matsumoto
369418d29c misc/vim: allow only utf-8 for fileencoding (fix CL4625078).
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4650062
2011-06-30 17:07:44 +10:00
Yasuhiro Matsumoto
51a79d0306 misc/vim: allow only utf-8 for fileencoding.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4625078
2011-06-30 16:19:53 +10:00
Yasuhiro Matsumoto
c6fd1e0115 misc/vim: limit Fmt command to Go buffers.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4548072
2011-05-30 12:20:00 +10:00
David Symonds
816f4bb1d8 misc/vim: drop indent support for jump labels.
It interferes with keys in composite literals,
which are much more common.

R=dchest, jnwhiteh, rlight2
CC=golang-dev
https://golang.org/cl/4521065
2011-05-14 09:45:32 -07:00
David Symonds
1a7d09c847 misc/vim: new Vim indentation script.
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
2011-05-13 08:29:44 -07:00
Dmitry Chestnykh
89901bbd14 misc/vim: add plugin with Fmt command.
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
2011-04-13 11:55:41 +10:00
David Symonds
dd4423292e misc/vim: update type highlighting for new reflect package
R=adg
CC=golang-dev
https://golang.org/cl/4385051
2011-04-11 08:48:19 +10:00
David Symonds
aad62bf409 misc/vim: remove 'closed' as a builtin function.
R=adg, r
CC=golang-dev
https://golang.org/cl/4285059
2011-03-23 14:26:28 +11:00
Ross Light
d7eacee603 misc/vim: Add indent script for Vim
R=adg
CC=golang-dev
https://golang.org/cl/4258041
2011-03-08 15:42:23 +11:00
Gustavo Niemeyer
5887ef7571 misc/vim: Define import commands on buffer switch
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
2011-02-01 11:12:57 +11:00
Gustavo Niemeyer
400d7772cc misc/vim: Document better syntax sync parameter
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
2011-02-01 11:12:45 +11:00
Yasuhiro Matsumoto
90585bde37 misc/vim/syntax: set large value to 'syntax sync'.
R=golang-dev, dsymonds, adg
CC=golang-dev
https://golang.org/cl/4102044
2011-01-27 23:03:52 +10:00
Gustavo Niemeyer
4e5e0b1d20 misc: Import/Drop commands for Vim
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
2011-01-25 11:36:13 +10:00
Russ Cox
5cfadeb047 misc: update type + builtin lists found in editor support files
R=adg, dsymonds
CC=golang-dev
https://golang.org/cl/4072041
2011-01-19 23:07:49 -05:00
David Symonds
0451cd1950 misc/vim: update list of builtins.
R=adg
CC=golang-dev
https://golang.org/cl/2807041
2010-10-30 22:07:01 +11:00
Christian Himpel
3dc6c9e64d misc/vim: highlight misspelled words only in comments
R=adg
CC=golang-dev
https://golang.org/cl/1915043
2010-08-05 10:31:00 +10:00
Petar Maymounkov
2b3508425e misc/vim: updated syntax file to recognize constants of the form 1e9
R=rsc, adg
CC=golang-dev
https://golang.org/cl/1864042
2010-07-23 11:33:17 +10:00
Andrew Gerrand
00d838b7b5 misc/vim: always override filetype detection for .go files
R=adg
CC=golang-dev
https://golang.org/cl/1665043
2010-06-22 15:22:49 +01:00
James Whitehead
5cb4f82bbc misc/vim: clarifies syntax highlighting installation instructions
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
2010-06-21 07:35:24 +02:00
James Whitehead
d67717c29b misc/vim: reorganize plugin so it uses ftplugin and syntax
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
2010-06-20 11:46:12 +02:00
David Symonds
72a3f5329d Add new complex types, functions and literals to Vim syntax file.
R=rsc
CC=golang-dev
https://golang.org/cl/224042
2010-03-15 20:38:24 -07:00
David Symonds
42ec02be36 Add 'copy' as a Go builtin function for Vim syntax highlighter spec.
R=rsc
https://golang.org/cl/163049
2009-12-01 16:45:21 -08:00
David Symonds
0ba28329e4 Add a Vim syntax highlighting file for Go.
APPROVED=rsc
DELTA=190  (190 added, 0 deleted, 0 changed)
OCL=35073
CL=35128
2009-09-29 18:43:20 -07:00