Closed RichestHumanAlive closed 1 year ago
I thought setting NormalFloat
(which is the default highlight group of floating window) to be transparent, but the problem is that not all floating window have a border, instead the designs in most of them are using a brighter background to distinguish between normal background colors, so I gave up this idea.
Another thing that needs to be considered is that vim actually shouldn't make everything transparent, some elements should use a different background color (e.g. the status line). If you want to make your vim fully transparent, you should consider switching to a terminal emulator that supports blurred background (e.g. konsole). This will fully blur every elements in vim, which will look much better.
Thank you for your answer and tips 🙂. I understand a little better how the Vim UI works.
Indeed, I use Windows Terminal which supports blurred background and that's why, for better appearance, I disabled as many backgrounds as possible using:
let g:sonokai_transparent_background=2
Also, what I like about the transparency of Vim is that it is pseudo-transparent actually, inside the Vim UI and you can't see through a floating window even if it's "transparent". Floating transparent windows actually just takes the lowest background of the UI at that specific area. With borders it's even better like here:
Even if there is text behind the floating window, the text will not appear and will be covered by pseudo-transparent background. Unless I misunderstood something.
This is precisely want I need to achieve for all my floating windows.
Should look at how to customize the background for each plugin that uses floating windows or is there a way to overwrite the default appearance of all floating windows of Vim?
Thanks in advance for your time 🙂.
Edit : I finally found that I just had to define the following highlight commands:
vim.cmd("hi NormalFloat ctermbg=NONE guibg=NONE") vim.cmd("hi FloatTitle ctermbg=NONE guibg=NONE") vim.cmd("hi FloatBorder ctermbg=NONE guibg=NONE")
And here is the result for Mason.nvim
for example :
Went from :
to:
Should add this for LSP Diagnostics
vim.cmd("hi DiagnosticFloatingHint ctermbg=NONE guibg=NONE guifg=#42E66C")
vim.cmd("hi DiagnosticFloatingInfo ctermbg=NONE guibg=NONE guifg=#0876c5")
vim.cmd("hi DiagnosticFloatingWarn ctermbg=NONE guibg=NONE guifg=#E8AB53")
vim.cmd("hi DiagnosticFloatingError ctermbg=NONE guibg=NONE guifg=#ff5189")
Freely choosing foreground colors (guifg
)
output:
Thank you for your attention.
Any solutions for Linux? I have the same problem on Arch Linux with Alacritty. The solution above didn't help.
And here is the result for
Mason.nvim
for example :Went from :
to:
Should add this for LSP Diagnostics
Freely choosing foreground colors (
guifg
)output:
I have done the following steps before reporting this issue:
Operating system/version
Windows 11 Pro Insider Preview 22H2 - OS build 25252.1000
Terminal emulator/version
Powershell 7.3.0-rc.1
$TERM environment variable
NULL
Tmux version
No response
Feature matrix
diffview: require("diffview.health").check()
Checking plugin dependencies
Checking external dependencies
gitsigns: require("gitsigns.health").check()
lsp: health#lsp#check
server status
server configuration: omnisharp-lsp
allowlist
['cs']
Performance
mason: require("mason.health").check()
mason.nvim report
cargo 1.65.0 (4bc8f24d3 2022-10-20)
Composer version 2.3.7 2022-06-06 16:43:28
PHP 8.0.14 (cli) (built: Dec 16 2021 10:25:26) ( ZTS Visual C++ 2019 x64 )
9.1.2
v16.15.1
javac 11.0.12
openjdk version "11.0.12" 2021-07-20
curl 7.85.0 (Windows) libcurl/7.85.0 Schannel
bsdtar 3.6.1 - libarchive 3.6.1 zlib/1.2.5.f-ipp bz2lib/1.0.6
Python 3.11.0
`
Python 3.11.0
`
openjdk version "17.0.3" 2022-04-19
nvim: health#nvim#check
Configuration
Performance
Remote Plugins
nvim-treesitter: require("nvim-treesitter.health").check()
Installation
tree-sitter
found 0.20.7 (b268e412ad4848380166af153300464e5a1cf83f) (parser generator, only needed for :TSInstallFromGrammar)node
found v16.15.1 (only needed for :TSInstallFromGrammar)git
executable found.zig
executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" } Version: info: Usage: zig [command] [options]OS Info:
{ machine = "x86_64", release = "10.0.25252", sysname = "Windows_NT", version = "Windows 10 Pro" }
Parser/Features H L F I J
python ✓ ✓ ✓ ✓ ✓
Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections +) multiple parsers found, only one will be used x) errors found in the query, try to run :TSUpdate {lang}
The following errors have been detected:
provider: health#provider#check
Clipboard (optional)
Python 3 provider (optional)
Python virtualenv
Ruby provider (optional)
ruby
andgem
must be in $PATH.ruby
andgem
commands work.Node.js provider (optional)
Perl provider (optional)
telescope: require("telescope.health").check()
Checking for required plugins
Checking external dependencies
===== Installed extensions =====
Telescope Extension:
projections
vim.lsp: require("vim.lsp.health").check()
vim.treesitter: require("vim.treesitter.health").check()
Minimal vimrc that can reproduce this bug.
Steps to reproduce this bug using minimal vimrc
Launch nvim
Show Lsp Diagnostic popup using
output:
Run command
output:
Run command
output:
Expected behavior
I was expecting transparent backgrounds for for lsp diagnostics popup,
lspinfo
window andMason
window as for the main windows.For example, something like this for lsp diagnostics:
Actual behavior
Opaque background.
Sonokai is an Awesome 💯 !