3 ms·
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 an
by seletskiy 11y ago
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 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 https://github.com/reconquest/snippets#let-me-show. Type less, get more.
- sinatra 11y agoI think slightly differently. I don't think I import enough packages for "save file after first usage" to become a deal breaker.
- jweir 11y agoIt 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"
- seletskiy 11y agoYeah, only on save. It's deal breaker for me, I want to see completions immediately, not by entering `fmt.`, saving file, backspacing, re-entering `.`.
- fizzbatter 11y agoOn 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?
- seletskiy 11y agoI'm using vim-go, I just implemented autoimport functionality on top of it.
- artursapek 11y agoWhy? 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.
- seletskiy 11y agoLooks 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.
- artursapek 11y agoAh, you want the full package exports available for autocomplete? Have you found a way to do that?
- farslan 11y agoAuthor 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 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 :)