aboutsummaryrefslogtreecommitdiff
path: root/vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim')
-rw-r--r--vim/.vimrc23
1 files changed, 23 insertions, 0 deletions
diff --git a/vim/.vimrc b/vim/.vimrc
index 72f0dd6..b373cf8 100644
--- a/vim/.vimrc
+++ b/vim/.vimrc
@@ -87,6 +87,29 @@ highlight SpellLocal cterm=underline,bold ctermfg=black ctermbg=blue
highlight SpellRare cterm=underline,bold ctermfg=black ctermbg=white
highlight ColorColumn ctermfg=black ctermbg=yellow
+" The terminal background (set in .Xresources) is the background for that part
+" of the terminal where characters can be placed. The padding at the bottom
+" and right side are the line border (color 708 in .Xresources). This is not
+" colored by Vim by default. When the color scheme is changed, we check the
+" current background color and update the line border of the terminal.
+function! s:set_terminal_line_border()
+ let bg=synIDattr(synIDtrans(hlID('Normal')), 'bg', 'cterm')
+ if bg == '255'
+ silent execute ':!echo -e "\033]708;\#eeeeee\007"'
+ else
+ if bg != '234'
+ echohl WarningMsg
+ echo 'Vim background was set to '.bg.', which is unknown; resetting terminal lineBorder to default...'
+ echohl None
+ call getchar()
+ endif
+ silent execute ':!echo -e "\033]708;\#1c1c1c\007"'
+ endif
+endfunction
+autocmd ColorScheme * call s:set_terminal_line_border()
+" When we leave vim we restore the value set also in .Xresources
+autocmd VimLeave * silent execute ':!echo -e "\033]708;\#002b36\007"'
+
let network = system("iwconfig wlp2s0 | grep ESSID | cut -d'\"' -f2")
let network = substitute(network, '\n', '', '')
if index(["WiFi in de trein", "Syntus-Utrecht"], network) >= 0