-
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
zztrieuzz
committed
Dec 20, 2023
1 parent
a18a580
commit 0f2ae87
Showing
2 changed files
with
13 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,18 @@ | ||
local M = {} | ||
local create_highlight_group = function (name, link) | ||
local ok, hl = pcall(vim.api.nvim_get_hl_by_name, link, true) | ||
if not ok then | ||
return | ||
end | ||
if hl.foreground ~= nil then | ||
-- vim.cmd.highlight({name, 'guifg='.. string.format("#%06x", hl.foreground)}) | ||
vim.cmd("highlight " .. name .. " guifg=" .. string.format("#%06x", hl.foreground) ) | ||
end | ||
|
||
if hl.background ~= nil then | ||
-- vim.cmd.highlight({name, 'guibg='.. string.format("#%06x", hl.background)}) | ||
vim.cmd("highlight " .. name .. " guibg=" .. string.format("#%06x", hl.background) ) | ||
end | ||
M.set_hl = function() | ||
vim.api.nvim_set_hl(0, 'SpectreHeader', { link = "Comment" }) | ||
vim.api.nvim_set_hl(0, 'SpectreBody', { link = "String" }) | ||
vim.api.nvim_set_hl(0, 'SpectreFile', { link = "Keyword" }) | ||
vim.api.nvim_set_hl(0, 'SpectreDir', { link = "Comment" }) | ||
vim.api.nvim_set_hl(0, 'SpectreSearch', { link = "DiffChange" }) | ||
vim.api.nvim_set_hl(0, 'SpectreBorder', { link = "Comment" }) | ||
vim.api.nvim_set_hl(0, 'SpectreReplace', { link = "DiffDelete" }) | ||
end | ||
|
||
create_highlight_group('SpectreHeader', "Comment") | ||
create_highlight_group('SpectreBody', "String") | ||
create_highlight_group('SpectreFile', "Keyword") | ||
create_highlight_group('SpectreDir', "Comment") | ||
create_highlight_group('SpectreSearch', "DiffChange") | ||
create_highlight_group('SpectreBorder', "Comment") | ||
create_highlight_group('SpectreReplace', "DiffDelete") | ||
vim.api.nvim_create_autocmd('ColorScheme', { | ||
pattern = '*', | ||
callback = M.set_hl | ||
}) | ||
|
||
return M; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters