Skip to content

Commit

Permalink
Load buffers with :GoDef relative to cwd (#1277)
Browse files Browse the repository at this point in the history
If I use `gd` on an identifier the filename for the new buffer is set to:

    ~/work/src/github.com/teamwork/desk/server/server.go

Instead of than:

    server/server.go

This makes it open the relative directory, making it behave as `:e
server/server.go`.

I *think* this change should be safe and will work for everyone? I'm not 100% of
that, though. Perhaps we should add a setting?
  • Loading branch information
arp242 authored Sep 7, 2017
1 parent 506ddaf commit 5db7dd6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ IMPROVEMENTS:
* Add package-level comment folding [gh-1377]
* Allow using :GoImpl on the type and struct parts too. Makes it a wee bit
easier to use [gh-1386]
* `:GoDef` sets the path of new buffers as relative to the current directory
when appropriate, instead of always using the full path [gh-1277].

BUG FIXES:

Expand Down
2 changes: 1 addition & 1 deletion autoload/go/def.vim
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function! go#def#jump_to_declaration(out, mode, bin_name) abort
endif

" open the file and jump to line and column
exec cmd fnameescape(filename)
exec cmd fnameescape(fnamemodify(filename, ':.'))
endif
endif
call cursor(line, col)
Expand Down

0 comments on commit 5db7dd6

Please sign in to comment.