You can set it up per language in ~/.vim/ftplugin/$file_type.vim with set include=$regex and set define=$regex patterns as described in :h include-search, although, coming up with those patterns is a bit of an art and sometimes not possible at all, e.g. For that to work, however, VIM has to know how lines that include files or define symbols look like in any given language. These VIM commands let you jump to any file that's included by your project or jump to any defined symbol that's in any of the included files. If you really don't want to use Language Server and still want a somewhat decent jump to definition with native VIM you should get familiar with :ij and :dj which stand for include-jump and definition-jump. I personally recommend using COC + language servers provided by COC extensions + ALE for extra linting (but with LSP support disabled to avoid conflicts with COC) + Vimspector + debuggers provided by Vimspector (called "gadgets") + following VIM plug-ins: call plug#begin() Any language supported by VSCode is supported in VIM. Later on Microsoft released Debug Adapter Protocol (DAP) as well.
Language Server Protocol (LSP) was created by Microsoft for Visual Studio Code and released as an open source project with a permissive MIT license (standardized by collaboration with Red Hat and Codenvy). The most popular DAP plug-in for VIM is Vimspector.
If you want to use one of those you can either write a COC extension yourself or install LS manually and use the combo of following VIM plug-ins as alternative to COC: Not all of those are provided by COC extensions. List of actively developed language servers and their capabilities is available on Lang Server website. Both nvim and vim8 (or higher) support LSP through plug-ins, the most popular being Conquer of Completion (COC).
Language server (LS) is a separate standalone application (one for each programming language) that runs in the background and analyses your whole project in real time exposing extra capabilities to your editor (any editor, not only vim).
For even more functionality (but it's not needed for jump-to-definition) you can install one or more debuggers and get a full blown IDE experience.īest second is to use native VIM's functionality called define-search but it was invented for C preprocessor's #define directive and for most other languages requires extra configuration, for some isn't possible at all (also you miss on other IDE features). You can do this using internal VIM functionality but a modern (and much easier) way is to use COC for intellisense-like completion and one or more language servers (LS) for jump-to-definition (and way way more).