-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
100 lines (78 loc) · 1.8 KB
/
Copy pathclient.lua
File metadata and controls
100 lines (78 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
---@type table<string, fun(...: any): any>
local M = {}
M.is_neovide = function()
return vim.g.neovide ~= nil
end
M.is_neovim_qt = function()
return vim.g.nvim_qt ~= nil or vim.env.NVIM_QT_RUNNING == "1"
end
M.is_goneovim = function()
return vim.g.goneovim ~= nil
end
M.is_fvim = function()
return vim.g.fvim_loaded ~= nil
end
M.is_gui_client = function()
return M.is_neovide() or M.is_neovim_qt() or M.is_goneovim() or M.is_fvim() or vim.fn.has "gui_running" == 1
end
M.is_kitty = function()
return vim.env.TERM == "kitty" or vim.env.TERM == "xterm-kitty"
end
M.is_wezterm = function()
return vim.env.TERM == "wezterm"
end
M.is_ghostty = function()
return vim.env.TERM == "xterm-ghostty"
end
M.is_alacritty = function()
return vim.env.TERM == "alacritty"
end
M.is_windows_terminal = function()
if vim.fn.has "win32" == 1 then
local wt_session = os.getenv "WT_SESSION"
return wt_session ~= nil
else
return false
end
end
M.is_iterm = function()
return vim.env.ITERM_SESSION_ID ~= nil
end
M.is_ssh = function()
return vim.env.SSH_TTY ~= nil or vim.env.SSH_CONNECTION ~= nil or vim.env.SSH_CLIENT ~= nil
end
M.is_cui_client = function()
return not M.is_gui_client()
end
M.get_client = function()
if M.is_gui_client() then
if M.is_neovide() then
return "neovide"
end
if M.is_neovim_qt() then
return "neovim-qt"
end
if M.is_goneovim() then
return "goneovim"
end
else
if M.is_kitty() then
return "kitty"
end
if M.is_wezterm() then
return "wezterm"
end
if M.is_ghostty() then
return "ghostty"
end
if M.is_alacritty() then
return "alacritty"
end
if M.is_windows_terminal() then
return "windows terminal"
end
end
-- NOTE: Unknown default
return "default"
end
return M