Is there a plugin or a built-in feature in Vim that allows for elastic tabstops? I've searched a bit, and I found some references saying it was not possible in Vim, but those were quite old.

Is there a way to have elastic tabstops in Vim? I am fine with a solution for Neovim as well, as that's what I use anyway.


2 Answers 2


As far as I can tell there is no reasonable way to accomplish this in a plugin.

There is a patch for it, but it's hard to predict when / if the patch will get merged.

  • 6
    Anybody, if you want this to be merged, please cheer for it at vim-dev (and also reply back how well this works for you) Commented Apr 18, 2015 at 12:06
  • 2
    This patch doesn't seem to actually be elastic tabstops. Instead it's variable tabstops, but you have to set up the stop points ahead of time. This is nice in its own way but not really what the question is about.
    – Caleb
    Commented Mar 7, 2016 at 10:29
  • @Caleb, you could probably script something, once var tabstop patch has been merged. Commented Mar 7, 2016 at 18:54
  • @Christian no you couldn't. See the discussion around the web but this can't be done as a script/plugin in vim (even with the variable with tabstop patch) because it only keeps one method to render all lines with. It just doesn't expose what you would need to make this work.
    – Caleb
    Commented Mar 7, 2016 at 19:17
  • 6
    The mentioned patch has been merged as of 8.1.105 Commented Jun 25, 2018 at 8:16

From the comments: since version 8.1.105, vim has +vartabs compile-time feature, thanks to Christian Brabandt !

As far as I can see, this allows implementing elastic tabstops. See the actual pull request.

  • 1
    You could link to the docs or explain how it could be implemented. That might help future readers more than the link to the user who mentions it.
    – Lucas
    Commented Jul 23, 2018 at 12:50
  • 2
    :set vartabstop=4,20,10,8 - This will make the first tab 4 spaces wide, the second 20 spaces, the third 10 spaces, and all following tabs 8 spaces.
    – pdwalker
    Commented Dec 17, 2018 at 11:38
  • 5
    vartabstop isn't sufficient for elastic tabstops, because the tabstops can't vary between code blocks. vartabstop applies to the entire file. Commented Feb 14, 2019 at 3:12

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.