相关文章推荐
发呆的白开水  ·  Taglist-like Vim ...·  3 月前    · 
发呆的白开水  ·  Vim Tagbar Plugin · ...·  3 月前    · 

Does anyone know of a Vim plugin similar to taglist for Rust?
Taglist is a source code browser that opens in a side pane. It shows classes, methods, and other declarations.
It's useful for having an overview, especially of larger projects consisting of multiple files.

I know of racer-vim but it provides jump-to-definition and jump-to-help but not this. There's also rusty-tags however I was unable to get its output to work with taglist in vim.

ya that would be great
I've went with NERDTree for now, at least having a file list of the project gives me some overview, together with racer's jump-to-definition it's more or less convenient
should probably switch to a real IDE at some point but doesn't really like something closed-source or overly heavy

The primary reasons I use vim are (1) convenience... I'm already in the terminal and I don't want to switch to another window; (2) keyboard-oriented: I don't like using mice; and (3) it's already installed on most linux/macos boxes. I don't think any IDE will ever have those features in the near-term...

Really, my rust/vim setup is pretty nice. The only thing missing is something like etags/tagbar/taglist.

I had a similar problem with Tagbar, but it turns out that universal-ctags has better native Rust support and this can be integrated with Tagbar in a nice way.

  • Build and install universal-ctags
  • Put the following in your .vimrc:
  • let g:rust_use_custom_ctags_defs = 1
    let g:tagbar_type_rust = {
      \ 'ctagsbin' : '/path/to/your/universal/ctags',
      \ 'ctagstype' : 'rust',
      \ 'kinds' : [
          \ 'n:modules',
          \ 's:structures:1',
          \ 'i:interfaces',
          \ 'c:implementations',
          \ 'f:functions:1',
          \ 'g:enumerations:1',
          \ 't:type aliases:1:0',
          \ 'v:constants:1:0',
          \ 'M:macros:1',
          \ 'm:fields:1:0',
          \ 'e:enum variants:1:0',
          \ 'P:methods:1',
      \ 'sro': '::',
      \ 'kind2scope' : {
          \ 'n': 'module',
          \ 's': 'struct',
          \ 'i': 'interface',
          \ 'c': 'implementation',
          \ 'f': 'function',
          \ 'g': 'enum',
          \ 't': 'typedef',
          \ 'v': 'variable',
          \ 'M': 'macro',
          \ 'm': 'field',
          \ 'e': 'enumerator',
          \ 'P': 'method',
    
  • Restart vim and enjoy!
  • Screenshot%20from%202019-03-25%2016-46-43249×800 48.4 KB