Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go_def_reuse_buffers does not jump to buffer #2927

Closed
Kimchelly opened this issue Jun 18, 2020 · 0 comments · Fixed by #2928
Closed

go_def_reuse_buffers does not jump to buffer #2927

Kimchelly opened this issue Jun 18, 2020 · 0 comments · Fixed by #2928

Comments

@Kimchelly
Copy link

My current solution to this has been to replace this line in autoload/go/def.vim with this:

call win_gotoid(win_getid(bufwinnr(filename)))

This doesn't jump to the correct existing buffer if it's in a different tab, but I almost never use tabs.

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

Set go_def_reuse_buffers = 1, then use :GoDef on one window when there was another split window with the file containing the definition it should jump to.

What did you expect to happen?

Cursor would jump to the other window to the line containing the definition.

What happened instead?

Cursor stayed in the same window (the one without the definition), but jumped to the line where the definition is in the other file.

Configuration (MUST fill this out):

vim-go version:

v1.23

vimrc you used to reproduce:

vimrc
set rtp^=~/.vim rtp+=~/.vim/after
call plug#begin('~/.vim/plugged')
Plug 'fatih/vim-go', {'tag': 'v1.23'}
call plug#end()
let g:go_def_reuse_buffer = 1

Vim version (first three lines from :version):

NVIM v0.4.3
Build type: Release
LuaJIT 2.0.5

I also reproduced on macOS vim version:
VIM - Vi IMproved 8.1 (2018 May 18, compiled Oct 30 2019 11:57:56)
macOS version
Included patches: 1-2234

Go version (go version):

go version go1.13.4 darwin/amd64

Go environment

go env Output:
GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/kim/Library/Caches/go-build"
GOENV="/Users/kim/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/kim/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.13.4/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.13.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
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/93/py02whns7rs9bm43swcmd8ww0000gn/T/go-build413443133=/tmp/go-build -gno-record-gcc-switches -fno-common"

gopls version

gopls version Output:
golang.org/x/tools/gopls 0.4.1
    golang.org/x/tools/gopls@v0.4.1 h1:0e3BPxGV4B3cd0zdMuccwW72SgmHp92lAjOyxX/ScAw=

vim-go configuration:

vim-go configuration
g:go_loaded_install = 1
g:go_jump_to_error = 1
g:go_def_reuse_buffer = 1
g:go_loaded_gosnippets = 1

filetype detection configuration:

filetype detection
filetype detection:ON  plugin:ON  indent:ON
bhcleek added a commit to bhcleek/vim-go that referenced this issue Jun 18, 2020
Use the window id, not the window number when jumping to the window by
id.

Fixes fatih#2927
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant