@@ -168,6 +168,8 @@ null type aunpack && alias aunp=aunpack | |||||
null type lv && alias lv="lv|less" | null type lv && alias lv="lv|less" | ||||
isdarwin && alias updatedb="LC_ALL=C updatedb" | isdarwin && alias updatedb="LC_ALL=C updatedb" | ||||
# do not use locate installed by macports | |||||
isdarwin && test -x /usr/bin/locate && alias locate="/usr/bin/locate" | |||||
# pad | # pad | ||||
alias pad=notepad | alias pad=notepad | ||||
@@ -669,7 +671,7 @@ __my_ps1_script(){ | |||||
} | } | ||||
__my_ps1_scale(){ | __my_ps1_scale(){ | ||||
local last=$? | local last=$? | ||||
echo "[LC:${LINES}x${COLUMNS}]" | |||||
printf "${LINES}x${COLUMNS}" | |||||
return $last | return $last | ||||
} | } | ||||
__my_ps1_tmux(){ | __my_ps1_tmux(){ | ||||
@@ -734,9 +736,17 @@ then | |||||
__my_c5="\[\e[30;47m\]" # color for SCR | __my_c5="\[\e[30;47m\]" # color for SCR | ||||
__my_cdef="\[\e[0m\]" | __my_cdef="\[\e[0m\]" | ||||
fi | fi | ||||
export _LAST_STATUS=$? | |||||
__my_export_last_status(){ | |||||
export _LAST_STATUS=$? | |||||
echo $_LAST_STATUS | |||||
return $_LAST_STATUS | |||||
} | |||||
_PS1="\ | _PS1="\ | ||||
${__my_c4}:: ${__my_cdef}[${__my_c2}\u@\H${__my_cdef}:${__my_c1}\w/${__my_cdef}]\$(__my_ps1_scale)\$(__my_ps1_git)\$(__my_ps1_bttry)\$(__my_ps1_ipaddr)\$(__my_ps1_moc)\n\ | |||||
${__my_c4}:: ${__my_cdef}l${SHLVL}n\#j\js\$? \D{%T} $(__my_ps1_script)\$ " | |||||
${__my_c4}:: ${__my_cdef}[${__my_c2}\u@\H${__my_cdef}:${__my_c1}\w/${__my_cdef}]\$(__my_ps1_git)\$(__my_ps1_bttry)\$(__my_ps1_ipaddr)\$(__my_ps1_moc)\n\ | |||||
${__my_c4}:: ${__my_cdef}l${SHLVL}n\#j\js\$? $(__my_ps1_scale) \D{%T} $(__my_ps1_script)\$ " | |||||
PS1=$_PS1 | PS1=$_PS1 | ||||
__my_set_title(){ | __my_set_title(){ | ||||
@@ -793,3 +803,5 @@ invader(){ | |||||
EOF | EOF | ||||
} | } | ||||
#/etc/lsb-release | #/etc/lsb-release | ||||
echo .dotfiles/bashrc processed. |
@@ -2,6 +2,9 @@ | |||||
# ~/.dotfiles/profile | # ~/.dotfiles/profile | ||||
test -n "$DOTFILES_PROFILE" && return | |||||
export DOTFILES_PROFILE=t | |||||
# export PS1="\$ " | # export PS1="\$ " | ||||
export LC_TIME=C | export LC_TIME=C | ||||
export TERMCAP="${TERMCAP}:vb=" | export TERMCAP="${TERMCAP}:vb=" | ||||
@@ -42,3 +45,5 @@ fi | |||||
export TMP="${TMP}${USER}-tmp" | export TMP="${TMP}${USER}-tmp" | ||||
export TEMP="$TMP" | export TEMP="$TMP" | ||||
mkdir -p "$TMP" | mkdir -p "$TMP" | ||||
echo .dotfiles/profile processed. |
@@ -0,0 +1,88 @@ | |||||
#!/usr/bin/env perl | |||||
use strict; | |||||
use warnings; | |||||
my $tmux_command = "tmux"; | |||||
my @tmux_set_command = ("set", "-g"); | |||||
my @tmux_setw_command = ("setw", "-g"); | |||||
my %color_prefs = ( | |||||
"arch-aspireone" => "blue,white", | |||||
"darwin-mba.local" => "yellow,black", | |||||
"newkiwi" => "magenta,white" | |||||
); | |||||
my $color_def = "green,white"; | |||||
sub tmux { | |||||
my @command = ($tmux_command, ); | |||||
push(@command, @_); | |||||
# print "@command, \n"; | |||||
system(@command) == 0 | |||||
or die "system @command failed: $?"; | |||||
} | |||||
sub set { | |||||
my @command = @tmux_set_command; | |||||
push(@command, @_); | |||||
tmux(@command); | |||||
} | |||||
sub setw { | |||||
my @command = @tmux_setw_command; | |||||
push(@command, @_); | |||||
tmux(@command); | |||||
} | |||||
sub set_key { | |||||
tmux("unbind", "C-b"); | |||||
set("prefix", "C-z"); | |||||
tmux("bind-key", "C-z", "send-prefix"); | |||||
tmux("bind-key", "c", "command-prompt", "new-window '%%'"); | |||||
} | |||||
sub set_prefs { | |||||
setw("mode-keys", "vi"); | |||||
set("default-command", "/bin/bash"); | |||||
set("default-path", $ENV{"HOME"}); | |||||
set("set-titles", "on"); | |||||
set("display-panes-time", "5000"); | |||||
} | |||||
sub set_status_line { | |||||
my $user = $ENV{"USER"}; | |||||
my $hostname = $ENV{"HOSTNAME"}; | |||||
my $tmux_v = `tmux -V`; | |||||
$tmux_v =~ s/\n//; | |||||
set("status-right", "${user}\@${hostname} | ${tmux_v} "); | |||||
} | |||||
sub set_colors { | |||||
my $hostname = $ENV{"HOSTNAME"}; | |||||
my $color = $color_prefs{$hostname}; | |||||
if (! $color) { | |||||
$color = $color_def; | |||||
} | |||||
my ($bg, $fg) = split(/,/, $color); | |||||
set("status-bg", $bg); | |||||
set("status-fg", $fg); | |||||
set("mode-bg", $bg); | |||||
set("mode-fg", $fg); | |||||
set("pane-active-border-fg", $bg); | |||||
set("message-bg", "white"); | |||||
set("message-fg", "black"); | |||||
setw("window-status-current-bg", "white"); | |||||
setw("window-status-current-fg", "black"); | |||||
setw("window-status-current-attr", "bold"); | |||||
} | |||||
sub main { | |||||
set_key(); | |||||
set_prefs(); | |||||
set_status_line(); | |||||
set_colors(); | |||||
} | |||||
main(); |