2025-02-01 14:20:52 -08:00
|
|
|
-- [nfnl] Compiled from ./fnl/scripts/kitty-padding.fnl by https://github.com/Olical/nfnl, do not edit.
|
2024-11-01 13:54:16 -07:00
|
|
|
local M = {}
|
2025-02-01 14:20:52 -08:00
|
|
|
local ___fn___ = vim.fn
|
2024-11-01 13:54:16 -07:00
|
|
|
local api = vim.api
|
|
|
|
local autocmd = api.nvim_create_autocmd
|
|
|
|
local autogroup = api.nvim_create_augroup
|
2025-02-01 14:20:52 -08:00
|
|
|
local function no_padding(sync)
|
2024-11-01 13:54:16 -07:00
|
|
|
local command = "kitty @ set-spacing padding-h=0 padding-bottom=0"
|
|
|
|
if not sync then
|
2025-02-01 14:20:52 -08:00
|
|
|
local function _1_(_, d, _0)
|
|
|
|
if (#d > 1) then
|
|
|
|
return vim.notify("Error setting window padding. Make sure kitty remote control is turned on.", vim.log.levels.DEBUG)
|
|
|
|
else
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return ___fn___.jobstart(command, {on_stderr = _1_})
|
2024-11-01 13:54:16 -07:00
|
|
|
else
|
2025-02-01 14:20:52 -08:00
|
|
|
return ___fn___.system(command)
|
2024-11-01 13:54:16 -07:00
|
|
|
end
|
|
|
|
end
|
2025-02-01 14:20:52 -08:00
|
|
|
local function restore_padding(sync)
|
2024-11-01 13:54:16 -07:00
|
|
|
local command = "kitty @ set-spacing padding=default"
|
|
|
|
if not sync then
|
2025-02-01 14:20:52 -08:00
|
|
|
local function _4_(_, d, _0)
|
|
|
|
if (#d > 1) then
|
|
|
|
return vim.notify("Error setting window padding. Make sure kitty remote control is turned on.", vim.log.levels.DEBUG)
|
|
|
|
else
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return ___fn___.jobstart(command, {on_stderr = _4_})
|
2024-11-01 13:54:16 -07:00
|
|
|
else
|
2025-02-01 14:20:52 -08:00
|
|
|
return ___fn___.system(command)
|
2024-11-01 13:54:16 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
M.setup = function()
|
2025-02-01 14:20:52 -08:00
|
|
|
local function _7_()
|
|
|
|
return no_padding()
|
|
|
|
end
|
|
|
|
autocmd({"VimResume", "VimEnter"}, {callback = _7_, group = autogroup("SpacingRemove", {clear = true}), pattern = "*"})
|
|
|
|
local function _8_()
|
|
|
|
return restore_padding(true)
|
|
|
|
end
|
|
|
|
return autocmd({"VimLeavePre", "VimSuspend"}, {callback = _8_, group = autogroup("SpacingRestore", {clear = true})})
|
2024-11-01 13:54:16 -07:00
|
|
|
end
|
|
|
|
return M
|