Browse Source

Merge branch 'master' of github.com:10sr/dotfiles

pull/1/head
10sr 11 years ago
parent
commit
3a4a74e55f
3 changed files with 108 additions and 3 deletions
  1. +15
    -3
      bashrc
  2. +5
    -0
      profile
  3. +88
    -0
      tmux.conf.pl

+ 15
- 3
bashrc View File

@@ -168,6 +168,8 @@ null type aunpack && alias aunp=aunpack
null type lv && alias lv="lv|less"

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
alias pad=notepad
@@ -669,7 +671,7 @@ __my_ps1_script(){
}
__my_ps1_scale(){
local last=$?
echo "[LC:${LINES}x${COLUMNS}]"
printf "${LINES}x${COLUMNS}"
return $last
}
__my_ps1_tmux(){
@@ -734,9 +736,17 @@ then
__my_c5="\[\e[30;47m\]" # color for SCR
__my_cdef="\[\e[0m\]"
fi

export _LAST_STATUS=$?
__my_export_last_status(){
export _LAST_STATUS=$?
echo $_LAST_STATUS
return $_LAST_STATUS
}

_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

__my_set_title(){
@@ -793,3 +803,5 @@ invader(){
EOF
}
#/etc/lsb-release

echo .dotfiles/bashrc processed.

+ 5
- 0
profile View File

@@ -2,6 +2,9 @@

# ~/.dotfiles/profile

test -n "$DOTFILES_PROFILE" && return
export DOTFILES_PROFILE=t

# export PS1="\$ "
export LC_TIME=C
export TERMCAP="${TERMCAP}:vb="
@@ -42,3 +45,5 @@ fi
export TMP="${TMP}${USER}-tmp"
export TEMP="$TMP"
mkdir -p "$TMP"

echo .dotfiles/profile processed.

+ 88
- 0
tmux.conf.pl View File

@@ -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();

Loading…
Cancel
Save