-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add GoDef without split in current buffer #1003
Comments
Hi @oryband Did you tried |
If The reason I'm using function! GoToDef()
if &ft == 'go'
execute 'GoDef'
elseif &ft == 'javascript'
execute 'TernDef'
else
execute 'YcmCompleter GoTo'
endif
endfunction
nnoremap <leader>] :call GoToDef()<CR> |
Did you just called |
I'll verify if this also happens with On Sun, Sep 4, 2016 at 6:51 PM Fatih Arslan notifications@github.com
oryband@gmail.com |
@fatih I'm running c63c798 and noticed this as well. When I use let g:go_fmt_command = "goimports"
let g:go_autodetect_gopath = 1
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_generate_tags = 1
let g:go_highlight_structs = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
let g:go_auto_type_info = 1
let g:go_auto_sameids = 1
let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck']
let g:go_metalinter_autosave = 1
let g:go_metalinter_autosave_enabled = ['vet', 'golint']
let g:go_metalinter_deadline = "5s"
let g:go_list_type = "quickfix"
" vim-go command shortcuts
autocmd FileType go nmap <leader>r <Plug>(go-run)
autocmd FileType go nmap <leader>t <Plug>(go-test)
autocmd FileType go nmap <leader>a <Plug>(go-alternate-edit)
autocmd FileType go nmap <leader>d :GoDeclsDir<CR>
autocmd FileType go nmap <leader>g <Plug>(go-generate)
" run :GoBuild or :GoTestCompile based on the go file
function! s:build_go_files()
let l:file = expand('%')
if l:file =~# '^\f\+_test\.go$'
call go#cmd#Test(0, 1)
elseif l:file =~# '^\f\+\.go$'
call go#cmd#Build(0)
endif
endfunction
autocmd FileType go nmap <leader>b :<C-u>call <SID>build_go_files()<CR>
function! s:toggle_coverage()
call go#coverage#BufferToggle(!g:go_jump_to_error)
highlight ColorColumn ctermbg=235
highlight NonText ctermfg=239
highlight SpecialKey ctermfg=239
highlight goSameId term=bold cterm=bold ctermbg=250 ctermfg=239
endfunction
autocmd FileType go nmap <leader>c :<C-u>call <SID>toggle_coverage()<CR> |
Both myself and a few colleagues share the same experience. It's not a 100% consistent, so it sometimes it opens in the current buffer and sometimes it opens a new split. We're using |
same problem here, sometimes it opens in the current buffer and sometimes it opens a new split. |
this is super frustrating, anyone found a workaround? |
I noticed it (in my case at least) does a split when my source file isn't saved, and it replaces the current buffer when the source file is saved... So since I know that it feels less weird 😉 |
As @svanharmelen (thanks for the clue) said it was due something we added at #944. I've removed that case as I think there shouldn't be a case for modified flags. Pull the latest master and let me know how it works. |
Thanks @fatih I'll let you know if I run into it again. |
I'm trying to use
:GoDef
and it's shortcuts to jump to definition while staying in the same buffer window, without splitting the buffer or opening a new tab.I've set
let g:go_def_reuse_buffer = 1
but this doesn't seem to do anything.Configuration
Add here your current configuration and additional information that might be
useful, such as:
.vimrc
, redirect to vim-go sectionThe text was updated successfully, but these errors were encountered: