Skip to content

Theme-able Vim Mode wrapper - #39813

Merged
ConradIrwin merged 21 commits into
zed-industries:mainfrom
willeyh-git:vimModeWrapper
Oct 21, 2025
Merged

Theme-able Vim Mode wrapper#39813
ConradIrwin merged 21 commits into
zed-industries:mainfrom
willeyh-git:vimModeWrapper

Conversation

@willeyh-git

Copy link
Copy Markdown
Contributor

Closes #14093
Builds on #32279 by making it theme dependent.
Discussion #37816

Wraps the mode label indicator in a div and makes the wrapper and label theme-able. Label weight to medium
Mode indicator will render like previously if not theme colors have been set. (i.e., they match zed default- and fallbacks)
Really helps with visual confirmation of current mode.

Did not investigate further if there is a way to keep the leading and trailing -- if no theme var given.

Can be applied either by a theme itself or using theme_overrides in settings.json

Theme colors applied via theme_overrides
Screenshot 2025-10-08 at 23 01 08
Screenshot 2025-10-08 at 23 01 16
Screenshot 2025-10-08 at 23 01 23

No theme applied
Screenshot 2025-10-08 at 23 01 31
Screenshot 2025-10-08 at 23 01 36
Screenshot 2025-10-08 at 23 01 40

vimmodes.mov

Release Notes:

  • Vim make mode indicator themeable

@cla-bot

cla-bot Bot commented Oct 8, 2025

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @WillyHetland on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@willeyh-git

Copy link
Copy Markdown
Contributor Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Oct 8, 2025
@cla-bot

cla-bot Bot commented Oct 8, 2025

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

pub struct ThemeColorsContent {
/// Background color for Vim Normal mode indicator.
#[serde(rename = "vim.normal.background")]
pub vim_normal_background: Option<String>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move these to the bottom of the struct.

@ConradIrwin

Copy link
Copy Markdown
Member

Thanks for this!

I like this approach much better than re-using the git status colors; but I'm still concerned about the default un-themed version. Is there a way to build this where the padding doesn't look wrong if the colors are not set (Which will be the default)?

I'm not sure we need the --, but in your screenshots the version with the color looks spaced correctly, and the version with no colors looks too gappy.

I'm also not thrilled by how many variables a theme would have to set to use this, but I think that reflects reality somewhat...

@willeyh-git

Copy link
Copy Markdown
Contributor Author

I'm not sure we need the --, but in your screenshots the version with the color looks spaced correctly, and the version with no colors looks too gappy.

Seems like it can be done if we go by the assumption that a background color system_transparent, which is the default color for every mode, is set.
Screenshot 2025-10-14 at 22 24 22

If no color is set for the given mode:

  • leading and trailing -- are rendered, horizontal padding is removed and text color is reverted to default.

@zed-industries-bot

zed-industries-bot commented Oct 16, 2025

Copy link
Copy Markdown
Contributor
Messages
📖

This PR includes links to the following GitHub Issues: #14093
If this PR aims to close an issue, please include a Closes #ISSUE line at the top of the PR body.

Generated by 🚫 dangerJS against 2b8b97e

@ConradIrwin

Copy link
Copy Markdown
Member

Thanks. It's a bit odd to have the theme change the content, but I think it's the best compromise in this case (until we figure out a better one :D).

Would you mind making the CI happy?

@ConradIrwin
ConradIrwin enabled auto-merge (squash) October 21, 2025 04:12
@ConradIrwin

Copy link
Copy Markdown
Member

I spent a bit more time tidying this up:

  • Pending keystrokes (and ctrl-g output) are not rendered in the colored mode indicator
  • The indicator's background now is the same size as the buttons its rendered alongside for themes where buttons are not invisible

@ConradIrwin
ConradIrwin merged commit 71ea133 into zed-industries:main Oct 21, 2025
21 checks passed
@willeyh-git
willeyh-git deleted the vimModeWrapper branch October 21, 2025 06:17
@0x2CA

0x2CA commented Oct 28, 2025

Copy link
Copy Markdown
Contributor

I'm not sure if this error was caused by this change.

If you force quit the app, reopening it will retain the insertion mode.

2025-10-28.08.46.35.mov

@willeyh-git

Copy link
Copy Markdown
Contributor Author

I'm not sure if this error was caused by this change.

If you force quit the app, reopening it will retain the insertion mode.

Can be replicated in the current release. Don't think its related to this.

@joehillen

Copy link
Copy Markdown

This feature is undocumented. Is that intentional?

jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
Closes [zed-industries#14093](zed-industries#14093)
Builds on [zed-industries#32279](zed-industries#32279) by
making it theme dependent.
Discussion
[zed-industries#37816](zed-industries#37816)

Wraps the mode label indicator in a div and makes the wrapper and label
theme-able. Label weight to medium
Mode indicator will render like previously if not theme colors have been
set. (i.e., they match zed default- and fallbacks)
Really helps with visual confirmation of current mode.

_Did not investigate further if there is a way to keep the leading and
trailing -- if no theme var given._

Can be applied either by a theme itself or using `theme_overrides` in
settings.json

Theme colors applied via `theme_overrides`
<img width="233" height="34" alt="Screenshot 2025-10-08 at 23 01 08"
src="https://github.com/user-attachments/assets/a00d9ae4-b6db-46a0-84e2-98d2691a11ad"
/>
<img width="233" height="34" alt="Screenshot 2025-10-08 at 23 01 16"
src="https://github.com/user-attachments/assets/f27fddab-524d-43c4-9307-46b6a656cd35"
/>
<img width="233" height="34" alt="Screenshot 2025-10-08 at 23 01 23"
src="https://github.com/user-attachments/assets/7e477fff-7a40-4c01-95a7-fbd40fff6caa"
/>

No theme applied
<img width="233" height="34" alt="Screenshot 2025-10-08 at 23 01 31"
src="https://github.com/user-attachments/assets/8b7b2c75-007b-4074-a552-181c53f31213"
/>
<img width="233" height="34" alt="Screenshot 2025-10-08 at 23 01 36"
src="https://github.com/user-attachments/assets/7a708d81-2033-4d72-a844-57607a0434ea"
/>
<img width="233" height="34" alt="Screenshot 2025-10-08 at 23 01 40"
src="https://github.com/user-attachments/assets/526f9d10-4d0f-4bc5-af89-31fcca538ce4"
/>



https://github.com/user-attachments/assets/d0d71d4d-504f-4d18-bbd9-83d3a4b2adb7


Release Notes:

- Vim make mode indicator themeable

---------

Co-authored-by: willyHetland <willy.hetland@zeekit.no>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

I want to visualize vim status mode.

9 participants