Update: Async loading of langs and plugins

This commit is contained in:
2021-05-09 03:47:54 -03:00
parent 7e023f6855
commit 4714677bb3
5 changed files with 22 additions and 12 deletions

View File

@@ -233,7 +233,7 @@ hl.langs.scala = {
scalaKeywordModifier = hl.predef.Red
}
function M.setup()
local function load_sync()
local ns = create_namespace("tokyodark")
load_highlights(ns, hl.predef)
load_highlights(ns, hl.common)
@@ -243,5 +243,19 @@ function M.setup()
set_hl_ns(ns)
end
local load_async
load_async = vim.loop.new_async(vim.schedule_wrap(function()
local ns = create_namespace("tokyodark")
for _, group in pairs(hl.langs) do load_highlights(ns, group) end
for _, group in pairs(hl.plugins) do load_highlights(ns, group) end
set_hl_ns(ns)
load_async:close()
end))
function M.setup()
load_sync()
load_async:send()
end
return M

View File

@@ -1,4 +1,3 @@
local M = {}
local highlights = require('tokyodark.highlights')
local terminal = require('tokyodark.terminal')
@@ -7,10 +6,9 @@ local function colorscheme()
if vim.fn.exists("syntax_on") then vim.cmd("syntax reset") end
vim.o.background = "dark"
vim.o.termguicolors = true
vim.g.colors_name = "tokyodark"
highlights.setup()
terminal.setup()
end
function M.setup() colorscheme() end
return M
colorscheme()