The highlighting for the marker of the `justinmk/vim-sneak` now matches
the style of the Vim search highlighting.
Also the inline text of the Neovim specific `lewis6991/gitsigns.nvim`
plugin now matches the the foregroun color of comments.
Co-authored-by: Sven Greb <development@svengreb.de>
GH-316
Before the custom `s:hi` function called Vim's `execute` function [1]
for each defined attribute which is quite expensive in terms of
performance. To improve this the attributes are now concatenate as
string and passed to `exec` at the end of the function instead.
Co-authored-by: Julien Voisin <jvoisin@google.com>
Co-authored-by: Sven Greb <development@svengreb.de>
Co-authored-by: Arctic Ice Sudio <development@arcticicestudio.com>
[1]: https://vimhelp.org/builtin.txt.html#builtin.txt#execute%28%29
GH-303
Instead of using a if/else block and empty variable declaration Vim's
builtin `get` function [1] is now used to simplify the code.
Co-authored-by: Sven Greb <development@svengreb.de>
Co-authored-by: Arctic Ice Studio <development@arcticicestudio.com>
[1]: https://vimhelp.org/builtin.txt.html#builtin.txt#get%28%29
GH-305
The changes introduced in PR GH-294 [1] did not take into account that
the order how plugins are loaded are not always constant and can also
change based on how users order plugins in their configurations.
When a supported plugin is loaded after Nord the global `loaded_*`
variable might not be available yet, causing the styles to be skipped
due to the conditional block guard. Also each plugin manager handles the
plugin loading order differently which is also a problem when checking
for global variable existence.
The loading time of the Nord plugin is still totally fine so improving
the stability for only a minimal performance boost is no negative trade
at all (tested via `vim --startuptime timing.out`):
4.956ms: sourcing ~/.local/share/vim/plugged/nord-vim/colors/nord.vim
[1]: https://github.com/arcticicestudio/nord-vim/pull/294
[2]: https://github.com/arcticicestudio/nord-vim/issues/306
Fixes GH-306
The conditions and default values of the theme configurations were quite
verbose so this commit improves them by...
- ...using inline ternary operators instead of if/else blocks to reduce
the code overhead and make it way more readable.
- ...using Vim builtin `get` function [1] instead of if/else blocks.
- ...inlining the script-scoped `logWarning` function since it was only
used once.
- ...grouping some blocks where it made sense.
[1]: https://vimhelp.org/builtin.txt.html#builtin.txt#get%28%29
GH-295
Co-authored-by: Sven Greb <development@svengreb.de>
Fix syntax error in `exists` function
In GH-296 a syntax errors has crept in where the `exists` function was
missing the second `s` in two cases.
Fixes GH-299
GH-297
Co-authored-by: Julien Voisin <jvoisin@users.noreply.github.com>
Co-authored-by: Sven Greb <development@svengreb.de>
Co-authored-by: Arctic Ice Studio <development@arcticicestudio.com>
This commit is a continuation of GH-294, see message and PR discussion
of commit `a4bf0a63e8e1e62e884eee9ec04d577105f58aa7` for details.
[1]: a4bf0a63e8
Related to GH-294
GH-296
Co-authored-by: Julien Voisin <jvoisin@google.com>
Co-authored-by: Sven Greb <development@svengreb.de>
Guard plugin and Neovim specific features in conditional blocks
Function calls are expensive in Vim script so to reduce the overhead of
processing the theme most plugin and Neovim specific features are now
wrapped in conditional blocks, e.g. Neovim highlighting groups are only
loaded when the global `nvim` variable is set while other plugins are
checked for their own `loaded_*` variable (common plugin pattern).
Some plugins provide no easy/straightforward way to be detected, so not
all blocks are behind conditions, but it's still a significant
improvement, and can always be improved in the future.
Co-authored-by: Julien Voisin <jvoisin@google.com>
Co-authored-by: Sven Greb <development@svengreb.de>
GH-294
The `vim.lsp.buf.signature_help` function is used to highlight the
active parameter in the signature help [1].
Before this commit the active parameter was not styled differently to
any other parameter which made it hard to distinguish it. This has been
improved by adding support for the `LspSignatureActiveParameter` syntax
highlighting group where the active parameter now uses `nord8` are
foreground color and additionally a font underline with the same color.
[1]: 70db972e5f/runtime/doc/lsp.txt (L456-L459)
Co-authored-by: Sven Greb <development@svengreb.de>
Co-authored-by: Arctic Ice Studio <development@arcticicestudio.com>
GH-286
Improve readability of C language constants
To improve the readability of C language constants, defined by the
`cConstant` syntax highlighting group [1], these are now colored with
`nord9` for the foreground to make them stand out. This is important in
C, since interesting things are usually happening in their proximity,
like checking/returning an error, passing particular values/flags to
functions and so on.
[1]: 0e6adf8a29/runtime/syntax/c.vim (L313-L375)
Co-authored-by: Arctic Ice Studio <development@arcticicestudio.com>
Co-authored-by: Sven Greb <development@svengreb.de>
GH-283
Support for Neovim LSP `documentHighlight` groups
The Neovim LSP `textDocument` / `documentHightlight` groups [1] are
responsible to highlight tokens in a document that are related to each
other, e.g. decalred variables, using the
`vim.buf.lsp.document_highlight()` function.
Also see the LSP specification about "Document Highlights Request" [2]
for more details.
[1]: f92a2457c2/runtime/doc/lsp.txt (L423)
[2]: https://microsoft.github.io/language-server-protocol/specification#textDocument_documentHighlight
Co-authored-by: Arctic Ice Studio <development@arcticicestudio.com>
Co-authored-by: Sven Greb <development@svengreb.de>
Support for LSP code lenses
Before LSP code lenses [1] where code lenses were highlighted with the
default color which has been changed to make it less visually intrusive,
like other UI related elements, i.e. messages of linters.
[1]: https://neovim.io/doc/user/lsp.html#lsp-highlight-codelens
GH-266
Co-authored-by: Arctic Ice Studio <development@arcticicestudio.com>
This is a follow up for arcticicestudio/nord-vim#218 [1] which added
highlighting groups for the bundled PHP syntax, but the groups are
actually defined by the StanAngeloff/php.vim [2] plugin.
Therefore the added highlighting calls will be moved to a plugin
section.
Additionally, the `phpClassExtends` and `phpClassImplements` groups
have been added to improve the highlighting for classes that implement
or extended interfaces/classes. The `phpUseClass` has also been added to
improve the highlighting for imports.
[1]: https://github.com/arcticicestudio/nord-vim/pull/218
[2]: https://github.com/StanAngeloff/php.vim
Related to GH-218
Closes GH-262
Co-authored-by: Sven Greb <development@svengreb.de>
Fixed two typos in group names:
- `PMenuSel` -> `PmenuSel`
- `PMenu` -> `Pmenu`
This mismatch was never really noticed because most of the time users
rely on plugins like coc [1] or vim-clap [2] which come with custom
highlighting groups and UI libraries.
[1]: https://github.com/neoclide/coc.nvim
[2]: https://github.com/liuchengxu/vim-clap
Co-authored-by: Sven Greb <development@svengreb.de>
To ensure compatibility with the latest versions of Neovim LSP the
highlighting groups for diagnostics have been adapted to the changes
of neovim/neovim#12655 [1].
See :help lsp-highlight-diagnostics [2] for more details.
Note that LSP will be available as of Neovim 0.5 which is (at the time
of this commit) still in development and only available as nighly build.
Also see great articles from Nord Vim contributors like "Neovim (0.5) Is
Overpowering" [3] for more information about Neovim 0.5 features,
including LSP.
[1]: https://github.com/neovim/neovim/pull/12655
[2]: https://neovim.io/doc/user/lsp.html
[3]: https://crispgm.com/page/neovim-is-overpowering.html
Co-authored-by: Sven Greb <development@svengreb.de>
Closes GH-229
Closes GH-248
The `Conceal` group was not supported which could have led to rendering
problems for (Unicode) characters that require special encoding like
the ones from the Greek alphabet [1] that are often used in LaTeX [3] or
Pandoc [4] documents. These characters were highlighted with the default
background color which makes them kind of unreadable with the theme
foreground color.
See `:help conceal` and `:help concealcursor` for more details about
concealing in Vim.
To fix the problem, the `Conceal` group has been added with its
background color set to `NONE` for GUI and terminal mode to either use
the terminal default background color or let loaded scripts apply custom
styles based on the current runtime context.
The problem has been reported in GH-149, GH-207 and GH-211 with LaTeX
and Pandoc being used by the reporters. PR GH-220 adds support for
vim-pandoc/vim-pandoc-syntax [5] specific highlighting groups and can be
merged after adding basic support for `Conceal`.
[1]: https://en.wikipedia.org/wiki/Greek_alphabet
[2]: https://www.overleaf.com/learn/latex/mathematical_expressions
[3]: https://www.latex-project.org
[4]: https://pandoc.org
[5]: https://github.com/vim-pandoc/vim-pandoc-syntax
Co-authored-by: Sven Greb <development@svengreb.de>
Closes GH-256
Implemented the `NordPalette` pubic API function that returns all Nord
colors as dictionary. This allows to use the colors in other Vim scripts
without the need to copy & paste the colors from the documentations or
the Nord Vim theme sources.
Co-authored-by: Arctic Ice Studio <development@arcticicestudio.com>
Co-authored-by: Sven Greb <development@svengreb.de>
Closes GH-224
The even and odd highlighting blocks using `nord1` and `nord2` (`nord3`
in terminal mode) to provide a subtle and non-disturbing style.
Note that the custom theme colors [1] are only applied when the
`indent_guides_auto_colors` variable has been set to `0`:
```vim
let g:indent_guides_auto_colors = 0
```
[1]: https://github.com/nathanaelkane/vim-indent-guides#setting-custom-indent-colors
Resolves GH-186
Before classes and functions used the default foreground color which made it hard to distinguish them from variables and syntactic characters like braces. The new style now matches other ports and highlighting engines and makes it easy to identify these elements with Nord's authentic appearance.
Closes GH-218
Added the coc.nvim [1] highlighting groups for errors and warnings using their respective foreground colors and the `undercurl` font style.
[1]: https://github.com/neoclide/coc.nvim
Co-authored-by: Arctic Ice Studio <development@arcticicestudio.com>
Co-authored-by: Sven Greb <development@svengreb.de>
Added basic support for vim-clap [1], a modern and performant generic finder and dispatcher for Vim and NeoVim.
[1]: https://github.com/liuchengxu/vim-clap
GH-178
Co-authored-by: Arctic Ice Studio <development@arcticicestudio.com>
Co-authored-by: Sven Greb <development@svengreb.de>
Basic highlighting support for TypeScript & TSX
Added basic support to highlight TypeScript & TSX syntax more
consistently through the HerringtonDarkholme/yats.vim plugin [1].
This includes improvements to highlight...
1. ...TypeScript interface an class names using `nord7` as foreground,
where interfaces also use the bold attribute, to match with
structs/classes.
2. ...global methods like e.g. `setTimeout` with `nord8` using the
italic attribute to mark it kind of static.
3. ...regular expressions with `nord13` as foreground color instead of
the normal color for quoted strings (`nord14`) to make it easier to
differ between both.
4. ...global objects like `Error`, `JSON` and `console` with `nord7`.
5. ...primitive/builtin types like `string` with `nord9`.
6. ...TypeScript type references with `nord7`.
7. ...TypeScript specific characters like for type annotations (`:`) and
member optionality (`?`) as operator with `nord9`.
This also includes improvements for "vanilla" JavaScript elements.
[1]: https://github.com/HerringtonDarkholme/yats.vim
Resolves GH-208
Co-authored-by: Arctic Ice Studio <development@arcticicestudio.com>
Co-authored-by: Sven Greb <development@svengreb.de>
Added basic support for vim-clap [1], a modern and performant generic finder and dispatcher for Vim and NeoVim.
[1]: https://github.com/liuchengxu/vim-clap
GH-178
Co-authored-by: Arctic Ice Studio <development@arcticicestudio.com>
Co-authored-by: Sven Greb <development@svengreb.de>
Basic highlighting support for TypeScript & TSX
Added basic support to highlight TypeScript & TSX syntax more
consistently through the HerringtonDarkholme/yats.vim plugin [1].
This includes improvements to highlight...
1. ...TypeScript interface an class names using `nord7` as foreground,
where interfaces also use the bold attribute, to match with
structs/classes.
2. ...global methods like e.g. `setTimeout` with `nord8` using the
italic attribute to mark it kind of static.
3. ...regular expressions with `nord13` as foreground color instead of
the normal color for quoted strings (`nord14`) to make it easier to
differ between both.
4. ...global objects like `Error`, `JSON` and `console` with `nord7`.
5. ...primitive/builtin types like `string` with `nord9`.
6. ...TypeScript type references with `nord7`.
7. ...TypeScript specific characters like for type annotations (`:`) and
member optionality (`?`) as operator with `nord9`.
This also includes improvements for "vanilla" JavaScript elements.
[1]: https://github.com/HerringtonDarkholme/yats.vim
Resolves GH-208
Co-authored-by: Arctic Ice Studio <development@arcticicestudio.com>
Co-authored-by: Sven Greb <development@svengreb.de>
The `LineNr` and `CursorLineNr` highlight groups now have a transparent
background in GUI mode.
Before it was set to `nord0_gui` which worked fine in most cases.
However, some plugins use these highlight groups to render their content
in a popup window which can potentially have a different background
color. This caused some issues e.g. for the fuzzy search plugin
LeaderF [1].
The compatibility with the `g:nord_cursor_line_number_background`
theme configuration has been verified to work as expected in both modes
when it is set to `0` or `1`.
This change is not related to the terminal mode or when using
`set notermguicolors` since `ctermbg` for `LineNr` and `CursorLineNr`
is set to `NONE` by default.
[1]: https://github.com/Yggdroot/LeaderF
Consistent `Error` and `MoreMsg` highligh. in term and GUI mode (#202)
Before the `Error` group in GUI mode used `nord0` as foreground color
instead of `nord4` resulting in a bad contrast.
Also after checking ( links to it)
Also since there was also no color defined for terminal mode for the
`MoreMsg` group (see `:help MoreMsg` that link to `:help more-prompt`)
Vim used the default color which was some kind of green.
To ensure it matches Nord's style it has now been changed to use `nord8`
(main accent color) for both terminal and GUI mode.
This can be tested by running `:echon "MESSAGE\n"` taht produces a lot
of lines that won't fit on the current screen space anymore.
Co-authored-by: Arctic Ice Studio <development@arcticicestudio.com>
Co-authored-by: Sven Greb <development@svengreb.de>