[FEATURE] if reference is in current file, just jump to it
bennypowers opened this issue · 5 comments
Is your feature request related to a problem? Please describe.
I find myself avoiding gd when I know the definition is in the file I'm on, because I just want to jump there without opening a pop-up
Describe the solution you'd like
I'd like a config option to toggle that behavior
Describe alternatives you've considered
Maybe post_open hook?
Additional context
I would rather not disable the plugin because it's great for inspecting files in node_modules, for example
Hey @bennypowers, thanks for submitting an issue!
I've been thinking about this, if you already know the definition is on the file you're on and you just want to jump to it, wouldn't you hit the regular goto definition keymap instead of goto-preview keymap?
You mention avoiding gd
, have you set your goto preview command to the keymap gd
?
yes, exactly, I would like to have one keybinding (gd
) which
IFF reference is in another file, peek
ELSE jump
I see. I've never thought about it like this, I personally like having two different keymaps for going to definition and going to preview, but I can see how someone might want to have a workflow like yours.
I'd be glad to review a PR for this, otherwise it'll be on my list of features worth implementing and I'll get to it at some point.
Thanks for the suggestion!
I'm new to neovim, and I've just found this plugin. I have a similar question, and I mentioned it in #94 (comment)
Basically, I just want something similar to the vs-code go-to-reference feature. The default nvim-lsp-config go-to-reference logic is really weird. When I hit enter to go to the reference, the cursor will just focus on the code, and I need to focus on the reference list again to check other references. So I was looking for a plugin that I can browse all the references and go to the one I want.
However, this plugin seems only to provide the peek feature. When I found the reference I want, I have to close the window and use the regular go-to again.
I'm wondering why not just allow users to go to the reference directly when they find the reference they want.
When I found the reference I want, I have to close the window and use the regular go-to again.
You don't actually. If you've found what you want to dive into, you can just do a window action <C-w>h
for example to make the floating window move to just a regular split like you'd normally have. <C-w>o
is also an option if you'd like it so that the only window is the one you goto-previewed to