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

gf doesn't work for partials for me? #602

Open
thomaswitt opened this issue Jan 12, 2024 · 6 comments
Open

gf doesn't work for partials for me? #602

thomaswitt opened this issue Jan 12, 2024 · 6 comments

Comments

@thomaswitt
Copy link

Hi everybody,

I have a strange thing, gf works fine for me e.g. when in a Controller, it jumps to the model, when I have a partial, it jumps to the partial.

But when I render something from layout, it doesnt work: <%= render 'layouts/search' %>

gf on layouts/search doesn't work. All I get is E345: Can't fnd file "layouts/search" in path …

Yes, I have seen other issues and therefore it should be working but I don't know why it doesn't. Any idea?

@thewatts
Copy link

Mine is doing this too, after switching to using LazyVim and updating my config to use lua.

:) I'm still working on figuring it out - but I'll update this here if I have any luck

@thewatts
Copy link

Update: It looks like nvim-treesitter is causing things to break on my end.

If I disable it, gf starts working again.

@awortham
Copy link

Agreed -> nvim-treesitter seems to break the gf command to go find partials. Is there a way to give vim-rails command precedence? I'm assuming something in tree-sitter must also be relying on that same command.

@thewatts
Copy link

Potentially related: nvim-treesitter/nvim-treesitter#6187

@natematykiewicz
Copy link

My gf couldn't find partials either. After adding additional_vim_regex_highlighting = true, to my treesitter config per this comment, gf works as expected.

@jiz4oh
Copy link

jiz4oh commented Aug 6, 2024

or add the following code in your .vimrc if you don't want set additional_vim_regex_highlighting = true

augroup vim-rails-augroup
  autocmd!
  autocmd FileType eruby
        \ if RailsDetect() | cmap <buffer><script><expr> <Plug><cfile> rails#ruby_cfile() | endif
augroup END

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

5 participants