Closed janko closed 11 years ago
This is an unacceptable trade-off in my book. Shit gets mad confusing when you accidentally forget to cd.
Aha, I see what you mean. It's impossible for me to forget to cd
into my project, because I'm using Terminal Vim (so I execute all commands from it). It's a shame, it would be really perfect browsing. This is an awesome feature what vim-bundler does, it just doesn't feel complete this way.
For example, vim-ruby does the same thing; it doesn't look for .ruby-version
in :pwd
, and then after 2 jumps you suddenly switched ruby versions :)
What about a fallback to :pwd
(if there's no Gemfile in the currently opened project)?
I wanted exactly the same behaviour, i.e. when I navigate away to Gem directories from my Rails project, I should be able to dig deeper into the tags. Here is what I am doing (o'course this is hackish):
let $GEMPATH__LOCAL = system("gem env home")[:-2] . "/gems"
augroup gem_ctags
au!
au BufEnter $GEMPATH__LOCAL/**/*.rb setl tags+=$GEMPATH__LOCAL/*/tags
au BufLeave $GEMPATH__LOCAL/**/*.rb setl tags-=$GEMPATH__LOCAL/*/tags
augroup END
This may/should help others looking for this.
A slightly cleaner version of that might use something like let &l:tags = getbufvar('#', 'tags')
, which steals the tags list from the previous buffer. You could do the same for 'path'
too. A really clean solution (and one that I would consider merging) would check the Bundler project of the previous buffer to see if the current file belongs to one of its gems.
I took a slightly closer look at this and accidentally ended up implementing a solution. Very lightly tested so let me know how it works.
:laughing: "accidentally ended up implementing a solution"
thanks Tim!
Works for me, thank you!
TL;DR: Is it possible for vim-bundler to look in for the Gemfile in
:pwd
, rather than relative to the currently opened project?I open my project in Vim. Then I
:find rails
. And then I try togf
underactive_support
, but I can't. When I look at Vim'spath
, I see that my gems aren't there anymore. I assume that's because vim-bundler looks for the Gemfile relative to the currently opened project (Railties, in this case). And therailties
gem, like most others, doesn't include their Gemfile in the installed gem, so I can't:find
ActiveSupport.Could vim-bundler look for the Gemfile in
:pwd
, which is always equal to the working directory?