Vim-go: jump-to-definition is slow on Mac

Created on 28 Nov 2018  路  7Comments  路  Source: fatih/vim-go

What did you do? (required. The issue will be closed when not provided.)

I put my cursor on an identifier and hit ctrl-].

What did you expect to happen?

I expected it to instantaneously jump to the definition of the identifier.

What happened instead?

It jumped to the definition after about 5 seconds.

Configuration (MUST fill this out):

  • vim-go version:
    c9b5c0905466623f3d65366f4ac162fbeb92f8c7

  • vimrc you used to reproduce (use a minimal vimrc with other plugins disabled; do not link to a 2,000 line vimrc):

autocmd VimEnter * setlocal autochdir
highlight LineNr ctermfg=darkgrey
set nonumber
set autochdir
set ignorecase
set noswapfile
set ruler
set autoindent
set backspace=indent,eol,start
colorscheme slate
syntax on
" \s prompts for a replacement of the token under the cursor.
nnoremap s :%s/\<>/
filetype plugin on
filetype indent on
" Use tabs in Makefiles.
autocmd FileType make setlocal noexpandtab
let g:go_fmt_command = "goimports"

  • Vim version (first three lines from :version):
    VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Nov 29 2017 18:37:46)
    Included patches: 1-503, 505-680, 682-1283
    Compiled by [email protected]

  • Go version (go version):
    go version go1.11.2 darwin/amd64

  • Go environment (go env):
    GOARCH="amd64"
    GOBIN=""
    GOCACHE="/Users/issactrotts/Library/Caches/go-build"
    GOEXE=""
    GOFLAGS=""
    GOHOSTARCH="amd64"
    GOHOSTOS="darwin"
    GOOS="darwin"
    GOPATH="/Users/issactrotts"
    GOPROXY=""
    GORACE=""
    GOROOT="/Users/issactrotts/homebrew/Cellar/go/1.11.2/libexec"
    GOTMPDIR=""
    GOTOOLDIR="/Users/issactrotts/homebrew/Cellar/go/1.11.2/libexec/pkg/tool/darwin_amd64"
    GCCGO="gccgo"
    CC="clang"
    CXX="clang++"
    CGO_ENABLED="1"
    GOMOD=""
    CGO_CFLAGS="-g -O2"
    CGO_CPPFLAGS=""
    CGO_CXXFLAGS="-g -O2"
    CGO_FFLAGS="-g -O2"
    CGO_LDFLAGS="-g -O2"
    PKG_CONFIG="pkg-config"
    GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/x7/5zsztt1s5c1gc_7prrq9zn5h001n0v/T/go-build551086157=/tmp/go-build -gno-record-gcc-switches -fno-common"

Most helpful comment

The time it take to jump to a definition is primarily influenced by the speed of the tool that vim-go uses to determine where to jump to. guru is the default. If it's too slow for your purposes, try setting g:go_def_mode='godef' to use godef instead.

All 7 comments

The time it take to jump to a definition is primarily influenced by the speed of the tool that vim-go uses to determine where to jump to. guru is the default. If it's too slow for your purposes, try setting g:go_def_mode='godef' to use godef instead.

Guru is slow the lucky this mode still can move cursor and do other thing,

Godef is slower than guru and block all

guru is too slow to be useful. It should not be the default option at all.

guru is too slow to be useful. It should not be the default option at all.

did you find a faster tool in the end? If so, which one?

Never mind, switched to godef and it's fast enough for me :)

I also switched to godef and it works now! With the default options, it is really too slow.
Are there functional differences between godef and the default?

For newcomers, add the following line to ~/.vimrc:
let g:go_def_mode='godef'

I also switched to godef and it works now! With the default options, it is really too slow.
Are there functional differences between godef and the default?

For newcomers, add the following line to ~/.vimrc:
let g:go_def_mode='godef'

This works!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johnzeng picture johnzeng  路  3Comments

mnarrell picture mnarrell  路  3Comments

andrejvanderzee picture andrejvanderzee  路  3Comments

zhangjing picture zhangjing  路  3Comments

preslavmihaylov picture preslavmihaylov  路  3Comments