zsh - fix issue in emacs tramp mode
[dotfiles.git] / tmux.conf
1 #set -g prefix ^O
2 #unbind ^b
3 #bind o send-prefix
4 unbind-key C-b
5 set -g prefix 'C-\'
6 bind-key 'C-\' send-prefix
7
8 set -g  status-fg  white
9 #set -g         status-bg  blue
10 set -g  status-bg black 
11 set-window-option -g  window-status-current-bg red
12 #set-option -g  status-right "#[fg=green]#T  #[fg=yellow,bold]#(date '+%Y-%m-%d %I:%M%P %a') "
13 #set-option -g  status-right "#[fg=green]#(whoami)  #[fg=yellow,bold]#(date '+%Y-%m-%d') #[fg=red,bold]#(date '+%I:%M') #[fg=yellow,bold]#(date '+%p %a') "
14 set-option -g  status-right "[#[fg=green]#(hostname)#[fg=white]]  #[fg=yellow]#(date '+%Y-%m-%d') #[fg=red]#(date '+%I:%M') #[fg=yellow]#(date '+%p %a') "
15
16 ## automatic change the window title 
17 #set-option -g  set-titles      on
18 #set-option -g  set-titles-string       '#T'
19 #set-option -g  set-titles-string       "#(date '+%I:%M %P %a')"
20 #set-window-option -g   automatic-rename        on
21 set-option -g allow-rename off
22
23
24 #http://unix.stackexchange.com/questions/12032/create-new-window-with-current-directory-in-tmux
25 bind-key -n  "M-t"      new-window #-c '#{pane_current_path}'
26 bind-key -n  "M-n"      next-window
27 bind-key -n  "M-p"      previous-window
28 bind-key -n  "M-Space"  last-window
29
30
31 bind-key -n  "M-`"      select-window -t:0
32 bind-key -n  "M-1"      select-window -t:1
33 bind-key -n  "M-2"      select-window -t:2
34 bind-key -n  "M-3"      select-window -t:3
35 bind-key -n  "M-4"      select-window -t:4
36 bind-key -n  "M-5"      select-window -t:5
37 bind-key -n  "M-6"      select-window -t:6
38 bind-key -n  "M-7"      select-window -t:7
39 bind-key -n  "M-8"      select-window -t:8
40 bind-key -n  "M-9"      select-window -t:9
41
42 #bind-key -n  "C-M-h"   split-window -h
43 #bind-key -n  "C-M-v"   split-window -v
44 bind-key -n  "M-v"              split-window -h -c '#{pane_current_path}'
45 bind-key -n  "M-s"              split-window -v -c '#{pane_current_path}'
46
47 ##bind-key   "o"                select-pane -l
48 ##bind-key   "j"                select-pane -D
49 ##bind-key   "k"                select-pane -U
50 ##bind-key   "h"                select-pane -R
51 ##bind-key   "l"                select-pane -L
52
53 bind-key   "C-h"                resize-pane -L 3
54 bind-key   "C-j"                resize-pane -D 3
55 bind-key   "C-k"                resize-pane -U 3
56 bind-key   "C-l"                resize-pane -R 3
57
58 bind-key -n     "M-j"   select-pane     -D
59 bind-key -n     "M-k"   select-pane     -U
60 bind-key -n     "M-l"   select-pane     -R
61 bind-key -n     "M-h"   select-pane     -L
62 #bind-key -n    "M-o"   select-pane     -l
63
64 set-option      -g      mode-keys vi
65
66 ##set-window-option     -g      utf8 on
67
68 bind-key -n "M-i" copy-mode 
69
70
71 # refer http://askubuntu.com/questions/350718/problem-regarding-tmux-copy-mode
72 # $ tmux list-keys -t vi-copy
73 bind-key -t vi-copy "v" begin-selection
74 bind-key -t vi-copy "Space" page-down
75 bind-key -t vi-copy "BSpace" page-up
76 bind-key -t vi-copy "y" copy-selection  
77 bind-key -t vi-copy "K" halfpage-up
78 bind-key -t vi-copy "J" halfpage-down
79 #http://unix.stackexchange.com/questions/15715/getting-tmux-to-copy-a-buffer-to-the-clipboard
80 bind -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
81 ### mouse enable
82 # Reload tmux config
83 #bind r source-file ~/.tmux.conf
84 bind r source-file ~/.tmux.conf \; display "Reloaded!"
85 #set-option     -g      mouse-select-window  on
86 #set-option     -g      mouse-select-pane       on
87 #set-option     -g      mouse-resize-pane       on
88 #set-option     -g      mouse-utf8      on
89
90 #set-window-option      -g      mode-mouse      on
91
92 #set -g default-terminal "screen-256color"
93
94 ## macvim starting from tmux does't have "+ register, cannot using command+v to paste
95 # https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/blob/master/Usage.md
96 # http://stackoverflow.com/questions/16618992/cant-paste-into-macvim
97 # set-option -g default-command 'reattach-to-user-namespace -l "$SHELL"'
98 set-option -g default-command 'command -v reattach-to-user-namespace >/dev/null && exec reattach-to-user-namespace -l "$SHELL" || exec "$SHELL"'
99
100
101
102 #set-option -g pane-border-fg colour235 #base02
103 #    set-option -g pane-active-border-fg colour240 #base01
104 #set -g status-justify centre
105 #setw -g monitor-activity on
106 #    set -g visual-activity on
107
108
109 #       set-window-option -g window-status-fg brightblue #base0
110 #    set-window-option -g window-status-bg colour236 
111 #    set-window-option -g window-status-attr dim
112
113 #    set-window-option -g window-status-current-fg brightred #orange
114 #    set-window-option -g window-status-current-bg colour236 
115 #    set-window-option -g window-status-current-attr bright
116
117 set-option -g base-index 1
118 setw -g pane-base-index 1
119 set-option -sg escape-time 0
120
121 #http://www.tylercipriani.com/2013/09/12/important-lines-in-my-tmux.html
122 #bind-key -n "M-\\" resize-pane -Z #\; display-message "Zoom zoom zoom"
123 bind-key -n "M-o" resize-pane -Z #\; display-message "Zoom zoom zoom"
124
125 set -g renumber-windows on
126 set-option -g history-limit 10000