1
0
mirror of https://github.com/golang/go synced 2024-11-12 08:20:22 -07:00
Commit Graph

52 Commits

Author SHA1 Message Date
Yasuhiro Matsumoto
7413e48d5b misc/vim: Fix broken quote
R=golang-codereviews, gobot, dsymonds
CC=golang-codereviews
https://golang.org/cl/44960043
2013-12-24 08:40:13 +11:00
Shenghou Ma
e962f8f1c6 misc/vim: use shiftwidth() instead of &sw if available.
Fixes #6841.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/43010044
2013-12-16 20:05:48 -05:00
David Symonds
ee261b75e1 misc/vim: send Fmt errors to the quickfix list instead of the location list.
Output from gofmt is a list of errors, so they should appear in the error list.

R=adg
CC=golang-dev
https://golang.org/cl/33760043
2013-11-27 19:32:15 +11:00
David Symonds
74eb115b1c misc/vim: describe how to get gofmt-on-save behaviour.
Fixes #6826.

R=golang-dev, bradfitz, adg
CC=golang-dev
https://golang.org/cl/31770043
2013-11-25 11:03:47 +11:00
David Crawshaw
c4f5421bc7 misc/vim: add a gofmt_command flag for :Fmt
R=dsymonds, dominik.honnef, n13m3y3r, rsc, kamil.kisiel
CC=golang-dev
https://golang.org/cl/22940044
2013-11-12 09:28:07 +11:00
Yasuhiro Matsumoto
5516349fe7 misc/vim: complete packages in src directory
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/14454059
2013-10-11 11:30:03 +11:00
Yasuhiro Matsumoto
45b830ed31 misc/vim: Autocompletion for :Godoc command
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/14259043
2013-10-03 13:32:07 +10:00
Yasuhiro Matsumoto
fcee50c46e misc/vim: Separate package and package members.
This change allow to godoc:
    :Godoc github.com/mattn/go-gtk/gtk
    :Godoc github.com/mattn/go-gtk/gtk NewWindow
    :Godoc encoding/json
    :Godoc encoding/json Marshal

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/14171043
2013-10-02 08:52:51 +10:00
Yasuhiro Matsumoto
d6eada282e misc/vim: "PACKAGE DOCUMENTATION" is not hilighted
R=golang-dev, r, dsymonds
CC=golang-dev
https://golang.org/cl/14018043
2013-09-27 12:57:09 +10:00
Yasuhiro Matsumoto
b128426804 misc/vim: godoc is optional. so should point installation instruction.
R=golang-dev, r, dsymonds
CC=golang-dev
https://golang.org/cl/14017043
2013-09-27 12:35:03 +10:00
Yasuhiro Matsumoto
efced7c6e9 misc/vim: Allow multiple GOOS/GOARCH.
R=golang-dev, dsymonds, dominik.honnef
CC=golang-dev
https://golang.org/cl/9293043
2013-07-02 15:24:09 +10:00
David Bürgin
aec6b49aae misc/vim: Add compiler plugin for Go
This change adds a basic compiler plugin for Go. The plugin
integrates "go build" with Vim's ":make" command and the
quickfix list.

Fixes #5751.

R=golang-dev, dsymonds, niklas.schnelle, 0xjnml
CC=golang-dev
https://golang.org/cl/10466043
2013-07-01 16:20:50 +10:00
David Bürgin
c1e780c4e4 misc/vim: Added filetype settings for comments.
This basic Vim ftplugin sets the 'comments' and 'commentstring'
settings to sensible values. Future filetype settings for Go
would go in the same file.
The ftplugin was added as misc/vim/ftplugin/go/go.vim, this way
the installation instructions in readme.txt remain valid.
Fixes #5715.

R=dsymonds
CC=gobot, golang-dev
https://golang.org/cl/10323043
2013-06-18 14:59:50 +10:00
Josh Hoak
b76ddefee5 misc/vim: Adding flag-guarding for Vim commands
Default behavior is the same as before, but now a user may selectively disable some commands.

Also: deleted the mappings for import.vim.

Tested: by trying the commands for fmt, import and godoc in succession to make sure they still work. Also, ran test.sh in ftplugin/go.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/10124043
2013-06-13 15:07:09 +10:00
Bill Thiede
27f7e3b217 misc/vim: test.sh seems to only work on Mac OS X.
cmp(1) on FreeBSD requires two file arguments.  grep -P on Linux (at least
Ubuntu 12.04) is described in the man page as "This is highly
experimental" and doesn't seem to work. On FreeBSD the man page states
"This option  is not supported in FreeBSD."  Needed this to work while
debugging some funky behavior of 'Import' in my local vim setup.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7675043
2013-05-14 09:54:16 -07:00
Yasuhiro Matsumoto
d7434816c1 misc/vim: make Godoc command work with "log.Print".
R=dsymonds
CC=golang-dev
https://golang.org/cl/7757043
2013-03-26 17:39:46 +11:00
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