Single instance with remote/server API for opening new files #5107
-
I imagine there is a ticket for this already but I'm not sure what terms to search for. I've tried 'server' and 'remote' which are the terms used in vim, I think. Is it possible to open an instance of helix and then, from the command line, open further files in that instance rather than opening new instances? I like working and search for stuff on the command line and it would be ace to be able to just forward those files to helix to open rather than having to go back to helix and research for the relevant file. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 9 replies
-
I've added a hacky commit on top of the 22.12 tag which opens a unix socket as I use it with a script like this: #!/bin/bash
files=$*
# Detect if helix is already running - if so use socat to send "open <filename>" to the socket
# otherwise make sure the socket file is deleted so that it is clear to open a new one
if ps -ef | grep -- "--title helix" | grep -v grep > /dev/null; then
first=$1
fullpath=$(realpath $first)
echo "open ${fullpath}" | socat - UNIX-CONNECT:/tmp/helix-socket
exit 0
else
rm -f /tmp/helix-socket
fi
# Open helix in some way (this opens it in an instance of alacritty)
PYTHONPATH='' alacritty --title helix --option dimensions.columns=180 --option dimensions.lines=50 --command hx $files & I hope this is of some use to people in my position. I have no expectations of it being merged. It is a hacky mess. It also only compiles on unix. |
Beta Was this translation helpful? Give feedback.
-
I'm working on #401, and part of my proposal for local client-server is to have a single master client containing all the respective data. On Unix-based systems, this would be a daemon, but Windows doesn't have a direct equivalent to them. Instead, when the master client exits, one the child clients loads the persistent state and becomes the master. |
Beta Was this translation helpful? Give feedback.
#312