From 787a747f6f374434890e73430fae9899d76c38e5 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Mon, 14 Apr 2014 20:29:32 +0200 Subject: tmux: config and socket in dofiles directory --- bashrc/bin/t | 33 +++++++++++++++++++++++++++---- symlink-mapping | 1 - tmux.conf | 61 --------------------------------------------------------- tmux/tmux.conf | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+), 66 deletions(-) delete mode 100644 tmux.conf create mode 100644 tmux/tmux.conf diff --git a/bashrc/bin/t b/bashrc/bin/t index 019eda9..3919af4 100755 --- a/bashrc/bin/t +++ b/bashrc/bin/t @@ -1,12 +1,37 @@ #!/usr/bin/env bash +real_tmux() { + if [ -f "${HOME}/.dotfiles/tmux/tmux.conf" ]; then + \tmux -f "${HOME}/.dotfiles/tmux/tmux.conf" -S "${HOME}/.dotfiles/tmux/socket" "$@" + else + \tmux "$@" + fi +} + +exec_real_tmux() { + if [ -f "${HOME}/.dotfiles/tmux/tmux.conf" ]; then + exec \tmux -f "${HOME}/.dotfiles/tmux/tmux.conf" -S "${HOME}/.dotfiles/tmux/socket" "$@" + else + exec \tmux "$@" + fi +} + + if [[ "x$1" == x ]] ; then - \tmux list-sessions || + real_tmux list-sessions || { - \tmux new-session -d + real_tmux new-session -d } - exec \tmux attach-session -d + exec_real_tmux attach-session -d +fi + +if [ -z "$2" -a "$1" != "att" -a "$1" != "ls" ]; then + if teal_tmux has-session -t "$1"; then + exec exec_real_tmux attach-session -t "$1" + else + exec exec_real_tmux new-session -s "$1" + fi fi -exec \tmux $@ +exec_real_tmux $@ diff --git a/symlink-mapping b/symlink-mapping index e773e06..801f369 100644 --- a/symlink-mapping +++ b/symlink-mapping @@ -8,4 +8,3 @@ .bash -> bashrc .mplayer -> mplayer .emacs.d -> emacs.d -.tmux.conf -> tmux.conf diff --git a/tmux.conf b/tmux.conf deleted file mode 100644 index 75b71a4..0000000 --- a/tmux.conf +++ /dev/null @@ -1,61 +0,0 @@ -# .tmux.conf - -## if the terminal gets SLOW, turn title-setting off -#set -g set-titles off - -# ctrl-a is just better to type -set -g prefix C-a -unbind C-b - -# send the prefix to client inside window (ala nested sessions) -bind a send-prefix - -# toggle last window like screen -bind C-a last-window - -# ctrl-a left/right (even multiple times) to step through shells -bind -r Right next-window -bind -r Left previous-window -# ctrl-up for scrolling within the 'screen' -# bind -n C-Up copy-mode - -# start numbering sessions at 1, not 0 -set -g base-index 1 -# set hist-limit to 5000 -set -g history-limit 15000 -# turn the repeat-time up (0.5s is a little short) -set -g repeat-time 1000 -# visual bell =) -set -g visual-bell on - -# ctrl+left/right cycles thru windows -bind -n C-right next -bind -n C-left prev - -# listen for activity on all windows -set -g bell-action any - -# choose-session with C-a _ -bind _ choose-session - -# bashrc makes takes care of window titles -setw -g automatic-rename off - -# more colors -set -g default-terminal "screen-256color" - -# display time -set -g display-time 200 - -# pimp the status bar -set -g status-fg white -set -g status-bg black -set -g status-utf8 on -set -g status-left-length 50 -set -g status-left "#[fg=red,bold]$USER#[fg=yellow,bold]@#[fg=green,bold]#H#[fg=colour250]:#S #[fg=white]| #[fg=yellow]#(date +%d.%b.%y) #[fg=white]|" -set -g status-right "#[fg=red,bold](#(cat /proc/loadavg | head -c 14))" - -## and the notification messages -set -g message-bg red -set -g message-fg white -set -g message-attr bold diff --git a/tmux/tmux.conf b/tmux/tmux.conf new file mode 100644 index 0000000..75b71a4 --- /dev/null +++ b/tmux/tmux.conf @@ -0,0 +1,61 @@ +# .tmux.conf + +## if the terminal gets SLOW, turn title-setting off +#set -g set-titles off + +# ctrl-a is just better to type +set -g prefix C-a +unbind C-b + +# send the prefix to client inside window (ala nested sessions) +bind a send-prefix + +# toggle last window like screen +bind C-a last-window + +# ctrl-a left/right (even multiple times) to step through shells +bind -r Right next-window +bind -r Left previous-window +# ctrl-up for scrolling within the 'screen' +# bind -n C-Up copy-mode + +# start numbering sessions at 1, not 0 +set -g base-index 1 +# set hist-limit to 5000 +set -g history-limit 15000 +# turn the repeat-time up (0.5s is a little short) +set -g repeat-time 1000 +# visual bell =) +set -g visual-bell on + +# ctrl+left/right cycles thru windows +bind -n C-right next +bind -n C-left prev + +# listen for activity on all windows +set -g bell-action any + +# choose-session with C-a _ +bind _ choose-session + +# bashrc makes takes care of window titles +setw -g automatic-rename off + +# more colors +set -g default-terminal "screen-256color" + +# display time +set -g display-time 200 + +# pimp the status bar +set -g status-fg white +set -g status-bg black +set -g status-utf8 on +set -g status-left-length 50 +set -g status-left "#[fg=red,bold]$USER#[fg=yellow,bold]@#[fg=green,bold]#H#[fg=colour250]:#S #[fg=white]| #[fg=yellow]#(date +%d.%b.%y) #[fg=white]|" +set -g status-right "#[fg=red,bold](#(cat /proc/loadavg | head -c 14))" + +## and the notification messages +set -g message-bg red +set -g message-fg white +set -g message-attr bold -- cgit v1.2.3