non-default nvim socket for wezterm-edit-helper

This commit is contained in:
Daniel Lundin 2023-03-08 23:27:35 +01:00
parent 89accda030
commit 21e885309c

View file

@ -14,17 +14,19 @@ else
fre --store_name "$_store" --add "$_file" fre --store_name "$_store" --add "$_file"
fi fi
_nvim_socket="$XDG_RUNTIME_DIR/nvim-persistent.sock"
function _nvim_setenv() { function _nvim_setenv() {
nvim --server "$XDG_RUNTIME_DIR/nvim.sock" --remote-expr "execute(\"let \$${1} = \\\"${2}\\\"\")" nvim --server "$_nvim_socket" --remote-expr "execute(\"let \$${1} = \\\"${2}\\\"\")"
} }
nvim --server "$XDG_RUNTIME_DIR/nvim.sock" --remote-expr "42" 2>/dev/null || nvim --server "$_nvim_socket" --remote-expr "42" 2>/dev/null ||
(wezterm cli spawn --cwd "${PWD}" nvim --listen "$XDG_RUNTIME_DIR/nvim.sock" && sleep 0.5) (rm -f "$_nvim_socket" && wezterm cli spawn --cwd "${PWD}" nvim --listen "$_nvim_socket" && sleep 0.5)
_nvim_setenv BUILD_COMMAND "$BUILD_COMMAND" _nvim_setenv BUILD_COMMAND "$BUILD_COMMAND"
_nvim_setenv GOPACKAGESDRIVER "$GOPACKAGESDRIVER" _nvim_setenv GOPACKAGESDRIVER "$GOPACKAGESDRIVER"
_nvim_setenv GOFLAGS "$GOFLAGS" _nvim_setenv GOFLAGS "$GOFLAGS"
nvim --server "$XDG_RUNTIME_DIR/nvim.sock" --remote "$_file" nvim --server "$_nvim_socket" --remote "$_file"
printf "\033]1337;SetUserVar=%s=%s\007" nvim_activate $(date +%s | base64) printf "\033]1337;SetUserVar=%s=%s\007" nvim_activate $(date +%s | base64)