Open Thirdwinter opened 5 months ago
I made a vim autocmd to remove then when I enter Neovim and add them back when I exit.
Currently using AstroNvim
but this can be converted easily to a normal nvim autocmds:
NOTE: You will need to put the window_padding
on one line !
Note that I am currently using the sd
command which is a cross-platform remplacement for the sed
command available on unix systems as I'm am currently using Windows Powershell.
On VimEnter
{
event = "VimEnter",
desc = "Remove WezTerm padding when entering Neovim",
group = "removeshellspaddings",
command = ":silent !sd -F '{ left = 20, right = 20, top = 15, bottom = 15 }' '{ left = 0, right = 0, top = 0, bottom = 0 }' '<add your wezterm config file path here>'"
},
On VimLeavePre
{
event = "VimLeavePre",
desc = "Add WezTerm padding padding back when exiting Neovim",
group = "addshellspaddings",
command = ":silent !sd -F '{ left = 0, right = 0, top = 0, bottom = 0 }' '{ left = 20, right = 20, top = 15, bottom = 15 }' '<add your wezterm config file path here>'"
},
It could be way easier if wezterm could have a command with the wezterm CLI.
With normal autocmds on neovim and using sed
, it would probably look like this:
-- Commands when Vim start
vim.api.nvim_create_autocmd("VimEnter", {
command = ":silent !sed -i -e 's/{ left = 20, right = 20, top = 15, bottom = 15 }/{ left = 0, right = 0, top = 0, bottom = 0 }/g' '<add your wezterm config file path here>'",
})
-- Commands when just before Vim exits
vim.api.nvim_create_autocmd("VimLeavePre", {
command = ":silent !sed -i -e 's/{ left = 0, right = 0, top = 0, bottom = 0 }/{ left = 20, right = 20, top = 15, bottom = 15 }/g' '<add your wezterm config file path here>'",
})
Sorry, maybe I did something wrong and this didn't work. I also tried to directly change the padding of wezterm to 0, and then started neovim, but the bottom edge was still not filled.
return {
-- Commands when Vim start
vim.api.nvim_create_autocmd("VimEnter", {
command = ":silent !sed -i -e 's/{ left = 5, right = 5, top = 5, bottom = 0 }/{ left = 0, right = 0, top = 0, bottom = 0 }/g' 'C:/Users/86136/.config/wezterm/config/appearance.lua'",
}),
-- Commands when just before Vim exits
vim.api.nvim_create_autocmd("VimLeavePre", {
command = ":silent !sed -i -e 's/{ left = 0, right = 0, top = 0, bottom = 0 }/{ left = 5, right = 5, top = 5, bottom = 0 }/g' 'C:/Users/86136/.config/wezterm/config/appearance.lua'",
}),
}
I tried this approach and it worked, but there were still unfilled areas at the bottom and on the right.
vim.api.nvim_create_autocmd("VimEnter", {
command = ":e C:/Users/86136/.config/wezterm/config/appearance.lua | %s/{ left = 5, right = 5, top = 5, bottom = 0 }/{ left = 0, right = 0, top = 0, bottom = 0 }/g | w",
})
vim.api.nvim_create_autocmd("VimLeavePre", {
command = ":e C:/Users/86136/.config/wezterm/config/appearance.lua | %s/{ left = 0, right = 0, top = 0, bottom = 0 }/{ left = 5, right = 5, top = 5, bottom = 0 }/g | w",
})
Then I do not know how to fix that. I never notice the gap in my instance of Neovim. Perhaps because I use a dark background.
We will need @wez knowledge for this one.
I'm sorry to say that I don't understand the issue. From what you shared, you've configured padding on the edges that you've indicated with arrows in the image, so it looks how I'd expect.
There's not enough of a description of what you're trying, what you expect to see and what is happening here for me to understand the issue that you're having.
很抱歉,我不明白这个问题。从您分享的内容来看,您已在图像中用箭头指示的边缘配置了填充,因此看起来符合我的预期。
对于您正在尝试的操作、您希望看到的操作以及此处发生的情况,我没有足够的描述来了解您遇到的问题。
using neovim in wezterm just like this: right and bottom can see background color ,not i want
and in wt using neovim:
I think this is reasonable
@Thirdwinter are you using a tiling window manager that could be adding padding
Also, I forgot to ask if you played with config.line_height and font size variations?
@akthe-at These are not used. I tried setting line_height to 1.1, but that didn't have much effect.
local wezterm = require('wezterm')
local platform = require('utils.platform')
local font = 'Maple Mono Light'
local font_size = platform().is_win and 10 or 9
return {
-- line_height = 1.1,
font = wezterm.font(font),
font_size = font_size,
warn_about_missing_glyphs = false,
freetype_load_target = 'Normal',
freetype_render_target = 'Light',
}
for Linux and macOS system, you can use bg.nvim by using ascii escape code to sync background color
set padding to 0 looks awful to me,so for windows system,i use neovide gui
@Thirdwinter a workaround is just use the same color scheme
can i toggle wezterm opacity automatically using vim autocmd?
@AtifChy I think this is not a good solution. The solution I use now is to select a good-looking background image in wezterm, and then choose a theme with good transparency support in Neovim. Similar to this And then, @wez I have to mention the transparency setting. I tried to test it on my friend's computer. The wezterm, configuration file, and operating system are the same. The only difference is the hardware. However, my low-end screen cannot display the transparency effect. Adjusting the transparency parameter can only darken the background.
There’s an approach without specifying the path to the wezterm configuration. It also works if for some reason nvim doesn't see the path or there is no way to use this solution (the tab title doesn't change in wsl when you open nvim). However, the bottom padding will still remain for me.
wezterm configuration
local padding = {
left = '1cell',
right = '1cell',
top = '0.5cell',
bottom = '0.5cell',
}
wezterm.on('user-var-changed', function(window, pane, name, value)
if name == "NVIM_ENTER" then
local overrides = window:get_config_overrides() or {}
if value == "1" then
overrides.window_padding = {
left = 0,
right = 0,
top = 0,
bottom = 0
}
else
overrides.window_padding = padding
end
window:set_config_overrides(overrides)
end
end)
neovim configuration
local autocmd = vim.api.nvim_create_autocmd
autocmd("VimEnter", {
callback = function()
--NVIM_ENTER=1
vim.cmd([[call chansend(v:stderr, "\033]1337;SetUserVar=NVIM_ENTER=MQ==\007")]])
end,
})
autocmd("VimLeavePre", {
callback = function()
--NVIM_ENTER=0
vim.cmd([[call chansend(v:stderr, "\033]1337;SetUserVar=NVIM_ENTER=MA==\007")]])
end,
})
@Sakamitsu Thank you ! It works great. For the bottom padding, it has to be Neovim's command prompt height.
What Operating System(s) are you seeing this problem on?
Windows
Which Wayland compositor or X11 Window manager(s) are you using?
No response
WezTerm version
wezterm 20240520-135708-b8f94c47
Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?
Yes, and I updated the version box above to show the version of the nightly that I tried
Describe the bug
It's like this
To Reproduce
No response
Configuration
Configurations that may be relevant I tried changing the configuration in it, but it didn't work well, at least one border couldn't be filled