Skip to content

Instantly share code, notes, and snippets.

@todgru
Last active March 3, 2024 15:40
Show Gist options
  • Save todgru/6224848 to your computer and use it in GitHub Desktop.
Save todgru/6224848 to your computer and use it in GitHub Desktop.
Start up tmux with custom windows, panes and applications running
#!/bin/sh
#
# Setup a work space called `work` with two windows
# first window has 3 panes.
# The first pane set at 65%, split horizontally, set to api root and running vim
# pane 2 is split at 25% and running redis-server
# pane 3 is set to api root and bash prompt.
# note: `api` aliased to `cd ~/path/to/work`
#
session="work"
# set up tmux
tmux start-server
# create a new tmux session, starting vim from a saved session in the new window
tmux new-session -d -s $session -n vim #"vim -S ~/.vim/sessions/kittybusiness"
# Select pane 1, set dir to api, run vim
tmux selectp -t 1
tmux send-keys "api;vim" C-m
# Split pane 1 horizontal by 65%, start redis-server
tmux splitw -h -p 35
tmux send-keys "redis-server" C-m
# Select pane 2
tmux selectp -t 2
# Split pane 2 vertiacally by 25%
tmux splitw -v -p 75
# select pane 3, set to api root
tmux selectp -t 3
tmux send-keys "api" C-m
# Select pane 1
tmux selectp -t 1
# create a new window called scratch
tmux new-window -t $session:1 -n scratch
# return to main vim window
tmux select-window -t $session:0
# Finished setup, attach to the tmux session!
tmux attach-session -t $session
@todgru
Copy link
Author

todgru commented Dec 17, 2020

@niouby you're too kind! ❀️ glad I could help!
@joshbaptiste you are welcome!
@azizLIGHT glad you like it!
@jpdippenaarS excellent! 🀘
@iosifv too kind!
@AffanIndo you're welcome! great questions - see @develforever got you covered.
@zackyaple thanks!
@kosivantsov anytime!
@develforever thanks for the contribution - nice work!
@rcgoodfellow you're welcome!
@botenvouwer nice! work smarter not harder 😎
@cmdcolin tmux-resurrect looks like a very useful tool! thank you!
@mcai4gl2 nah, i just searched man pages to figure this stuff out 😊 thank you!
@bilalelhoudaigui you're welcome!
@maluramichael you're welcome, anytime!
@aamnah you're welcome! i'm happy to have helped you save time and effort!
@setymedia you're welcome!
@darzyx glad i could help out!

thanks to everyone for the stars! 🀩
πŸŽ‰ happy holidays! πŸŽ„ πŸ•Ž β˜ͺ️ πŸŽ‰

@riazspace
Copy link

Nice

@ocpodariu
Copy link

Thanks for posting it πŸ‘

@pottsga
Copy link

pottsga commented Jun 16, 2021

Thanks!

@MarkusMueller-DS
Copy link

thanks for posting, helped me a lot to set up my startup script πŸ‘πŸΌ

@zoj613
Copy link

zoj613 commented Nov 28, 2021

Much appreciated for this script. I was able to modify it to automate the launch of different ncmpcpp panes for displaying the media library, playlist and visualization.

@alexmachina
Copy link

Amazing

@MondeSinxi
Copy link

This is great! Thank you

@jeshe0
Copy link

jeshe0 commented Dec 9, 2023

thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment