Search code examples
vimctagsname-mangling

How to search across mangled symbols with Ctags on Vim?


I am working on a large mixed C/Asm projects and I have a lot of variables and symbols that are mangled on the ASM side. So on Vim I cannot just do <C-]> on _foo because Ctags cannot link it to foo on the C namespace.

How can I tell either Vim or Ctags to extend the search on mangled symbols?


Solution

  • Vim performs a whole-word search by default but you can force it to perform a regex search by prepending your tag name with a slash:

    :tag /foo
    

    There's unfortunately no option to change that behavior or "regex" alternative to <C-]> but you can create one pretty easily:

    nnoremap <key> :tjump /<C-r><C-w><CR>
    

    NOTE: I've used :tjump because I find it more useful than :tag. YMMV.