I have made my custom status line for vim and I ran into a problem, When I do :split, it becomes very hard to see the separation between the buffers because of the way I set it up. I now want to add a character to act as a separating border between the text on the left side to the right side. On the left, I have a file name and its path(Which alters in length), on the right I have some information about the buffer number and such. I cannot hard code a character because sometime when the file path is too long it gets cut off. I want to be able to call a function that will return a variable amount of a character based on the amount of white space I have between the two ends of the status line.
I have thought of multiple ways to solve this but I just do not know how to do it and I cannot find answers online. At first, I had an idea of just underlining the whole status line but I do not know how to do this.
Now my idea for adding a variable number of characters is a different, I want to define a function that uses regex to read the status line text and replace the line with a variable amount of characters that would fit perfectly in the given whitespace.
I do not know how to do this and I would appreciate any help. In addition, I also wanted to make a certain element of the status bar change color based on which buffer my cursor is in so it is easier to find the correct window, I could not find a way to do this either and a pointer in the right direction will be appreciated.
set laststatus=2
set statusline=
set statusline+=%2*\ %l
set statusline+=\ %*
set statusline+=%1*\ ‹‹
set statusline+=%1*\ %t\ %*
set statusline+=%1*\ ››
set statusline+=%1*\ %m
set statusline+=%3*\ %F
set statusline+=%{AddSeperator()}
set statusline+=%=
set statusline+=%3*\ ‹‹
set statusline+=%3*\ %{strftime('%R',getftime(expand('%')))}
set statusline+=%3*\ ::
set statusline+=%3*\ %n
set statusline+=%3*\ ››\ %*