Skip to content

Instantly share code, notes, and snippets.

@adibhanna
Created February 24, 2026 13:56
Show Gist options
  • Select an option

  • Save adibhanna/c337fc2521ad9aeaddf1d19895113e15 to your computer and use it in GitHub Desktop.

Select an option

Save adibhanna/c337fc2521ad9aeaddf1d19895113e15 to your computer and use it in GitHub Desktop.
nic
# Coding cockpit: neovim + claude + terminal in tmux
nic() {
local session_name="${1:-$(basename "$PWD")}"
if [[ -n "$TMUX" ]]; then
echo "Already in a tmux session. Detach first or run from outside tmux."
return 1
fi
if tmux has-session -t "$session_name" 2>/dev/null; then
tmux attach-session -t "$session_name"
return
fi
tmux new-session -d -s "$session_name" -c "$PWD" -x "$(tput cols)" -y "$(tput lines)"
tmux split-window -v -t "$session_name" -c "$PWD" -l 20%
tmux split-window -h -t "$session_name":1.1 -c "$PWD" -l 30%
tmux send-keys -t "$session_name":1.1 'nvim' C-m
tmux send-keys -t "$session_name":1.2 'claude' C-m
tmux select-pane -t "$session_name":1.1
tmux attach-session -t "$session_name"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment