[vim/vim] listchars: trailmultispace to easily identify the number of trailing spaces (Issue #14819)

17 views
Skip to first unread message

rcmosher

unread,
May 21, 2024, 6:40:14 AMMay 21
to vim/vim, Subscribed

Is your feature request about something that is currently impossible or hard to do? Please describe the problem.
Markdown files uses two trailing spaces to insert a line break. Trailing spaces can be hard to spot in a file.

Describe the solution you'd like
Add a trailmultispace:c... setting to listchars. This should be like leadmultispace:c... but for trailing spaces.

Describe alternatives you've considered
Use set listchars=trail:c. This is an okay solution, but it can be difficult to quickly notice if there are exactly two trailing spaces.

Creating a syntax highlight for trailing spaces. This can match the exact number of characters making it easy to spot the number of trailing spaces.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14819@github.com>

Christian Brabandt

unread,
May 21, 2024, 7:20:11 AMMay 21
to vim/vim, Subscribed

Well, not sure. Is a ( denoting a single trailing whitespace):

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam••¶

really that much harder than:

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam*¶

where * would be used for trailing multi-spaces? In addition, you can also highlight more than 2 trailing spaces using /\s\s\+$ in combination with :set hls

In addition, you can already make use of concealing for trailing whitespaces.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14819/2122404590@github.com>

rcmosher

unread,
May 21, 2024, 1:32:41 PMMay 21
to vim/vim, Subscribed

I don't like set listchars=trail:•,eol:¶ as then you have a paragraph sign at the end of every line. The idea is to only draw attention to lines where there are two spaces at the end. That way, for markdown, you can quickly identify if a line break has been added or not.

:set hls is good but only lasts until the search pattern changes. I'd like to be able to notice a missing or unintended line break in the process of editing. Of course a search is fine to do a focused check.

I'll look into concealing. That seems like it may be a good option.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14819/2123110836@github.com>

rcmosher

unread,
May 21, 2024, 7:56:36 PMMay 21
to vim/vim, Subscribed

I like how conceal works. I opted for this:
syntax match Noraml '\s\{2}$' conceal cchar=⏎
setlocal conceallevel=2


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14819/2123609715@github.com>

rcmosher

unread,
May 21, 2024, 7:56:37 PMMay 21
to vim/vim, Subscribed

Closed #14819 as completed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/14819/issue_event/12886617815@github.com>

rcmosher

unread,
May 23, 2024, 6:31:40 AMMay 23
to vim/vim, Subscribed

I'll add that vim includes markdownLineBreak in it's default syntax files. It matches 2 or more trailing spaces, and appears to be unused for highlighting, at least in my setup. Though I prefer calling out the last 2 spaces separately from any additional spaces so it's clear if there are more spaces then needed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14819/2126770652@github.com>

Christian Brabandt

unread,
May 23, 2024, 7:36:42 AMMay 23
to vim/vim, Subscribed

That's a decision for @tpope (syntax file maintainer for markdown) to be done.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14819/2126888575@github.com>

Tim Pope

unread,
May 25, 2024, 11:02:22 PMMay 25
to vim/vim, Subscribed

I'll add that vim includes markdownLineBreak in it's default syntax files. It matches 2 or more trailing spaces, and appears to be unused for highlighting, at least in my setup. Though I prefer calling out the last 2 spaces separately from any additional spaces so it's clear if there are more spaces then needed.

It's off by default, but can be assigned highlighting by users that desire it.

I like how conceal works. I opted for this:

syntax match Normal '\s\{2}$' conceal cchar=⏎
setlocal conceallevel=2

I'd note that markdown.vim makes heavy use of conceal to hide syntax, so this would be a confusing and counterproductive behavior to add upstream. But as a local addition to your Vim config it should work great.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14819/2132042296@github.com>

Reply all
Reply to author
Forward
0 new messages