From 065ae919ee3adf572dcac8ea65ee33b36812cb71 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Sun, 7 Feb 2016 14:43:04 +0100 Subject: [PATCH] [vim] inherit the shell's background (dark/light) --- bash_profile | 4 ++-- vimrc | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bash_profile b/bash_profile index 67b279f..3a35e30 100644 --- a/bash_profile +++ b/bash_profile @@ -73,7 +73,7 @@ change_palette() ( # - prompt string # - `ls` command output colors do_solarize_shell() { - [ -z "$BACKGROUND" ] && BACKGROUND="dark" + [ -z "$BACKGROUND" ] && export BACKGROUND="dark" if [ "$TERM_PROGRAM" = "Apple_Terminal" ]; then echo "tell application \"Terminal\" to set current settings of selected tab of front window to settings set \"solarized-$BACKGROUND\"" | osascript @@ -113,7 +113,7 @@ do_solarize_shell() { # Change the ANSI color palette # iTerm2: Pnrrggbb (http://iterm2.com/documentation-escape-codes.html) # other terminals: 4;n;#rrggbb - # Pn or 4;n;# n rrggbb ANSI name + # Pn or 4;n;# n rrggbb ANSI name change_palette $(printf $selector 0) $base02 # 0;30 black change_palette $(printf $selector 1) $red # 0;31 red change_palette $(printf $selector 2) $green # 0;32 green diff --git a/vimrc b/vimrc index ef39a0b..c081200 100644 --- a/vimrc +++ b/vimrc @@ -110,6 +110,11 @@ let mapleader = "," " }}} " vim-colors-solarized {{{ + if $BACKGROUND == 'light' " use background from bash if available + set background=light + else + set background=dark " default is dark + endif silent! colorscheme solarized " }}}