]> Cypherpunks repositories - gostls13.git/commit
misc/vim: fix :Import insertion heuristic.
authorDavid Symonds <dsymonds@golang.org>
Sun, 29 Jul 2012 22:48:51 +0000 (08:48 +1000)
committerDavid Symonds <dsymonds@golang.org>
Sun, 29 Jul 2012 22:48:51 +0000 (08:48 +1000)
commit32944049007e1ddaac2138a9e6a018ee412c84be
tree6fbf634e6bf2bdd9f4e090839996798a76641575
parent4dc85d67cdaef157e0907c63cb276e448b6cbafe
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
misc/vim/ftplugin/go/import.vim
misc/vim/ftplugin/go/test.sh [new file with mode: 0755]