Repository navigation
Expand file tree
/
Copy pathglobals.lua
More file actions
43 lines (39 loc) · 1.61 KB
/
Copy pathglobals.lua
File metadata and controls
43 lines (39 loc) · 1.61 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
vim.g.is_windows = vim.fn.has("win64") == 1 or vim.fn.has("win32") == 1 or vim.fn.has("win16") == 1
-- 'zcmp' is zcmp.nvim over nvim's own completion under 'autocomplete': a path
-- source with core's buffer scanners, zsnip's snippet source and the LSP
-- omnifunc alongside it in one ranked menu.
--
-- Falling back rather than trusting the variable: an unknown name matches
-- neither branch, which leaves nvim with no completion engine at all and
-- nothing said about why. The names have already changed twice.
local CMP_ENGINES = { blink = true, zcmp = true }
local requested = vim.env.NVIM_CMP_ENGINE
vim.g.cmp_engine = CMP_ENGINES[requested] and requested or 'zcmp' -- blink | zcmp
if requested and not CMP_ENGINES[requested] then
vim.schedule(function()
local msg = ("NVIM_CMP_ENGINE=%q is not a completion engine; using 'zcmp'"):format(requested)
vim.notify(msg, vim.log.levels.WARN)
end)
end
vim.g.ui_engine = 'ui2' -- ui2 | noice
vim.g.hybrid_nu = true
vim.g.transparent_background = true
vim.g.transparent_float_if_transparent = false
vim.g.virtual_line_current_line = true
_G.clear_floats_and_highlights = function()
vim.cmd [[ nohlsearch ]]
for _, win in ipairs(vim.api.nvim_list_wins()) do
local success, config = pcall(vim.api.nvim_win_get_config, win)
if not success then
return
end
if config.relative ~= "" then
pcall(vim.api.nvim_win_close, win, false)
end
end
end
local default_ctrl_l = vim.fn.maparg('<C-L>', 'n', false, true).rhs or '<C-L>'
_G.clear_screen = function()
clear_floats_and_highlights()
vim.api.nvim_feedkeys(vim.keycode(default_ctrl_l), 'n', false)
end