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

helix: primary cursor should be differentiated #688

Open
tylernku opened this issue Dec 19, 2024 · 2 comments
Open

helix: primary cursor should be differentiated #688

tylernku opened this issue Dec 19, 2024 · 2 comments
Labels
bug Something isn't working properly

Comments

@tylernku
Copy link

tylernku commented Dec 19, 2024

In helix, you can have multiple cursors operating on different selections in a file. You can cycle between them and remove selections. At any one time, one of the selections is considered to be primary and you can use keybindings to keep or dismiss it.

For example:

Dracula_at_night
(Dracula_at_night)

Ayu_dark
(Ayu_dark)

Both these themes give the ability to differentiate between primary and secondary selections (with varying subtlety). They both rely on ui.cursor and ui.cursor.primary, and ui.selection and ui.selection.primary being visually distinct.

In stylix's helix config ui.cursor is defined and ui.cursor.primary is not. Also, ui.selection and ui.selection.primary are both defined as base02.

Here's what that looks like with the stylix config:

Stylix
(Stylix)

@trueNAHO
Copy link
Collaborator

Thanks for this excellent bug report!

Currently, Stylix delegates Helix' theming to https://github.com/tinted-theming/base16-helix:

theme = config.lib.stylix.colors {
templateRepo = config.lib.stylix.templates.base16-helix;
};

Consider patching the upstream theme and then submitting a Stylix PR to update the base16-helix input.

@trueNAHO trueNAHO added the bug Something isn't working properly label Dec 21, 2024
@arunoruto
Copy link
Contributor

arunoruto commented Jan 7, 2025

I was wondering how to make the effect. If it helps, I found out how to set the things you want!
First and foremost, if you want to "patch" the stylix theme with your own mods, you can use the inherit keyword.
Here is a potential hm config line you can add:

programs.helix.settings.theme = "my-stylix";
home.file.".config/helix/themes/my-stylix.toml".source = toml.generate "my-stylix.toml" {
  # Get the default values fro the stylix config
  inherits = "stylix";

  # Enter your patches here
  # This will become the cursor of the selections
  "ui.cursor" = {
    fg = "base0B"; # usually it is base0A, but that will be the primary now
    modifiers = [ "reversed" ];
  };
  # This is the color of the primary cursor, i.e., the one you always see
  "ui.cursor.primary" = {
    fg = "base0A";
    modifiers = [ "reversed" ];
  };

  # Similar thing with the selection color
  # Also, you can play with setting the fg to *background*
  # And putting the color in the bg variable ;)

  # This will become the color of the selections
  "ui.selection" = {
    fg = "base03"; # It would be base02, but that is the primary now
  };
  # This is the color of the primary/inline selection where the primary cursor is now
  "ui.selection.primary "= {
    fg = "base02";
  };

  # This one is a bonus: the matching element (like a bracket) will be underlined
  # I somehow lose track which cursor is mine and which is just a highlight...
  "ui.cursor.match" = {
    fg = "base0A";
    modifiers = [ "underlined" ];
  };
};

This will suffice for now, but some of there changes could be implemented upstream too. Maybe I will take a look at it, but since I am not well versed in theming, I am not sure how good the coloring would be 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working properly
Projects
None yet
Development

No branches or pull requests

3 participants