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

feat: add non current highlight group #216

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ The table below shows all the highlight groups defined for Trouble.
| _TroubleCount_ |
| _TroubleError_ |
| _TroubleNormal_ |
| _TroubleNormalNC_ |
| _TroubleTextInformation_ |
| _TroubleSignWarning_ |
| _TroubleLocation_ |
Expand Down
2 changes: 1 addition & 1 deletion doc/trouble.nvim.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*trouble.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 July 29
*trouble.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 August 04

==============================================================================
Table of Contents *trouble.nvim-table-of-contents*
Expand Down
1 change: 1 addition & 0 deletions lua/trouble/colors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ local links = {
Location = "LineNr",
FoldIcon = "CursorLineNr",
Normal = "Normal",
NormalNC = "NormalNC",
Count = "TabLineSel",
Preview = "Search",
Indent = "LineNr",
Expand Down
6 changes: 4 additions & 2 deletions lua/trouble/view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ local util = require("trouble.util")

local highlight = vim.api.nvim_buf_add_highlight

local winhl = "Normal:TroubleNormal,NormalNC:TroubleNormalNC,EndOfBuffer:TroubleNormal,SignColumn:TroubleNormal"

---@class TroubleView
---@field buf number
---@field win number
Expand Down Expand Up @@ -152,7 +154,7 @@ function View:setup(opts)
self:set_option("foldcolumn", "0", true)
self:set_option("foldlevel", 3, true)
self:set_option("foldenable", false, true)
self:set_option("winhighlight", "Normal:TroubleNormal,EndOfBuffer:TroubleNormal,SignColumn:TroubleNormal", true)
self:set_option("winhighlight", winhl, true)
self:set_option("fcs", "eob: ", true)

for action, keys in pairs(config.options.action_keys) do
Expand Down Expand Up @@ -306,7 +308,7 @@ function View:on_win_enter()
-- open the buffer in the parent
vim.api.nvim_win_set_buf(parent, current_buf)
-- HACK: some window local settings need to be reset
vim.api.nvim_win_set_option(parent, "winhl", "")
vim.api.nvim_win_set_option(parent, "winhl", winhl)
-- close the current trouble window
vim.api.nvim_win_close(self.win, false)
-- open a new trouble window
Expand Down