diff --git a/bin/wezterm-edit-helper b/bin/wezterm-edit-helper index 8b00b00..b5f34c5 100755 --- a/bin/wezterm-edit-helper +++ b/bin/wezterm-edit-helper @@ -14,17 +14,19 @@ else fre --store_name "$_store" --add "$_file" fi +_nvim_socket="$XDG_RUNTIME_DIR/nvim-persistent.sock" + 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 || - (wezterm cli spawn --cwd "${PWD}" nvim --listen "$XDG_RUNTIME_DIR/nvim.sock" && sleep 0.5) +nvim --server "$_nvim_socket" --remote-expr "42" 2>/dev/null || + (rm -f "$_nvim_socket" && wezterm cli spawn --cwd "${PWD}" nvim --listen "$_nvim_socket" && sleep 0.5) _nvim_setenv BUILD_COMMAND "$BUILD_COMMAND" _nvim_setenv GOPACKAGESDRIVER "$GOPACKAGESDRIVER" _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)