Преглед на файлове

remove tmux.conf.pl, colors and status bar are made by setup.sh

pull/1/head
10sr преди 11 години
родител
ревизия
1ddba92571
променени са 3 файла, в които са добавени 66 реда и са изтрити 101 реда
  1. +40
    -0
      setup.sh
  2. +26
    -0
      tmux.conf
  3. +0
    -101
      tmux.conf.pl

+ 40
- 0
setup.sh Целия файл

@@ -53,6 +53,45 @@ __homevar="$__homevar"
__EOC__
}

#############################
# gen_tmux_conf_local

gen_tmux_conf_local(){
tmux_conf_local="$HOME/.tmux.conf.local"

case "`hostname`" in
arch-aspireone)
tmux_bg_color=blue
tmux_fg_color=white
;;
darwin-mba.local)
tmux_bg_color=cyan
tmux_fg_color=black
;;
newkiwi)
tmux_bg_color=magenta
tmux_fg_color=white
;;
*)
tmux_bg_color=green
tmux_fg_color=black
;;
esac

cat <<__EOC__ >"$tmux_conf_local"
# $tmux_conf_local
# Automatically generated from $0

set -g status-right "${USER}@$(hostname) | $(tmux -V) "

set -g status-bg $tmux_bg_color
set -g status-fg $tmux_fg_color
set -g mode-bg $tmux_bg_color
set -g mode-fg $tmux_fg_color
set -g pane-active-border-fg $tmux_bg_color
__EOC__
}

##############################
# install_scripts

@@ -196,6 +235,7 @@ main(){
mkdirs
install_scripts
git_configs
gen_tmux_conf_local
if $isdarwin
then
darwin_set_defaults


+ 26
- 0
tmux.conf Целия файл

@@ -0,0 +1,26 @@
# tmux.conf

if "test -f $HOME/.tmux.conf.local" "source-file $HOME/.tmux.conf.local" \
"display-message \"$HOME/.tmux.conf.local not found\""

unbind C-b
set -g prefix C-z
bind C-z send-prefix
bind c command-prompt "new-window '%%'"
bind C-r source-file ~/.tmux.conf \; display-message "Reloaded config !!"

set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows on
setw -g mode-keys vi
setw -g mode-mouse off
#set -g default-command /bin/bash

#set -g default-path "$HOME"
set -g set-titles on
set -g display-panes-time 5000

set -g message-bg white
set -g message-fg black
setw -g window-status-current-bg white
setw -g window-status-current-fg black

+ 0
- 101
tmux.conf.pl Целия файл

@@ -1,101 +0,0 @@
#!/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" => "cyan,black",
"newkiwi" => "magenta,white"
);
my $color_def = "green,black";

sub tmux {
my @command = ($tmux_command, );
push(@command, @_);
# print "@command, \n";
system(@command) == 0
or warn "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 {
# this does not workd because `run' do script asyncly
set("base-index", "1");
set("pane-base-index", "1");
set("renumber-windows", "on");
setw("mode-keys", "vi");
set("default-command", "/bin/bash");
set("default-path", $ENV{"HOME"});
set("set-titles", "on");
set("display-panes-time", "5000");
}

sub get_hostname {
my $hostname = $ENV{"HOSTNAME"};
if (! $hostname) {
$hostname = `hostname`;
chomp($hostname)
}
return $hostname;
}

sub set_status_line {
my $user = $ENV{"USER"};
my $hostname = get_hostname();
my $tmux_v = `tmux -V`;
$tmux_v =~ s/\n//;
set("status-right", "${user}\@${hostname} | ${tmux_v} ");
}

sub set_colors {
my $hostname = get_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();

Зареждане…
Отказ
Запис