Created
January 23, 2019 20:07
-
-
Save grimpy/1288e04e340f6f9f753fad09e921c907 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/bash | |
if [ -z "$1" ]; then | |
cat ~/.warprc | cut -f 1 -d : | |
exit 0 | |
fi | |
project=$(bash -c "echo $(grep "^${1}:" ~/.warprc | cut -f 2 -d :)") | |
session=$(echo $project | sha256sum | awk '{print $1}') | |
if tmux list-windows -F "#{session_name}:#{window_name}" | grep "code:$1" > /dev/null; then | |
tmux select-window -t "code:$1" | |
exit 0 | |
elif tmux list-sessions | grep "^code:" > /dev/null; then | |
tmux new-window -c "$project" -n "$1" -t "code" kak -s "$session" > /dev/null | |
else | |
exec kitty --class=code --title="Kakoune" tmux new-session -s "code" -c "$project" -n "$1" kak -s "$session" > /dev/null | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment