-
-
Notifications
You must be signed in to change notification settings - Fork 108
/
Copy pathutil.lua
41 lines (35 loc) · 847 Bytes
/
util.lua
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
local M = {}
local api = vim.api
function M.await_VimEnter()
if vim.v.vim_did_enter == 0 then
local co = assert(coroutine.running(), 'test is not running in coroutine')
api.nvim_create_autocmd('VimEnter', {
pattern = '*',
once = true,
nested = true,
callback = vim.schedule_wrap(function()
assert(coroutine.resume(co))
end),
})
coroutine.yield()
end
end
---@param group string
---@param link? boolean
---@return vim.api.keyset.hl_info
function M.get_hl(group, link)
return api.nvim_get_hl(0, {
name = group,
link = not not link,
create = false,
})
end
if vim.fn.has('nvim-0.10.0') == false or vim.fn.has('nvim-0.10.0') == 0 then
function M.get_hl(group, link)
return api.nvim_get_hl(0, {
name = group,
link = not not link,
})
end
end
return M