-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
121 lines (95 loc) · 2.79 KB
/
install.sh
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
#!/usr/bin/env bash
# Colors for pretty output
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Print with color
print_status() {
echo -e "${BLUE}==>${NC} $1"
}
print_success() {
echo -e "${GREEN}✓${NC} $1"
}
print_error() {
echo -e "${RED}✗${NC} $1"
}
# Check for required commands
check_requirements() {
local missing_reqs=0
if ! command -v tmux >/dev/null 2>&1; then
print_error "tmux is not installed"
missing_reqs=1
fi
if ! command -v zsh >/dev/null 2>&1; then
print_error "zsh is not installed"
missing_reqs=1
fi
if [ $missing_reqs -eq 1 ]; then
exit 1
fi
}
# Install tmux configuration
install_tmux_config() {
print_status "Installing tmux configuration..."
# Create necessary directories
mkdir -p ~/.tmux/themes
# Install theme
cp themes/exmachina.tmux.conf ~/.tmux/themes/
cp config/.tmux.conf ~/.tmux.conf
print_success "Tmux configuration installed"
}
# Install ZSH plugins
install_zsh_plugins() {
print_status "Installing ZSH plugins..."
# Determine ZSH custom plugins directory
local zsh_custom=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}
mkdir -p "$zsh_custom/plugins/tmux-ex-machina"
# Copy plugin files
cp -r plugins/* "$zsh_custom/plugins/tmux-ex-machina/"
print_success "ZSH plugins installed"
print_status "Add 'tmux-ex-machina' to your plugins array in .zshrc:"
echo "plugins=(... tmux-ex-machina)"
}
# Install Vim plugin
install_vim_plugin() {
print_status "Installing Vim plugin..."
# Install for Vim
if [ -d ~/.vim ]; then
mkdir -p ~/.vim/plugin
cp plugins/pane-title/vim-pane-title.vim ~/.vim/plugin/
print_success "Vim plugin installed"
fi
# Install for Neovim
if [ -d ~/.config/nvim ]; then
mkdir -p ~/.config/nvim/plugin
cp plugins/pane-title/vim-pane-title.vim ~/.config/nvim/plugin/
print_success "Neovim plugin installed"
fi
}
# Backup existing configuration
backup_existing_config() {
print_status "Backing up existing configuration..."
local timestamp=$(date +%Y%m%d_%H%M%S)
if [ -f ~/.tmux.conf ]; then
mv ~/.tmux.conf ~/.tmux.conf.backup.$timestamp
print_success "Backed up ~/.tmux.conf"
fi
}
# Main installation
main() {
print_status "Installing TMux Ex Machina..."
check_requirements
backup_existing_config
install_tmux_config
install_zsh_plugins
install_vim_plugin
print_success "Installation complete!"
echo
print_status "Next steps:"
echo "1. Add 'tmux-ex-machina' to your plugins in .zshrc"
echo "2. Restart your tmux server: tmux kill-server"
echo "3. Start a new tmux session"
}
# Run the installer
main