浏览代码

add tmux.conf.pl use this instead of tmux.conf

pull/1/head
10sr 12 年前
父节点
当前提交
488787b305
共有 3 个文件被更改,包括 95 次插入0 次删除
  1. +2
    -0
      bashrc
  2. +5
    -0
      profile
  3. +88
    -0
      tmux.conf.pl

+ 2
- 0
bashrc 查看文件

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

echo .dotfiles/bashrc processed.

+ 5
- 0
profile 查看文件

@@ -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 查看文件

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

正在加载...
取消
保存