Fix indentation and tab/space indentation representation in Neovim #25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
lcs-tab
andlcs-leadmultispace
show different secondary characters to visually differentiate between space- and tab-based indentation.lcs-leadmultispace
automatically adapt totabstop
and/orshiftwidth
changes.vim/
to use two-space indentation.Why
I wanted two-space indentation in Lua files all along, and I thought I had achieved that using
stylua
but I accidentally made them all use tabs, and I didn't realize because my "visual" Neovim config was set to show leading tabs and leading spaces the same way.While working on solving this, I realized that the length of
lcs-leadmultispace
needs to match the length of space-based indentation for it to "line up" visually. Since I use a vertical line character to indicate indentation, thelcs-leadmultispace
value definitely needs to keep up with indentation so that the line will line up, or it will defeat the purpose.I found and adapted some
autocmd
code that will dynamically changelcs-leadmultispace
every time eithertabstop
orshiftwidth
changes, which in turn are kept dynamically in sync with local indentation byvim-sleuth
.Testing
lcs-leadmultispace
correctly follows changes in indentation, resulting in expected "vertical indentation guide line" behavior.