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

BufEnter should trigger ProjectionistDetect #123

Open
AntonyBlakey opened this issue Jan 12, 2019 · 7 comments
Open

BufEnter should trigger ProjectionistDetect #123

AntonyBlakey opened this issue Jan 12, 2019 · 7 comments

Comments

@AntonyBlakey
Copy link

I am on Neovim 0.3.1 on Ubuntu.

When I use gf to go to a file, and then Ctrl-O to come back, the path seems reset i.e. doesn't include the "path" key entries from my .projections.json file. The other settings ("start" & "make") are unaffected by the gf/Ctrl-O dance. I found that adding the following in my init.vim fixes the problem. I am a relative newbie to vim, so I'm not sure if this is the best fix.

  augroup projectionist-fix
    autocmd!
    autocmd BufEnter *
          \ if (&filetype ==# 'netrw' && !exists('b:projectionist')) ||
          \     &buftype !~# 'nofile\|quickfix' |
          \   call ProjectionistDetect(expand('%:p')) |
  augroup END
@tpope
Copy link
Owner

tpope commented Jan 13, 2019

Check :verbose set path? to see what might be clobbering it. BufEnter fires on all sorts of things so it's a crude hammer to swing at this problem.

@AntonyBlakey
Copy link
Author

It's vim-apathy :( Doesn't play well with vim-projectionist's "path" key.

@tpope
Copy link
Owner

tpope commented Jan 13, 2019

What filetype? Apathy mostly appends and prepends so it's (probably) not the root cause.

@AntonyBlakey
Copy link
Author

C/C++.

I removed my 'fix', and on a hunch removed vim-apathy. Suddenly everything was cool. So it might be a more complicated chain of interactions, but that's a pretty simple datapoint.

I haven't done the :verbose debug technique because I've now started working on a solution using compile_commands.json to update the .projections.json path key. I have a cross-platform build chain, so in any case I need the dynamic determination of platform-dependent builtin paths.

@tpope
Copy link
Owner

tpope commented Jan 13, 2019

Are you sure it's not just sorted differently than you expect?

@AntonyBlakey
Copy link
Author

No - when I come back from gf + C-o the path addition from projectionist is gone on my c file (it's reset to the apathy-computed value) , and no subsequent gf in that file works.

But yes apathy + projectionist does initially break the projectionist comment about the path addition being prepended to the path, which was only a minor concern.

@tpope
Copy link
Owner

tpope commented Jan 14, 2019

Confirming I can't reproduce with C. Both plugins prepend so order may be unpredictable, but I don't see any mechanism for it to clobber.

Maybe it's not running at all. Before navigating, do a :unlet b:start, and see if it gets set upon return.

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

No branches or pull requests

2 participants