You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I would like to change the background of the toggleterm buffer to transparent. The transparency feature is working in my config since e.g., setting "transparency_bg" to true from the colorscheme lua file makes all buffers going transparent after restart. Also redefining the Normal highlight group like: ":hi Normal guifg=NONE guibg=NONE" does it (in this case any currently selected buffer gets transparent, without restart). As a last note, when toggling the "shade_terminals" option from toggleterm, the color of the toggleterm buffer gets either darker or lighter, but never transparent.
This is what i have in my toggleterm.lua file:
return {
"akinsho/toggleterm.nvim",
version = "*",
config = function()
require("toggleterm").setup({
size = function(term) -- 20 | function(term)
if term.direction == "horizontal" then
return 10
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
end,
open_mapping = "<C-g>", -- general terminal
shade_terminals = false,
highlights = {
Normal = { guifg=NONE, guibg=NONE },
NormalFloat = { guifg=NONE, guibg=NONE },
},
start_in_insert = false,
insert_mappings = true, -- whether or not the open mapping applies in insert mode
persist_size = false,
close_on_exit = true, -- close the terminal window when the process exits
hide_numbers = true, -- hide the number column in toggleterm buffers
shell = vim.o.shell,
})
function _G.set_terminal_keymaps()
local opts = { buffer = 0, noremap = true }
vim.keymap.set("t", "jk", [[<C-\><C-n>]], opts)
vim.keymap.set("t", "<C-h>", [[<Cmd>wincmd h<CR>]], opts)
vim.keymap.set("t", "<C-j>", [[<Cmd>wincmd j<CR>]], opts)
vim.keymap.set("t", "<C-k>", [[<Cmd>wincmd k<CR>]], opts)
vim.keymap.set("t", "<C><Left>", [[<Cmd>wincmd l<CR>]], opts)
end
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()")
end,
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I would like to change the background of the toggleterm buffer to transparent. The transparency feature is working in my config since e.g., setting "transparency_bg" to true from the colorscheme lua file makes all buffers going transparent after restart. Also redefining the Normal highlight group like: ":hi Normal guifg=NONE guibg=NONE" does it (in this case any currently selected buffer gets transparent, without restart). As a last note, when toggling the "shade_terminals" option from toggleterm, the color of the toggleterm buffer gets either darker or lighter, but never transparent.
This is what i have in my toggleterm.lua file:
And this is my colorscheme.lua:
Any hint would be appreciated, thank you!!
Beta Was this translation helpful? Give feedback.
All reactions