-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf
127 lines (95 loc) · 4.06 KB
/
tmux.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
set-environment -g POWERLINE_CONFIG_COMMAND /usr/local/bin/powerline-config
set -g default-terminal "screen-256color"
# remap prefix to Control + a
set -g prefix C-Space
unbind C-b
bind C-Space send-prefix
set -g focus-events on
# set-window-option -g mode-mouse on
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# toggle status bar
unbind t
bind t set-option -g status
# Copying {{{
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
# bind-key -Tcopy-mode-vi v begin-selection
# bind-key -Tcopy-mode-vi y copy-pipe "reattach-to-user-namespace pbcopy"
# bind-key -Tcopy-mode-vi 'y' send -X copy-pipe "reattach-to-user-namespace pbcopy"
# bind-key -Tcopy-mode-vi 'y' send -X copy-selection "reattach-to-user-namespace pbcopy"
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel pbcopy
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
# bind-key -Tcopy-mode-vi 'y' send -X copy-selection
# Update default binding of `Enter` to also use copy-pipe
# unbind -T copy-mode-vi Enter
# bind-key -T copy-mode-vi Enter copy-pipe "reattach-to-user-namespace pbcopy"
set-option -g default-command "reattach-to-user-namespace -l zsh"
# set -g default-shell $SHELL
# set -g default-command "reattach-to-user-namespace -l ${SHELL}"
# }}}
# Smart pane switching with awareness of vim splits
# https://github.com/christoomey/vim-tmux-navigator#tmux
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# Smart splits
# bind -n C-w-v run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-w v) || tmux split-window -h -c '#{pane_current_path}'"
# bind -n C-w-s run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-w s) || tmux split-window -v -c '#{pane_current_path}'"
# Always open splits and windows in CWD
bind '"' split-window -v -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# Resize panes
bind J resize-pane -D 5
bind K resize-pane -U 5
bind -n S-Left resize-pane -L 5
bind -n S-Right resize-pane -R 5
# clear screen
bind C-l send-keys 'C-l'
# highlight status bar on activity
set -g visual-activity on
# change foreground-background for the current window
setw -g window-status-current-attr reverse
setw -g monitor-activity on
setw -g mode-keys vi
# Titles {{{
set-option -g set-titles on
# set-option -g set-titles-string '#W(#P) - #T'
set -g set-titles-string "tmux:#I [ #W ]"
set-window-option -g automatic-rename off
set -g window-status-format '#I:#(pwd="#{pane_current_path}"; echo ${pwd####*/})#F'
set -g window-status-current-format '#I:#(pwd="#{pane_current_path}"; echo ${pwd####*/})#F'
# }}}
# Options {{{
set-option -g base-index 0
#set-option -g default-command "exec /usr/bin/login -pf superflo"
# set-option -g mouse-select-pane on
set-option -g status-keys vi
set-option -g history-limit 500
set-option -s escape-time 0
# enable utf-8 on status bar
set -g status on
# set -g status-utf8 on
# Set status bar
set -g status-bg black
set -g status-fg white
# set -g status-left '#[fg=green]#'
# set-window-option -g window-status-current-bg red
# Set window notifications
setw -g monitor-activity on
set -g visual-activity on
# }}}
# Load Tmuxline
source ~/.tmuxline.conf
bind C-j split-window -v "tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\" | fzf --reverse | xargs tmux switch-client -t"
# Stop preventing visual block mode in vim - not even sure where this comes from
unbind -n C-v
unbind -n C-s