Skip to content

Commit d57fea0

Browse files
authored
feat: Automate Neovim and tmux setup with improved session handling
1 parent 0499bfb commit d57fea0

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

setup.sh

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,23 @@ else
2222
echo "tmux already installed!"
2323
fi
2424

25+
# Clone Neovim configuration
26+
git clone --depth 1 https://github.com/daliendev/astro-nvim/ "$HOME/.config/nvim"
27+
2528
# Auto start tmux on SSH or xtermjs
2629
cat >>"$HOME/.bashrc" <<'EOF'
27-
if test ! -v TMUX && (test -v SSH_CONNECTION || test "$PPID" == "$(pgrep -f '/ide/xterm/bin/node /ide/xterm/index.cjs' | head -n1)"); then {
28-
if ! tmux has-session 2>/dev/null; then {
29-
tmux new-session -n "editor" -ds "gitpod"
30-
} fi
31-
exec tmux attach
32-
} fi
30+
if test ! -v TMUX && (test -v SSH_CONNECTION || test "$PPID" == "$(pgrep -f '/ide/xterm/bin/node /ide/xterm/index.cjs' | head -n1)"); then
31+
if ! tmux has-session 2>/dev/null; then
32+
# Create a new detached tmux session named "gitpod"
33+
tmux new-session -d -s gitpod -n "editor"
34+
# Send the Neovim command to the session, it will install necessary LSP and plugins
35+
tmux send-keys -t gitpod "nvim --headless '+Lazy! sync' +qall" C-m
36+
fi
37+
exec tmux attach
38+
fi
3339
EOF
3440

41+
# Download Gitpod Tmux Configuration
3542
curl -L "https://raw.githubusercontent.com/axonasif/gitpod.tmux/main/gitpod.tmux" --output ~/gitpod.tmux
3643
chmod +x ~/gitpod.tmux
3744
! grep -q 'gitpod.tmux' ~/.tmux.conf 2>/dev/null && echo "run-shell -b 'exec ~/gitpod.tmux'" >>~/.tmux.conf
@@ -45,9 +52,3 @@ fi
4552

4653
# Set Nerd Font in .tmux.conf
4754
! grep -q 'Nerd Font' ~/.tmux.conf 2>/dev/null && echo "set-option -g default-terminal 'xterm-256color'" >>~/.tmux.conf
48-
49-
# Clone Neovim configuration
50-
git clone --depth 1 https://github.com/daliendev/astro-nvim/ "$HOME/.config/nvim"
51-
52-
# Install necessary LSP and plugins
53-
nvim --headless "+Lazy! sync" +qall

0 commit comments

Comments
 (0)