-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtmux.bash
executable file
·63 lines (48 loc) · 2.26 KB
/
tmux.bash
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
#!/bin/bash
# Define the path to the tmux.conf file and the tmux plugin manager directory
TMUX_CONF="$HOME/.tmux.conf"
TPM_DIR="$HOME/.tmux/plugins/tpm"
# Create or overwrite the tmux.conf file with the specified configuration
cat > "$TMUX_CONF" << 'EOF'
# -----------------------------------------------------------------------------
# Tmux Basic Configuration
# -----------------------------------------------------------------------------
set -g mouse on # Enable mouse support
setenv -g TMUX_PLUGIN_MANAGER_PATH '~/.tmux/plugins'
# -----------------------------------------------------------------------------
# Using Plugins - via tpm (tmux plugin manager)
# -----------------------------------------------------------------------------
# Recommended plugins (Please read the usage guide in each plugin's repository)
set -g @plugin 'seebi/tmux-colors-solarized'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
# Plugin that allows tmux to copy text to the system clipboard.
set -g @plugin 'tmux-plugins/tpm'
# tmux-resurrect
set -g @resurrect-dir '~/.tmux/resurrect'
# tmux-continuum: Automatically save and restore tmux sessions, usually used in conjunction with tmux-resurrect.
set -g @plugin 'tmux-plugins/tmux-continuum'
# tmux-prefix-highlight
set -g status-right '#{prefix_highlight} #H | %a %Y-%m-%d %H:%M'
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_copy_mode_attr 'fg=white,bg=blue'
# Initialize TPM (tmux Plugin Manager) at the end of the config file
run '~/.tmux/plugins/tpm/tpm'
EOF
# Clone the tmux Plugin Manager (tpm) if it's not already installed
if [ ! -d "$TPM_DIR" ]; then
git clone https://github.com/tmux-plugins/tpm "$TPM_DIR"
fi
# Install the plugins using tpm
bash "$TPM_DIR/bin/install_plugins"
# If tmux is running, source the tmux.conf file to apply changes
if tmux info &> /dev/null; then
tmux source-file "$TMUX_CONF"
echo "tmux configuration reloaded."
else
echo "tmux is not currently running. Configuration will be applied at next tmux start."
fi
echo "tmux configuration has been created and plugins have been installed."