Add script functionality
This commit is contained in:
25
scripts/hxi
Executable file
25
scripts/hxi
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/zsh
|
||||
# Runs the IDE
|
||||
|
||||
SESSIONID="IDE-${RANDOM}"
|
||||
TMUX=$(where tmux)
|
||||
|
||||
# Set editor to helix, if unset
|
||||
if [ -z ${EDITOR+x} ]; then
|
||||
EDITOR=$(where hx)
|
||||
fi
|
||||
|
||||
# Open a new session with a random name
|
||||
$TMUX new-session -d -s $SESSINID $EDITOR
|
||||
$TMUX rename-window -t ${SESSIONID}:0 "TMUX IDE"
|
||||
|
||||
# check, if a layout file is present, and run it.
|
||||
if [ -f ./.tmux.layout ]; then
|
||||
source ./.tmux.layout
|
||||
fi
|
||||
|
||||
# Finally, select the editor window in the current session,
|
||||
# and attach to the session
|
||||
$TMUX select-window -t ${SESSIONID}:0
|
||||
$TMUX select-pane -t 0
|
||||
$TMUX attach-session -t ${SESSIONID}
|
||||
Reference in New Issue
Block a user