28

I use a tiling window manager (awesome) + a terminal multiplexer (tmux) + splits inside of vim. I have no window decorations at all, so there is no visual split between them at all if the content of the program doesn't give it away. I'm quite comfortable with this paradigm as I use multiple monitors and group tasks by screen anyway. If two windows didn't have a reason to be side by side they wouldn't be there in the first place.

However this creates a bit of visual dissonance where the most obvious split visually is the least significant semantically.

  • Xorg window ‹|› window = nothing at all
  • Tmux pane ‹|› pane = 1px divider line
  • Vim split ‹|› split = 1 character wide colored column

Here's a sample showing one each side by side windows, panes and vim splits:

windows panes and splits

Even without clicking through to the full resolution version, the white divider line you see is the least significant split on the screen, the vim panes. (Note the gray column at the right of the vim session is actually an 80th column highlight, not a divider of any kind although I do often work at that size.)

I am aware of how to change the character drawn in the split or reduce the color scheme contrast. What I would like to do is use the same split bar as tmux that doesn't take up any width because it's drawn in between columns rather than in one. Is this possible with terminal based vim? Gvim? Neovim? If making a visually unobtrusive separator is not possible, can the divider column be turned off entirely?

P.S. The reason using a visually similar separator makes sense is because I use the same key-bindings to navigate between tmux panes and vim splits. The same keys navigate seamlessly between them, it would only make sense if the visual boundaries were the same as well.

3 Answers 3

42

You are wrong about tmux. Like every terminal-based program — including Vim — it only draws stuff inside cells. This means that Vim and tmux both use the same method to draw vertical borders: they just use a pipe-like character.

Tmux uses (U+2502) by default while Vim uses | (U+007C).

If you want the same separator in Vim, you can simply use the same character:

set fillchars+=vert:│

Note that your colorscheme probably sets the background-color of the vertical split. If that's the case, you can remove the background-color directly in your colorscheme:

hi VertSplit ctermbg=NONE guibg=NONE
6
  • I beat you to this conclusion by about a minute, but thanks anyway. I'm not sure why I ever assumed otherwise. I guess I was under the impression that it was doing some sort of Unicode character combining magic to overlay the separator in the edge of the character space, but I realize now that I think about it consciously how ridiculous that would be.
    – Caleb
    Apr 15, 2015 at 12:31
  • 1
    Turns out what I needed in my case was hi VertSplit cterm=NONE because it's reverse as a default.
    – Lloeki
    Feb 10, 2016 at 10:57
  • By any chance do you know how to change tmux separators from '│' to, say, '/' ? @romainl
    – 3N4N
    May 1, 2018 at 4:04
  • @EnanAjmain IIRC I found the tmux separator in its source code. I don't think there's an option for that but I'm far from a tmux expert so you should check the manual.
    – romainl
    May 1, 2018 at 9:56
  • @romainl I think you're right. Anything major I was able to change of tmux, I had to hack the source code.
    – 3N4N
    May 1, 2018 at 13:14
6

Even in my own screen-shot, tmux is not using any magic, the split is still a single character wide column. The less obtrusive visual effect is the use of a Unicode box drawing character that is less clunky than vim's ASCII default, and the lack of a highlight background color.

Very nearly the same effect is possible in vim by adding something like the following lines to the rc file:

" Set split separator to Unicode box drawing character
set encoding=utf8
set fillchars=vert:│

" Override color scheme to make split the same color as tmux's default
autocmd ColorScheme * highlight VertSplit cterm=NONE ctermfg=Green ctermbg=NONE

The use of autocmd guarantees that the highlight over-ride stays in effect if you switch color schemes. You may or may not want this behavior as some color scheme have sensible values for this color group.

Also note that cterm=NONE is necessary to over-ride some color schemes that set this value to reverse, ergo messing with whatever fg/bg values you try to use.

5

No, this cannot be done in Vim, and would probably be very hard to implement in GVIM.

Vim sticks to the cell-based addressing used in the terminal; within a buffer, this is crucial for consistent vertical navigation with j / k. This addressing by cell-based x and y coordinates is so ingrained in Vim's implementation, I guess it's very hard to overcome.

Also note :help design-not:

  • Vim is not a fancy GUI editor that tries to look nice at the cost of being less consistent over all platforms.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.