-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move
are_we_wezterm()
function to mux.utils
- Loading branch information
1 parent
33c8507
commit 159c482
Showing
4 changed files
with
37 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
local M = {} | ||
|
||
---Check if Neovim is running in Wezterm TUI | ||
---@return boolean | ||
function M.are_we_wezterm() | ||
if M.are_we_gui() then | ||
return false | ||
end | ||
local term = vim.trim((vim.env.TERM_PROGRAM or ''):lower()) | ||
local wezterm_pane = vim.trim(vim.env.WEZTERM_PANE or '') | ||
return term == 'wezterm' or wezterm_pane ~= '' | ||
end | ||
|
||
function M.are_we_tmux() | ||
if M.are_we_gui() then | ||
return false | ||
end | ||
|
||
local term = vim.trim((vim.env.TERM_PROGRAM or ''):lower()) | ||
return term == 'tmux' | ||
end | ||
|
||
---Check if Neovim is running in a GUI (rather than TUI) | ||
---@return boolean | ||
function M.are_we_gui() | ||
-- if running in a GUI instead of terminal TUI, disable mux | ||
-- because you aren't in any terminal, you're in a Neovim GUI | ||
local current_ui = vim.tbl_filter(function(ui) | ||
return ui.chan == 1 | ||
end, vim.api.nvim_list_uis())[1] | ||
return current_ui ~= nil and not current_ui.stdin_tty and not current_ui.stdout_tty | ||
end | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters