I am borrowing this screenshot from another question:

enter image description here

The terminal background seems to leak through into vim left of the dividing border. This is most noticeable near Top.

Can anyone tell me why/what this is and if I can get rid of it so the divide is clean?

  • Going to guess here that what you're seeing is a side effect of the fact that characters in a terminal emulator must take up a full block. That block has a single foreground and a single background color. Because the line is drawn with characters within the terminal emulator you're going to have this "leak". – Randy Morris Oct 12 '12 at 17:12
  • Does that block appear outside of tmux? My educated guess is that Vim simply doesn't paint that block, because to do so (at least in certain terminals) would cause the cursor to wrap around, thus scrolling the whole screen/pane up one line. – echristopherson Oct 12 '12 at 21:21

The character used by tmux for drawing its pane border is or U+2502. It is a 1px or 2px wide line in the middle of the cell. The rest of the cell is empty and you are just seeing your terminal's background color on each side of the line.

I see three ways to "fix" this.

  • Use the same background color in Vim and your terminal emulator.

  • Tell tmux to draw borders with the same color for the background and the foreground.

  • Tell tmux to use some other character like █ to draw the borders.

The two last solutions will make your borders noticeably fatter and the last one may introduce display glitches depending on the font you use.

I personnally have my Vim background and my terminal background set to the same color.

(thanks ZyX)

  • 1
    One correction: tmux does not use bar for drawing border, it is using U+2502 “BOX DRAWING LIGHT VERTICAL” character instead which looks much better (bar symbol does not occupy full height (in terminus and almost all other fonts I tried), and even contains a space in the middle in some other fonts). – ZyX Oct 12 '12 at 20:10
  • 6
    By the way, what is the option for changing border character? I found a number of them for changing border colors, but not for changing border character. – ZyX Oct 12 '12 at 20:34
  • I really don't think there's a way to replace the border character - not without tweaking the source at least. – dev Feb 14 '17 at 11:29

Following the third @romainl advice you can use U+258C or U+2590 characters (LEFT and RIGHT HALF BLOCK characters respectively) and tell tmux to set (in case of LEFT and vim being on the left) foreground color to vim background and background color to shell background.

This option is to be set from the vimrc when $TMUX variable exists and is non-empty (it is set by tmux inside child processes) and reset on the VimLeave event. This assumes that you always open vim in left pane only. With some adjustments you can detect what pane you are in (tmux list-panes, one with (active) at the end) whether there is vim in adjacent window (by checking the border key) and adjust tmux settings accordingly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy