Skip to content

Commit 2ef04f4

Browse files
authored
feat: add support for running the plugin under tmate (#16)
Previously, using this plugin in a tmate session would cause it to output `server version is too old for client` and hang the pane. This change makes it so that the plugin knows to talk to the tmate executable rather than tmux when necessary.
1 parent 0c57f67 commit 2ef04f4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lua/Navigator/tmux.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,18 @@ local function get_socket()
2121
return vim.split(TMUX, ',')[1]
2222
end
2323

24+
---To know if we should talk to tmux or tmate
25+
---@return string
26+
local function get_executable_name()
27+
-- The $TMUX environment variable contains the name of the executable.
28+
return TMUX:find('tmate') and 'tmate' or 'tmux'
29+
end
30+
2431
---For executing a tmux command
2532
---@param arg string Tmux command to run
2633
---@return number
2734
local function execute(arg)
28-
local t_cmd = string.format('tmux -S %s %s', get_socket(), arg)
35+
local t_cmd = string.format('%s -S %s %s', get_executable_name(), get_socket(), arg)
2936

3037
local handle = assert(io.popen(t_cmd), string.format('Navigator: Unable to execute > [%s]', t_cmd))
3138
local result = handle:read()

0 commit comments

Comments
 (0)