-
-
Notifications
You must be signed in to change notification settings - Fork 296
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
plugins/nvim-highlight-colors: init #2105
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,12 @@ | |
# | ||
# Nixpkgs maintainers: https://github.com/NixOS/nixpkgs/blob/0212bde005b3335b2665c1476c36b3936e113b15/maintainers/maintainer-list.nix | ||
{ | ||
thubrecht = { | ||
email = "[email protected]"; | ||
github = "Tom-Hubrecht"; | ||
githubId = 26650391; | ||
name = "Tom Hubrecht"; | ||
}; | ||
alisonjenkins = { | ||
email = "[email protected]"; | ||
github = "alisonjenkins"; | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,96 @@ | ||||||||||||||||||||||
{ | ||||||||||||||||||||||
lib, | ||||||||||||||||||||||
helpers, | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
config, | ||||||||||||||||||||||
pkgs, | ||||||||||||||||||||||
... | ||||||||||||||||||||||
}: | ||||||||||||||||||||||
|
||||||||||||||||||||||
let | ||||||||||||||||||||||
inherit (helpers.defaultNullOpts) | ||||||||||||||||||||||
mkBool | ||||||||||||||||||||||
mkEnum | ||||||||||||||||||||||
mkListOf | ||||||||||||||||||||||
mkStr | ||||||||||||||||||||||
mkStr' | ||||||||||||||||||||||
; | ||||||||||||||||||||||
Comment on lines
+10
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To match the style used elsewhere in nixvim:
Suggested change
|
||||||||||||||||||||||
in | ||||||||||||||||||||||
helpers.neovim-plugin.mkNeovimPlugin config { | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We (very) recently dropped the
Suggested change
|
||||||||||||||||||||||
name = "nvim-highlight-colors"; | ||||||||||||||||||||||
defaultPackage = pkgs.vimPlugins.nvim-highlight-colors; | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Watch out for #2139, if it is merged first you'll have to do:
Suggested change
|
||||||||||||||||||||||
|
||||||||||||||||||||||
maintainers = [ helpers.maintainers.thubrecht ]; | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
|
||||||||||||||||||||||
settingsOptions = { | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: because The judgement call is yours to make though, I won't block a PR for having "too many" settings options 😁 |
||||||||||||||||||||||
render = mkEnum [ | ||||||||||||||||||||||
"background" | ||||||||||||||||||||||
"foreground" | ||||||||||||||||||||||
"virtual" | ||||||||||||||||||||||
] "background" "The render style used."; | ||||||||||||||||||||||
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
|
||||||||||||||||||||||
virtual_symbol = mkStr "■" "The virtual symbol to be used when the render method is set to `virtual`."; | ||||||||||||||||||||||
virtual_symbol_prefix = mkStr "" "The virtual symbol prefix."; | ||||||||||||||||||||||
virtual_symbol_suffix = mkStr " " "The virtual symbol suffix."; | ||||||||||||||||||||||
virtual_symbol_position = | ||||||||||||||||||||||
mkEnum | ||||||||||||||||||||||
[ | ||||||||||||||||||||||
"inline" | ||||||||||||||||||||||
"eol" | ||||||||||||||||||||||
"eow" | ||||||||||||||||||||||
] | ||||||||||||||||||||||
"inline" | ||||||||||||||||||||||
'' | ||||||||||||||||||||||
The position for the virtual symbol. | ||||||||||||||||||||||
|
||||||||||||||||||||||
- `inline` mimics VS Code style | ||||||||||||||||||||||
- `eol` stands for `end of column`, it is recommended to set the virtual symbol suffix to `""` when used | ||||||||||||||||||||||
- `eow` stands for `end of word`, it is recommended to set the virtual symbol prefix to `" "` and the suffix to `""` when used | ||||||||||||||||||||||
''; | ||||||||||||||||||||||
|
||||||||||||||||||||||
enable_hex = mkBool true "Highlight hex colors, e.g. `#ffbbff`."; | ||||||||||||||||||||||
enable_short_hex = mkBool true "Highlight short hex colors, e.g. `#cbf`."; | ||||||||||||||||||||||
enable_rgb = mkBool true "Highlight rgb colors, e.g. `rgb(0 0 0)`."; | ||||||||||||||||||||||
enable_hsl = mkBool true "Highlight hsl colors, e.g. `hsl(150deg 30% 40%)`."; | ||||||||||||||||||||||
enable_var_usage = mkBool true "Highlight CSS variables, e.g. `var(--testing-color)`."; | ||||||||||||||||||||||
enable_named_colors = mkBool true "Highlight named colors, e.g. `green`."; | ||||||||||||||||||||||
enable_tailwind = mkBool true "Highlight tailwind colors, e.g. `bg-blue-500`."; | ||||||||||||||||||||||
|
||||||||||||||||||||||
custom_colors = | ||||||||||||||||||||||
mkListOf | ||||||||||||||||||||||
(lib.types.submodule { | ||||||||||||||||||||||
options = { | ||||||||||||||||||||||
label = mkStr' { | ||||||||||||||||||||||
description = '' | ||||||||||||||||||||||
The text matched for this color. It must be properly escaped with `%` to adhere to `string.gmatch`. | ||||||||||||||||||||||
''; | ||||||||||||||||||||||
}; | ||||||||||||||||||||||
color = mkStr' { | ||||||||||||||||||||||
description = '' | ||||||||||||||||||||||
The color used, in hex format. | ||||||||||||||||||||||
''; | ||||||||||||||||||||||
}; | ||||||||||||||||||||||
}; | ||||||||||||||||||||||
}) | ||||||||||||||||||||||
[ ] | ||||||||||||||||||||||
'' | ||||||||||||||||||||||
A list of custom colors. | ||||||||||||||||||||||
''; | ||||||||||||||||||||||
|
||||||||||||||||||||||
exclude_filetypes = mkListOf lib.stypes.str [ ] "A list of filetypes to exclude from highlighting."; | ||||||||||||||||||||||
exclude_buftypes = mkListOf lib.stypes.str [ ] "A list of buftypes to exclude from highlighting."; | ||||||||||||||||||||||
Comment on lines
+79
to
+80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo:
Suggested change
|
||||||||||||||||||||||
}; | ||||||||||||||||||||||
|
||||||||||||||||||||||
settingsExample = { | ||||||||||||||||||||||
custom_colors = [ | ||||||||||||||||||||||
{ | ||||||||||||||||||||||
label = "%-%-theme%-primary%-color"; | ||||||||||||||||||||||
color = "#0f1219"; | ||||||||||||||||||||||
} | ||||||||||||||||||||||
{ | ||||||||||||||||||||||
label = "%-%-theme%-secondary%-color"; | ||||||||||||||||||||||
color = "#5a5d64"; | ||||||||||||||||||||||
} | ||||||||||||||||||||||
]; | ||||||||||||||||||||||
exclude_buftypes = [ "text" ]; | ||||||||||||||||||||||
}; | ||||||||||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you introduce a test file please, you can reference other tests in
tests/test-sources/plugins
and/or recently merged PRs.Generally, we like to have an
empty
test case, adefaults
test case and (ideally) anexample
test case.