[vim/vim] leadtab for spaces (Issue #20061)

9 views
Skip to first unread message

bugsbugsbux

unread,
Apr 24, 2026, 6:08:24 PMApr 24
to vim/vim, Subscribed
bugsbugsbux created an issue (vim/vim#20061)

Is your feature request about something that is currently impossible or hard to do? Please describe the problem.

I indent using spaces and would like the listchars to reflect the current
shiftwidth() setting automatically. This is not impossible to achieve,
everything required is already implemented for other features:
changing indent representation depending on actual indent width and
current indent settings: leadtab, special settings for leading
spaces: lead and leadmultispace

Describe the solution you'd like

I would like to have listchars lead option to optionally accept a
second and optionally third character.

With lcs=lead:x the current behaviour stays unchanged
with lcs=lead:xy and lcs=lead:xyz it behaves like leadtab:xy and leadtab:xyz
respectively but for space indents and with the difference that it uses shiftwidth() as width.

This should not override leadmultispace. I would like to use it temporarily as a
ruler (lcs+=leadmultispace:1234567890) that doesn't require changing the
actual indent width.

Describe alternatives you've considered

  1. Manually change leadmultispace whenever i change ts/sw
  2. Use existing plugins which do virtual text stuff.
    Why would you need a plugin for this, when vim already has the required
    technology, just not exposed for this usecase?
  3. Write a plugin to adjust leadmultispace whenever shiftwidth() changes.
    This is cumbersome, because you have to save state whenever it truncates
    below a width of 4, since you cannot infer marker, spacer and other_marker,
    as well as which side marker marks, from these lengths. Moreover, you have
    to deal with the user interfering, invalidating state and potentially
    forcing an unrecoverable state.
    This is basically solved with an option and (lead)tab's behaviour.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20061@github.com>

nagbu1

unread,
May 18, 2026, 8:34:32 AM (17 hours ago) May 18
to vim/vim, Subscribed
nagbu1 left a comment (vim/vim#20061)

Apparently this has been rediscovered at least once: look at my reddit post, which is even older.

Today I have a different implementation in vim9script, which I think is a bit nicer than the one mentioned by @gcanat

def SetIndentGuides(): void
	var lm = repeat('\ ', &sw - 1)
	execute 'setlocal listchars+=leadmultispace:▏' .. lm
enddef
augroup SetIndentGuides
	autocmd!
	autocmd FileType * SetIndentGuides()
	# add more events if needed
augroup END

So, at least a few people like automatic indent guides, and it'd be nice to have it builtin. On the other hand, the autocmd fix is not hard. Someone more familiar with the codebase than me should judge whether implementing this feature is worth the trouble.


Reply to this email directly, view it on GitHub, or unsubscribe.

Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20061/4477699603@github.com>

nagbu1

unread,
May 18, 2026, 12:27:15 PM (13 hours ago) May 18
to vim/vim, Subscribed
nagbu1 left a comment (vim/vim#20061)

Other places where this was rediscovered:


Reply to this email directly, view it on GitHub, or unsubscribe.

Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20061/4479676989@github.com>

Reply all
Reply to author
Forward
0 new messages