mirror of
https://github.com/ViViDboarder/shoestrap.git
synced 2024-12-24 12:47:43 +00:00
Dynamically detect session theme and set vim theme
This commit is contained in:
parent
3b93b32dfe
commit
ba2afb7df0
55
assets/default/bin/get_vim_colorscheme.sh
Executable file
55
assets/default/bin/get_vim_colorscheme.sh
Executable file
@ -0,0 +1,55 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Gets the current settings for the given terminal window
|
||||
function get_terminal_settings {
|
||||
case "$TERM_PROGRAM" in
|
||||
Apple_Terminal)
|
||||
osascript <<EOD
|
||||
set current_tty to "$(tty)"
|
||||
tell application "Terminal"
|
||||
repeat with win in windows
|
||||
repeat with the_tab in tabs of win
|
||||
set tab_settings to the current settings of the_tab
|
||||
if current_tty is equal to the tty of the_tab then
|
||||
return the name of tab_settings
|
||||
end if
|
||||
end repeat
|
||||
end repeat
|
||||
end tell
|
||||
EOD
|
||||
;;
|
||||
iTerm.app)
|
||||
echo "$ITERM_PROFILE"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown terminal $TERM_PROGRAM"
|
||||
exit 1
|
||||
esac
|
||||
}
|
||||
|
||||
# Mappings of Terminal themes to color schemes
|
||||
function get_vim_colorscheme {
|
||||
local term_theme="$1"
|
||||
case "$term_theme" in
|
||||
"Hotkey Window Wombat")
|
||||
echo "wombat256mod"
|
||||
;;
|
||||
Wombat*)
|
||||
echo "wombat256mod"
|
||||
;;
|
||||
Solarized*)
|
||||
echo "solarized"
|
||||
;;
|
||||
"Yosemite Light"*)
|
||||
echo "morning"
|
||||
;;
|
||||
"Yosemite Dark"*)
|
||||
echo "vividchalk"
|
||||
;;
|
||||
*)
|
||||
echo "default"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_vim_colorscheme "$(get_terminal_settings)"
|
@ -70,7 +70,7 @@ export CLICOLOR=1
|
||||
export LSCOLORS=ExFxCxDxBxegedabagacad
|
||||
|
||||
# Vim colors
|
||||
[ -z "$VIM_COLOR" ] && export VIM_COLOR='wombat256mod'
|
||||
[ -n "$VIM_COLOR" ] || export VIM_COLOR=$(eval $HOME/bin/get_vim_colorscheme.sh) || export VIM_COLOR='wombat256mod'
|
||||
|
||||
# Set file as having been loaded to avoid looping
|
||||
#IS_BASH_PROFILE_LOADED=true
|
||||
|
@ -6,4 +6,4 @@ set -gx FZF_DEFAULT_COMMAND 'ag -g ""'
|
||||
set -gx FZF_CTRL_T_COMMAND "$FZF_DEFAULT_COMMAND \$dir"
|
||||
|
||||
# Vim Colors so that they can be set by env
|
||||
set -q VIM_COLOR; or set -gx VIM_COLOR wombat256mod
|
||||
set -q VIM_COLOR; set -gx VIM_COLOR (eval $HOME/bin/get_vim_colorscheme.sh); or set -gx VIM_COLOR wombat256mod
|
||||
|
Loading…
Reference in New Issue
Block a user