this repo has no description
1# open a non-login shell, to avoid sourcing /etc/profile again
2set -g default-command "${SHELL}"
3
4# set prefix to C-s
5unbind-key C-b
6set -g prefix 'C-s'
7bind-key 'C-s' send-prefix
8
9# allow scrollback in Terminal
10set -g terminal-overrides 'xterm*:smcup@:rmcup@'
11
12# tell tmux that terminal has 256 colors
13set -g default-terminal "screen-256color"
14
15# keep 10k lines of scrollback
16set -g history-limit 100000
17
18# refresh tmux config with prefix-R
19bind R source-file ~/.tmux.conf \; display-message "Config reloaded..."
20
21# window titles
22set -g set-titles on
23set-window-option -g automatic-rename on
24
25# disable escape sequence delay
26set -sg escape-time 0
27
28# start window numbering at 1
29set -g base-index 1
30set -g pane-base-index 1
31
32# resize whenever possible
33setw -g aggressive-resize on
34
35# new windows open in $CWD
36bind c new-window -c '#{pane_current_path}'
37
38# act like vim
39setw -g mode-keys vi
40bind-key | split-window -h
41bind-key - split-window
42bind h select-pane -L
43bind j select-pane -D
44bind k select-pane -U
45bind l select-pane -R
46bind-key -r C-h select-window -t :-
47bind-key -r C-l select-window -t :+
48
49# enter scrollback mode and scroll up on shift-pageup
50bind-key -n M-PPage copy-mode -u
51
52set-window-option -g xterm-keys on # to make ctrl-arrow, etc. work
53
54# status line inspired by wemux from https://gist.github.com/2305333
55set -g status-left-length 32
56set -g status-right-length 150
57set -g status-style fg=white,bg=colour234
58set -g window-status-activity-style bold
59set -g pane-border-style fg=colour245
60set -g pane-active-border-style fg=colour39
61set -g message-style fg=colour16,bg=colour221,bold
62set -g status-left "#[fg=colour235,bg=colour252,bold] #(scutil --get ComputerName) ⧉ #S #[fg=colour252,bg=colour235,nobold]"
63set -g window-status-format "#[fg=white,bg=colour234] #I #W"
64set -g window-status-current-format "#[fg=colour234,bg=colour39]#[fg=colour18,bg=colour39,noreverse,bold] #I #W #[fg=colour39,bg=colour234,nobold]"
65set -g status-right " #[fg=colour238,bg=colour234]#[fg=white,bg=colour238,bold,noreverse] #{b:socket_path} "
66
67# Smart pane switching with awareness of Vim splits.
68# See: https://github.com/christoomey/vim-tmux-navigator
69# is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
70# | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
71# bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
72# bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
73# bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
74# bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
75# bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
76
77# fix clipboard copying
78bind-key -T copy-mode-vi v send-keys -X begin-selection
79bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
80unbind-key -T copy-mode-vi Enter ; bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
81unbind-key -T copy-mode-vi C-v ; bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
82
83# bind-key -T edit-mode-vi Up send-keys -X history-up
84# bind-key -T edit-mode-vi Down send-keys -X history-down
85
86set -g mouse on
87
88bind -n S-M-Up {
89 copy-mode
90 send -X clear-selection
91 send -X start-of-line
92 send -X start-of-line
93 send -X cursor-up
94 send -X start-of-line
95 send -X start-of-line
96
97 if -F "#{m:*❯ ?*,#{copy_cursor_line}}" {
98 send -X search-forward-text "❯ "
99 send -X stop-selection
100 send -X -N 2 cursor-right
101 send -X begin-selection
102 send -X end-of-line
103 send -X end-of-line
104 if "#{m:*❯ ?*,#{copy_cursor_line}}" {
105 send -X cursor-left
106 }
107 } {
108 send -X end-of-line
109 send -X end-of-line
110 send -X begin-selection
111 send -X search-backward-text "❯ "
112 send -X end-of-line
113 send -X end-of-line
114 send -X cursor-right
115 send -X stop-selection
116 }
117}