Skip to content

[Feature]: Improve mux auto-detection and make lookup more flexible #141

@mrjones2014

Description

@mrjones2014

Similar Issues

  • Before filing, I have searched for similar issues.

Description

Recently there's been an increase in issues related to mux auto-detection, and an interesting use-case in #140. Using tmux in other terminals, but kitty mux in kitty.

Mux auto-detection needs to be made more robust, and we also need to make the priority order configurable, so that e.g. if tmux is installed and you're using kitty, but you want to use kitty mux in the kitty terminal, you can specify that kitty should take precedence here.

I'm thinking we can do something like:

local mux_lookup = {
  tmux = function()
    local term = vim.trim((vim.env.TERM_PROGRAM or ''):lower())
    return term == 'tmux'
  end,
  wezterm = function()
    local term = vim.trim((vim.env.TERM_PROGRAM or ''):lower())
    return term == 'wezterm'
  end,
  kitty = function()
    return vim.env.KITTY_LISTEN_ON ~= nil and #vim.env.KITTY_LISTEN_ON > 0
  end,
}

And then the config would be something like:

require('smart-splits').setup({
  mux_detection_priority = { 'tmux', 'wezterm', 'kitty' },
})

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions