-
|
I encountered an edge case. I'm developing a color theme that allows falling back to user's terminal colors for neovim terminals, which I detect with using this type of check I implemented various conditions with autocmd (see above link) that catch switching in and out of the terminal for windows and buffers. That generally works, but I noticed that fzf windows started being treated as a terminal in this regard. Is there some way to prevent that or may be to refine my check to avoid that collision? |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 18 replies
-
|
Hm, may be matching |
Beta Was this translation helpful? Give feedback.
-
|
That didn't help: local is_terminal = (vim.bo.buftype == "terminal") and vim.api.nvim_buf_get_name(0):find('^term://')It still matches fzf lua windows. |
Beta Was this translation helpful? Give feedback.
-
|
OK, I figured out one way to do it: since filetype for fzf buffer is set to |
Beta Was this translation helpful? Give feedback.
-
|
Heh, now I hit another issue. I reset colors to default in my them for terminals like this: But I need to prevent that from affecting fzf-lua windows... |
Beta Was this translation helpful? Give feedback.
-
|
I arrived to something like this: local function is_normal_terminal()
return (vim.bo.buftype == "terminal") and (vim.o.filetype == "")
end
vim.api.nvim_create_autocmd({ 'TermOpen', 'TermEnter' }, {
pattern = { "*" },
callback = function()
vim.schedule(function()
if not is_normal_terminal() then
for term_color, value in pairs(<...table_of_theme_terminal_colors...>) do
vim.g[term_color] = value
end
end
end)
end,
desc = "handling special terminals with theme's colors"
})Where term_color is from That sort of works but weirdly. When I open fzf's custom grep command, it doesn't work at first try, but works at all subsequent ones: If I change |
Beta Was this translation helpful? Give feedback.
-
|
Also asked this: neovim/neovim#37517 |
Beta Was this translation helpful? Give feedback.
-
|
Here is my current approach: https://gitlab.com/shmerl/neogotham/-/blob/main/lua/neogotham/theme.lua?ref_type=heads#L162 It mostly works except the above problem, but I suspect there might be some bug in fzf-lua that affects that first time invocation. |
Beta Was this translation helpful? Give feedback.
-
|
@ibhagwan: Can you please suggest if it's possible to solve? Or may be it's better to open a bug about it? I think I'm hitting this kind of problem: In order to detect fzf-lua's window, I'm catching Postponing that to later time with vim.schedule or with So what is the correct way to do it? See more discussion here. |
Beta Was this translation helpful? Give feedback.
#2534