Skip to content

Commit

Permalink
fix: Use jobstart with detach=true
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones2014 committed Feb 29, 2024
1 parent a714522 commit 89a570a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lua/smart-splits/mux/tmux.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ end

---@param args (string|number)[]
---@param as_list boolean|nil
---@return nil
local function tmux_exec(args, as_list)
local socket = get_socket_path()
if not socket then
Expand Down Expand Up @@ -165,10 +164,15 @@ function M.on_exit()
log.warn('tmux init: could not detect pane ID!')
return
end
tmux_exec({ 'set-option', '-pt', pane_id, '@pane-is-vim', 0 })
if vim.v.shell_error ~= 0 then
log.warn('tmux init: failed to detect pane_id')
local socket = get_socket_path()
if not socket then
log.warn('on_exit: Could not find tmux socket')
return
end
local args = { 'set-option', '-pt', pane_id, '@pane-is-vim', 0 }
local cmd = vim.list_extend({ 'tmux', '-S', socket }, args, 1, #args)

vim.fn.jobstart(cmd, { detach = true })
end

return M

0 comments on commit 89a570a

Please sign in to comment.