-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
110 lines (92 loc) · 3.85 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
set-option -g prefix C-a
unbind C-b
bind C-a send-prefix
# Mouse support
set -g mouse on
# Pane splitting and movement
bind _ split-window -h
bind - split-window -v
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind Tab last-window
# Resizing panes
bind -r C-h resize-pane -L
bind -r C-j resize-pane -D
bind -r C-k resize-pane -U
bind -r C-l resize-pane -R
# Status bar
set -g status-style fg=default,bg=default
set-option -g status-left "Session: #S "
set-option -g status-right "SONG: #{actual_song} | TIME: #(date +'%H:%M')"
set-option -g status-right-length 100
set-option -g status-left-length 50
# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'jaclu/tmux-menus'
set -g @plugin 'alexchaichan/tmux-spotify-tui'
# Open lazygit in a floating pane with Alt+F
# TODO: fix.
# bind-key -n M-f display-popup -E -w 100 -h 30 -b "blue" "lazygit"
# Background stuff yeayea
set -g default-terminal "tmux-256color"
set-option -ga terminal-overrides ",*:Tc"
set -g pane-border-style fg=default
set -g pane-active-border-style fg=default
set-option -g window-style 'bg=default'
set-option -g window-active-style 'bg=default'
# vimmmmmmmmmm
set-option -g mode-keys vi
# Сору, Расте
bind-key Enter copy-mode
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi C-v send -X rectangle-toggle
bind -T copy-mode-vi y send -X copy-selection-and-cancel
bind -T copy-mode-vi Escape send -X cancel
bind -T copy-mode-vi H send -X start-of-line
bind -T copy-mode-vi L send -X end-of-line
# copy to X11 clipboard
if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | xsel -i -b"'
if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"'
# copy to Wayland clipboard
if -b '[ "$XDG_SESSION_TYPE" = "wayland" ] && command -v wl-copy > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | wl-copy"'
# copy to macOS clipboard
if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | pbcopy"'
# copy to Windows clipboard
if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | clip.exe"'
if -b '[ -c /dev/clipboard ]' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - > /dev/clipboard"'
# Paste Shit
bind b list-buffers # list paste buffers
bind p paste-buffer -p # paste from the top paste buffer
bind P choose-buffer # choose which buffer to paste from
# This is for panes to start from 1
set-option -g pane-base-index 1
set-option -g base-index 1
# SPOTIFY
bind-key -n F7 run-shell "spt playback --previous >/dev/null 2>&1"
bind-key -n F8 run-shell "spt playback --toggle >/dev/null 2>&1"
bind-key -n F9 run-shell "spt playback --next >/dev/null 2>&1"
# THIS SHOULD BE AT THE BOTTOM
run '~/.tmux/plugins/tpm/tpm'
# LAZYGIT BROTHA
# Function to check if current directory is a Git repository and create lazygit window
bind -n C-g run-shell '
if git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
# Check if lazygit window exists
if tmux list-windows | grep -q "lazygit"; then
# If lazygit window exists, toggle back to the previous window
if [ "$(tmux display-message -p "#W")" = "lazygit" ]; then
tmux last-window
else
tmux select-window -t lazygit
fi
else
# If lazygit window does not exist, create it
tmux new-window -n lazygit "lazygit"
fi
else
tmux display-message "Not a Git repository"
fi'