Change border-width of splits in VIM
Asked Answered
A

3

7

I have been configuring my VIM installation for days now, and it's just a few more days away from heavenly perfect. Only thing that is bugging me however, is the border width of the splits.

Is there any way to change the width of these? Or maybe just set the color of them to the same as the background?

enter image description here

I mean the clunky 6/7px vertical border displayed in this picture.

Alleviation answered 6/7, 2013 at 19:21 Comment(0)
A
15

The split will always be one character cell wide. However you can

set fillchars+=vert:\|

and set the VertSplit highlight group to something appropriate, e.g.

hi vertsplit guifg=fg guibg=bg

in your colour scheme. Since the splits are drawn using the '|' character, the line will be broken rather than continuous which is unfortunate. Unless you can find a font that contains a full height bar (but remember that extended characters can't be used in options in the command line, but they can in the command window or in your vimrc).

If you do use a full height bar, you also need to make sure that 'linespace' is set to 0 (it defaults to 1 in gvim on Windows).

Aegisthus answered 6/7, 2013 at 19:29 Comment(5)
I ended up using guifg=bg guibg=bg to "remove" it completely.Alleviation
Well, if you always have 'number' set, and you are highlighting line numbers in a different background colour to Normal, then that sounds like a neat trick. You might have gaps when you reach the end of the buffer though.Aegisthus
Yeah, looks fantastic :) Btw, you know how to remove the "~"-characters that are repeated vertically under the line numbers as well? (just one red ~ visible in my picture, but they are repeated on all lines below where the line numbers ends)Alleviation
That uses the NonText highlight group.Aegisthus
Uh, that will affect a few other things though. See :h hl-NonText.Aegisthus
P
3

Vim has different options for font style, used in hi command.

for example: NONE, bold, underline, italic, reverse, undercurl..

for your needs, you could get your current highlighting of vertsplit by:

:hi VertSplit

From your screenshot, I guess you have gui(or term)=standout try to change it into NONE:

hi! VertSplit guifg=[yourFG] guibg=[YourBG] gui=NONE

or if you run vim in terminal:

hi! VertSplit ctermfg=[yourFG] ctermbg=[YourBG] term=NONE

this should give you a narrower split line.

check out :h hi too see details

Pothouse answered 6/7, 2013 at 19:37 Comment(0)
I
0

There is a better way doing this

-- Set splitright and splitbelow to avoid creating an additional split
vim.opt.splitright = true
vim.opt.splitbelow = true

-- Define a custom highlight group for the vertical split border
vim.cmd('highlight VertSplit cterm=NONE ctermfg=NONE ctermbg=NONE guifg=#888888 guibg=NONE')
Inoffensive answered 5/4 at 1:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.