lunarvim

looking for a C++ function in the current buffer


I have a large codebase with huge C++ files each containing hundreds of functions. Is there a way to jump to a specific function in the current buffer just by knowing the name? I can't use gd/gD because there is nothing under the cursor, gr wont do either because it will search everywhere... what I am doing right now is /func/ but it returns every matching text in the buffer (so any call/mention to func as well), then I can use gd on the first occurrence..

Is there any faster/cleaner way to do it? on Vim I used fuzzy ctrl-p, which is like ctrl-p but for functions. I cant find anything similar on lunarvim and I dont want to look for plugins if something is already available.


Solution

  • Telescope is perfectly capable of searching through lsp symbols:

    :Telescope lsp_document_symbols