background opacity of terminal changes when nvim opens using kitty
This commit is contained in:
2
init.lua
2
init.lua
@@ -29,6 +29,7 @@ require("lazy").setup({
|
||||
"rktjmp/lush.nvim", -- better theme editing
|
||||
'vyfor/cord.nvim', --discord rich presence
|
||||
'RRethy/base16-nvim',
|
||||
{ 'norcalli/nvim-colorizer.lua', config = function() require('colorizer').setup{"*"} end,}, -- preview colors
|
||||
{'NMAC427/guess-indent.nvim', config = function() require('guess-indent').setup {} end,}, -- Detect tabstop and shiftwidth automatically
|
||||
{ 'edluffy/hologram.nvim', auto_display = true,}, --image viewer
|
||||
{ "denialofsandwich/sudo.nvim", dependencies = { "MunifTanjim/nui.nvim", },config = true, }, --write restricted files without restart
|
||||
@@ -50,3 +51,4 @@ if theme_ok then
|
||||
matugen.setup()
|
||||
end
|
||||
|
||||
require('autocommands')
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
"mini.pick": { "branch": "main", "commit": "8521fe21df86e08d9e4b3c3f3a7d50e47954e1af" },
|
||||
"neogit": { "branch": "master", "commit": "8fd90675caf8b847280ca56f464b66030adad876" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
|
||||
"nvim-dap": { "branch": "master", "commit": "a9d8cb68ee7184111dc66156c4a2ebabfbe01bc5" },
|
||||
"nvim-java": { "branch": "main", "commit": "602a5f7fa92f9c1d425a2159133ff9de86842f0a" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "d8bf4c47385340ab2029402201d4d7c9f99f437a" },
|
||||
|
||||
26
lua/autocommands.lua
Normal file
26
lua/autocommands.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
-- [[dynamicallt change kitty window opacity when opening and closing]]
|
||||
-- Define the target opacities
|
||||
local nvim_opacity = "0.85"
|
||||
local default_opacity = "0.6"
|
||||
-- Function to talk to Kitty
|
||||
local function set_kitty_opacity(opacity)
|
||||
print("Attempting to set opacity to: " .. opacity)
|
||||
os.execute("kitty @ set-background-opacity " .. opacity)
|
||||
end
|
||||
-- Set up the autocommands
|
||||
local kitty_group = vim.api.nvim_create_augroup("KittyOpacity", { clear = true })
|
||||
|
||||
vim.api.nvim_create_autocmd("VimEnter", {
|
||||
group = kitty_group,
|
||||
callback = function()
|
||||
set_kitty_opacity(nvim_opacity)
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("VimLeave", {
|
||||
group = kitty_group,
|
||||
callback = function()
|
||||
set_kitty_opacity(default_opacity)
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
-- [[ Basic Autocommands ]]
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
desc = 'Highlight when yanking (copying) text',
|
||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||
callback = function()
|
||||
vim.hl.on_yank()
|
||||
end,
|
||||
})
|
||||
-- move betwwen buffer easier
|
||||
vim.keymap.set('n', '<Tab>', ':bnext<CR>')
|
||||
vim.keymap.set('n', '<S-Tab>', ':bprev<CR>')
|
||||
vim.keymap.set('n', '<leader>x', ':bdelete<CR>')
|
||||
|
||||
@@ -52,16 +52,6 @@ vim.o.scrolloff = 25
|
||||
-- instead raise a dialog asking if you wish to save the current file(s)
|
||||
-- See `:help 'confirm'`
|
||||
vim.o.confirm = true
|
||||
-- [[Keybinds]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
-- See `:help hlsearch`
|
||||
|
||||
-- [[ Basic Autocommands ]]
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
desc = 'Highlight when yanking (copying) text',
|
||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||
callback = function()
|
||||
vim.hl.on_yank()
|
||||
end,
|
||||
})
|
||||
vim.opt.termguicolors = true -- required for colorizer
|
||||
|
||||
|
||||
Reference in New Issue
Block a user