Visual Studio has a feature for C# that displays how many times a given method has been referenced. This information is displayed as tiny greyed out text above the method names. It is not possible to edit this text and it will be ignored by the cursor when you transition over it. (I believe they are called adornments or glyphs, but I'm not entirely sure)

For illustration purpose, example images of the reference counters can be seen in the images at http://www.axtools.com/products-codesmart-vsnet.php and http://www.kunal-chowdhury.com/2013/08/reference-counter-in-visual-studio-2013.html#MYmS5iViRWPY3Lzm.97.

Is it possible to achieve the same in Vim?

I am curious because I dream about having a plugin in Vim that displays type signatures of F# code on top of the functions. And to be useful in Vim, the type signatures must be ignored by the cursor and Vim editing functionality. I have never developed a Vim plugin, so I guess this would be my first journey into Vim-scripting...

  • 1
    AFAIK you can't do that with Vim. What you can do would be to show that info in the 'gutter' (sign column), to the left of each line, e.g. similar to how vim-gitgutter works.
    – VanLaser
    Oct 5, 2016 at 22:44
  • 2
    To add to @VanLaser's comment: you could create lines in your buffer, you could make them look differently from the other lines, I think you could update them automatically but I don't think you could make them non editable and make the cursor ignore them would potentially be a painful task... I think that the whole plugin would be pretty painful to create actually :-)
    – statox
    Oct 6, 2016 at 10:02
  • @statox hmm perhaps a better idea would be to create a plugin like codi then (github.com/metakirby5/codi.vim). Instead of evaluating the code, I could display the type signatures. Do you think that would be more manageable as a first plugin for a vim-plugin-rookie?
    – user7592
    Oct 6, 2016 at 19:12
  • Or you could warm up by showing the type signature in a tooltip - where the mouse points to (:h balloon-eval).
    – VanLaser
    Oct 6, 2016 at 19:17

1 Answer 1


There are two parts to this:

  1. Getting the required information from a static analysis.
  2. Displaying this information in Vim.

Part 1. is best done outside of Vim as Vim can't really do this sort of comprehensive static analysis. For example vim-go uses the guru commandline tool, for Python there's jedi, etc.

Once you have the information, you'll need to display it. There isn't any way to display this as Visual Studio. Vim has very limited graphics capabilities, but there are several other options for displaying it. The two most obvious "Vim ways" are:

  • Add a command (and mapping) to display this information.

  • Display it in the 'statusline' for the function that's currently active.

Other more exotic options might be:

  • Display it in a (vertical) split. This is how things like "sidebars" are done in Vim.
  • As a mouse-over "balloon" with 'balloonexpr'. This only works in gVim.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.