Last active
March 12, 2021 16:56
-
-
Save greyblake/bd2e6dfa7b463958ccfa8b0df067720a to your computer and use it in GitHub Desktop.
Creates new rust project and runs `cargo watch` with vim in tmux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PLAYGROUNDS_DIR="/tmp/rust-playgrounds" | |
TIMESTAMP=$(date +"%Y%m%d%H%M%S") | |
PROJECT_DIR="${PLAYGROUNDS_DIR}/playground${TIMESTAMP}" | |
cargo new $PROJECT_DIR | |
cd $PROJECT_DIR | |
# Add dependencies | |
for CRATE in $@; do | |
sed "/^\[dependencies\]/a $CRATE = \"*\"" -i Cargo.toml | |
done | |
tmux new-session \; \ | |
send-keys "nvim ./src/main.rs" C-m \; \ | |
split-window -h \; \ | |
send-keys "cargo watch -x run" C-m \; \ | |
select-pane -L; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment