r/neovim • • 12d ago

Need Help Small gap when using nvim

Post image

Sorry if this is the wrong place to post this.

When i open nvim, there is a small gap at the bottom, i dont know how to remove it, im using kitty, i tried setting window_padding_width to 0 and a bunch of other things but i cannot get it to work, can anyone help me with this?

3 Upvotes

11 comments sorted by

7

u/IGTHSYCGTH 12d ago

some terminals (ghostty, kitty?) may extend the cell hight or color out of cell border pixels with the same color

which terminal are you using? check the socs :shrug:

3

u/WaffleHBG 12d ago

i mentioned im using kitty, is there any fix for this?

3

u/aumerlex 11d ago

Sure use padding_fill_strategy in kitty.conf

1

u/uGn8r 11d ago

Awesome! Thanks (had to update to latest version to make it work).
For me it was this: `padding_fill_strategy neighboring_cell`
However still sad that kitty doesn't support the window padding color override (like ghostty)

2

u/IGTHSYCGTH 12d ago

nope, i can only point you in the right direction.

besides you cant fix something thats not broken, its the standard behavior of terminals..

some just offer extra features to align pad and customize window margins / borders.

ive been using ghostty for a few years now and we do have a setting like window-padding-color = extend-always, check the kitty docs to find out what knobs you have to adjust.

13

u/echasnovski Plugin author 12d ago

If the gap is that thin black line, it is the color of the terminal emulator's background, and it changes in size when changing font size, then this will probably help: https://echasnovski.com/blog/2024-08-01-remove-padding-around-neovim-instance.html

2

u/Lopsided_Valuable385 12d ago

I'm kinda confused, I dont see the gap you're talking about. Is it the grep, orange and blue thing? Or is it the line under the nvim statusline? If it's the second one, set cmdheight to 0.

:h 'cmdheight'

1

u/vim-help-bot 12d ago

Help pages for:


`:(h|help) <query>` | about | mistake? | donate | Reply 'rescan' to check the comment again | Reply 'stop' to stop getting replies to your comments

2

u/usecornercase 11d ago

Setting window_padding_width to 0 only removes the configured padding. A thin strip can still remain because the window's pixel size is rarely an exact multiple of the cell size, so the leftover pixels get filled with the terminal background color. Kitty centers the cell grid by default, which splits that remainder across the edges.

Two things worth trying in kitty.conf:

placement_strategy top-left

That pushes all the leftover pixels to the bottom and right edge instead of spreading them around. Then make the terminal background match your colorscheme's Normal background so the strip is not visible at all:

background #1e1e2e

Use the actual hex from your theme (:hi Normal shows guibg). If you tile kitty with a window manager, the remainder changes with the window size, which is why it moves when you change font size. Also set window_padding_width 0 and check that you have no window_margin_width or window_border_width set. Restart kitty after the change, since placement_strategy is not always picked up by reloading the config.

1

u/AccomplishedFocus551 6d ago

that's why I switched to foot terminal,

1

u/rainwinter04 2d ago

Hey! This has also bothered me for quite some time, if you'd like a fix, I have multiple.

Almost all terminals render everything like programs (such as nvim) and content (like your shell) with text. This means that, depending on your font and font size, there will practically always be unused pixels in the window as your cell height/width is not always a perfect divisor of your window height/width. This is a limitation of all terminals (that I've seen), and has bothered me for years!

I have a few fixes for Kitty specifically, and I'm not sure if these work on other terminals:

  1. Edit kitty.conf. Kitty has a few options to remedy this, but none of them work perfectly. Adding placement_strategy top_left moves all the unused pixels to the bottom. padding_fill_strategy neighboring_cell (default is background) replaces the unused pixels with the nearest used pixel. So if the edge of your terminal content is all the background, it will just use the background colour. This causes some issues with me personally though, as I use yazi, and this setting causes some buttons located at the edge to extend downwards in a very buggy way.

  2. Set your kitty background (assuming you have padding_fill_strategy background) to the same colour as your neovim background. Works great if you don't ever change your neovim colourscheme or use dynamic colours to change the kitty/nvim background like pywal. This has an issue though. If you use Kitty's opacity mode below 1, (e.g. background_opacity 0.75) and you use the same colour for your Kitty background as anything in your terminal content (e.g. nvim's background), the colour becomes transparent. This means that if you have 0.75 kitty opacity, and your nvim and Kitty backgrounds match, your nvim will become transparent as well.

  3. Edit init.lua. Kitty has the config option to enable remote access (allow_remote_control yes). If enabled, you can write a few autocmds in your neovim config to automatically change your Kitty background to match your neovim background or whatever colour you may want (and change the opacity to be fully opaque if needed). If done right, this only affects the current Kitty window, and is highly customisable. This is currently what I use to patch the bars out.

If you'd like, I can send over the current code I have in place to fix the issue along with all dependencies/requirements!!

Happy configs!