aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/.Xresources3
-rw-r--r--vim/.vimrc23
2 files changed, 26 insertions, 0 deletions
diff --git a/system/.Xresources b/system/.Xresources
index ec9da54..15169ce 100644
--- a/system/.Xresources
+++ b/system/.Xresources
@@ -49,6 +49,9 @@ URxvt.color12: S_base0
URxvt.color13: S_violet
URxvt.color14: S_base1
URxvt.color15: S_base3
+! 708 is the line border; used for the bottom and right borders of the terminal
+! where no characters fit.
+URxvt.color708: S_base03
URxvt.intensityStyles: false
URxvt.urgentOnBell: 1
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