Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve drawwhitespace plugin #908

Merged
merged 2 commits into from
Jun 2, 2022
Merged

Conversation

Guldoman
Copy link
Member

@Guldoman Guldoman commented Apr 1, 2022

Add configuration options to specify:

  • characters to substitute and their substitution;
  • whether to substitute at the beginning, middle or end of the line;
  • the color of the substitution;
  • the color for the beginning, middle or end;
  • the minimum number of white space to show in the middle.

For example, using:

{
  leading_color = style.good,
  middle_color = style.modified,
  trailing_color = style.warn,
  show_middle_min = 2,
  substitutions = {
    {
      char = " ",
      sub = "·",
      show_trailing = false,
    },
    {
      char = "\t",
      sub = "»",
    },
    {
      char = " ",
      sub = "",
      show_leading = false,
      show_middle = false,
      show_trailing = true,
      trailing_color = style.error,
    },
  },
}

we get

2022-04-01_18-14

Add configuration options to specify:
- characters to substitute and their substitution;
- whether to substitute at the beginning, middle or end of the line;
- the color of the substitution;
- the color for the beginning, middle or end;
- the minimum number of white space to show in the middle.
@jgmdev
Copy link
Member

jgmdev commented Apr 8, 2022

Nice! tested and working but, couldn't that substitution for trailing spaces be added by default? the one you shared:

{
      char = " ",
      sub = "",
      show_leading = false,
      show_middle = false,
      show_trailing = true,
      trailing_color = style.error,
    },

seems like something pretty useful to prevent blank spaces at ends of lines and also provides an example of how to configure the plugin properly to use these features.

@TorchedSammy
Copy link
Contributor

since markdown has 2 trailing spaces at the end of a line to be a newline, it would be nice to ignore in certain filetypes, otherwise works good

@jgmdev jgmdev merged commit 59a5839 into lite-xl:master Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants