News for hackers. Stuff that matters.
Re:Vim setup for Go by sinatra on Thursday September 24, 2015 @10:53AM (#10271936)
I've been using vim-go for about one year now. The combination of vim-go, gofmt and YouCompleteMe is all you need for a perfect Go setup. Thanks to Fatih and Val!
Re:Vim setup for Go by akavel on Thursday September 24, 2015 @02:05PM (#10273360)
I suggest you try https://github.com/garyburd/go-explorer too! (From creator of godoc.org.) In short words, it's godoc with hyperlinks (in your vim). I use it both for doc (so I don't have to switch to browser), and for project-wide navigation.

    :GeDoc net/http         --> opens a "gedoc" split
    :GeDoc fmt Printf       --> + jump to specific identifier
                                (note: full TAB-completion)
    :GeDoc \html_template   --> + resolve import alias like:
                                import html_template "html/template"
    zM                --> fold all
    zo                --> unfold current
    zc                --> fold current
    Ctrl-]            --> "follow link under cursor"
    Ctrl-A            --> show all! (i.e. unexported too)
Re:Vim setup for Go by vinceyuan on Thursday September 24, 2015 @08:51PM (#10275842)
YouCompleteMe crashes frequently on my mac. I can't find a solution. Does someone here have a solution?
Re:Vim setup for Go by beefsack on Thursday September 24, 2015 @09:59PM (#10276027)
I switched from YCM to neocomplete[1] a few months ago and haven't looked back, performance is much better. I'm on Arch and never really had crashes with YCM, but if the crashes are performance related it might help.

[1] https://github.com/Shougo/neocomplete.vim

Re:Vim setup for Go by vinceyuan on Thursday September 24, 2015 @11:01PM (#10276162)
I need to use YouCompleteMe for C++ autocomplete.
Re:Vim setup for Go by grimgrin on Thursday September 24, 2015 @12:11PM (#10272444)
goimports is so dang nice, too. If for some reason you overlooked it on the README:

Enable goimports to automatically insert import paths instead of gofmt:

let g:go_fmt_command = "goimports"

Re:Vim setup for Go by sinatra on Thursday September 24, 2015 @12:44PM (#10272709)
Yes I do use goimports. Also very useful.
Re:Vim setup for Go by farslan on Thursday September 24, 2015 @03:41PM (#10274117)
You're welcome! It's my pleasure. I'm really happy to see people writing Go in a more productive environment.
Re:Vim setup for Go by ankushio on Thursday September 24, 2015 @03:46PM (#10274149)
I am not a vim user and I've been using IntelliJ IDEA to code in GoLang for about an year now and I find it extremely powerful. It is powered using the GoLang IntelliJ plugin : https://github.com/go-lang-plugin-org/go-lang-idea-plugin

It provides : 1) Error Highlighting, 2) Auto Completion, 3) Click-to-Navigate, 4) Auto Formatting, 5) Auto Importing, among other features.

Re:Vim setup for Go by jmcphers on Thursday September 24, 2015 @05:59PM (#10275050)
This. I've seen my teammates try other Go IDE integrations but this just beats the pants off all of them and our whole team wound up standardizing on it.

It combines well with Tim Pope's dispatch plugin for doing an async 'go build' or 'go test' while you code:

https://github.com/tpope/vim-dispatch

Re:Vim setup for Go by todd8 on Thursday September 24, 2015 @12:41PM (#10272683)
Can someone recommend a set of Emacs libraries that works as well as this? I'm about to embark on a real project in go.
Re:Vim setup for Go by IanMalcolm on Thursday September 24, 2015 @12:44PM (#10272711)
Re:Vim setup for Go by todd8 on Thursday September 24, 2015 @12:53PM (#10272785)
Spacemacs has so much in it that I've been avoiding looking into it. It seems to do everything! I'll try it out, thanks.
Re:Vim setup for Go by aliem on Thursday September 24, 2015 @04:20PM (#10274395)
On the bright side it does have a nice modular configuration in `~/.spacemacs`.
Re:Vim setup for Go by bdarnell on Thursday September 24, 2015 @03:37PM (#10274093)
I use go-mode, go-eldoc, gotest, company-go, and go-projectile (along with non-go-specific packages like flycheck, which has built-in go support).
Re:Vim setup for Go by donatj on Friday September 25, 2015 @12:24AM (#10276356)
I still swear by LiteIDE. If you write go, you should try it, you will not be disappointed.
Re:Vim setup for Go by jshen on Thursday September 24, 2015 @12:36PM (#10272625)
go-plus for atom is also really nice if you are using atom.

https://github.com/joefitzgerald/go-plus

Re:Vim setup for Go by hit8run on Thursday September 24, 2015 @11:22AM (#10272109)
I'm a fan of go sublime but vim-go is also really nice :)
Re:Vim setup for Go by pella on Thursday September 24, 2015 @01:51PM (#10273259)
yes,

good alternative : (Dockerfile) Sublime Text 3 for Go

https://github.com/jgautheron/dockerfiles/blob/master/sublim...

Re:Vim setup for Go by srathi on Thursday September 24, 2015 @01:40PM (#10273164)
Slightly offtopic: anyone has a similar setup for Python?
Re:Vim setup for Go by Spiritus on Thursday September 24, 2015 @04:02PM (#10274276)
Re:Vim setup for Go by iankp on Thursday September 24, 2015 @02:10PM (#10273407)
I don't use Go so I can't compare these packages directly but you may wish to look into klen/python-mode
Re:Vim setup for Go by agentargo on Thursday September 24, 2015 @03:52PM (#10274189)
Re:Vim setup for Go by seletskiy on Thursday September 24, 2015 @12:48PM (#10272747)
It's really nice, but lack specific feature of auto-importing packages while typing. Like, if you type `fmt.` and package is not imported yet, you'll not see any completions.

So, I've implemented it a while ago in separate coding-helping plugin, see the gif: https://github.com/reconquest/vim-pythonx#autoimport

UPD: also, some gifs, showing how coding routine I believe should be done (Golang taken as example): https://github.com/reconquest/snippets#let-me-show. Type less, get more.

Re:Vim setup for Go by farslan on Thursday September 24, 2015 @03:40PM (#10274105)
Author here. Vim doesn't have type by completion support, however it imho has completion, but it needs to be triggered manually with a key shortcut(such as C-X C-O). Plugins like YCM changes this behavior to on the fly completion.

For gifs, I have couple of screencasts already (all in Wiki: https://github.com/fatih/vim-go/wiki/Screencasts), but yeah we could definitely add a GIF, but my time is limited for this kind of stuff :)

Re:Vim setup for Go by jweir on Thursday September 24, 2015 @12:55PM (#10272808)
It does, just not by default, and only on save – not while typing.

> Enable goimports to automatically insert import paths instead of gofmt:

> let g:go_fmt_command = "goimports"

Re:Vim setup for Go by seletskiy on Thursday September 24, 2015 @01:17PM (#10272978)
Yeah, only on save.

It's deal breaker for me, I want to see completions immediately, not by entering `fmt.`, saving file, backspacing, re-entering `.`.

Re:Vim setup for Go by fizzbatter on Thursday September 24, 2015 @01:43PM (#10273192)
On the flipside, what implements this functionality you speak of? I ask, because you mention it being a deal breaker for vim-go, so i'm curious what you currently use?
Re:Vim setup for Go by seletskiy on Thursday September 24, 2015 @02:08PM (#10273393)
I'm using vim-go, I just implemented autoimport functionality on top of it.
Re:Vim setup for Go by artursapek on Thursday September 24, 2015 @02:35PM (#10273616)
Why? I code Go in Vim every day, and I think goimports is perfect. I don't even think about the import ( ... ) block at the top - I just use what packages I want, save my code, and let the machine take care of the imports. If you have your GOPATH set up properly, it works 100% of the time.
Re:Vim setup for Go by seletskiy on Friday September 25, 2015 @01:51AM (#10276559)
Looks like I was not clear enough. goimports works perfectly, but only on buffer save event (or by manual trigger).

Take an example, start from scratch:

  package main
  
  func main() {
    fmt|
  }
Cursor is at |, and when I type ., I immediatelly have fmt package imported and see completion menu for fmt package (without leaving insert mode or saving file, just by typing dot).

Out of the box vim-go doesn't provide that.

Re:Vim setup for Go by artursapek on Friday September 25, 2015 @07:59AM (#10277606)
Ah, you want the full package exports available for autocomplete? Have you found a way to do that?
Re:Vim setup for Go by sinatra on Thursday September 24, 2015 @01:47PM (#10273226)
I think slightly differently. I don't think I import enough packages for "save file after first usage" to become a deal breaker.