Skip to content

Instantly share code, notes, and snippets.

@haile01
Created August 28, 2021 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haile01/6a3660128d2b0a9f5b27782c9c98d7ec to your computer and use it in GitHub Desktop.
Save haile01/6a3660128d2b0a9f5b27782c9c98d7ec to your computer and use it in GitHub Desktop.
Another bash script for terminal + cp enthusiasts. It setups a tmux window with 4 panes as provided configuration
# Run cp-tmux.sh <problem-name>
# cpp.sh script is here https://gist.github.com/pythagore1123/0962c6f018b153b9697372219d455f68
# The 4 panes of tmux is config as below:
# ----------------------------------------
# | |
# | .cpp editor |
# | |
# |---------------------------------------
# | runner | .inp editor |
# | + |-------------------|
# | compile output | Output watcher |
# ----------------------------------------
#!/bin/bash
/usr/lib/cpp.sh --prepare $1;
path=$(pwd);
tmux kill-session -t cp;
tmux new-session -d -s cp;
tmux splitw -v -t cp:0.0;
tmux splitw -h -t cp:0.1;
tmux splitw -v -t cp:0.2;
tmux send -t cp:0.0 "vim \"$path/$1.cpp\"" ENTER;
tmux send -t cp:0.1 "cd \"$path\" && cpp $1" ENTER;
tmux send -t cp:0.2 "vim \"$path/$1.inp\"" ENTER;
tmux send -t cp:0.3 "tail -vf \"$path/$1.out\"" ENTER;
tmux a -t cp;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment