Update: Async loading of langs and plugins
This commit is contained in:
1
after/queries/lua/highlights.scm
Normal file
1
after/queries/lua/highlights.scm
Normal file
@@ -0,0 +1 @@
|
|||||||
|
(self) @variable.builtin
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
lua << EOF
|
lua << EOF
|
||||||
for k in pairs(package.loaded) do
|
-- for k in pairs(package.loaded) do
|
||||||
if k:match(".*tokyodark.*") then package.loaded[k] = nil end
|
-- if k:match(".*tokyodark.*") then package.loaded[k] = nil end
|
||||||
end
|
-- end
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
lua require('tokyodark').setup()
|
lua require('tokyodark')
|
||||||
|
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ hl.langs.scala = {
|
|||||||
scalaKeywordModifier = hl.predef.Red
|
scalaKeywordModifier = hl.predef.Red
|
||||||
}
|
}
|
||||||
|
|
||||||
function M.setup()
|
local function load_sync()
|
||||||
local ns = create_namespace("tokyodark")
|
local ns = create_namespace("tokyodark")
|
||||||
load_highlights(ns, hl.predef)
|
load_highlights(ns, hl.predef)
|
||||||
load_highlights(ns, hl.common)
|
load_highlights(ns, hl.common)
|
||||||
@@ -243,5 +243,19 @@ function M.setup()
|
|||||||
set_hl_ns(ns)
|
set_hl_ns(ns)
|
||||||
end
|
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
|
return M
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
local M = {}
|
|
||||||
local highlights = require('tokyodark.highlights')
|
local highlights = require('tokyodark.highlights')
|
||||||
local terminal = require('tokyodark.terminal')
|
local terminal = require('tokyodark.terminal')
|
||||||
|
|
||||||
@@ -7,10 +6,9 @@ local function colorscheme()
|
|||||||
if vim.fn.exists("syntax_on") then vim.cmd("syntax reset") end
|
if vim.fn.exists("syntax_on") then vim.cmd("syntax reset") end
|
||||||
vim.o.background = "dark"
|
vim.o.background = "dark"
|
||||||
vim.o.termguicolors = true
|
vim.o.termguicolors = true
|
||||||
|
vim.g.colors_name = "tokyodark"
|
||||||
highlights.setup()
|
highlights.setup()
|
||||||
terminal.setup()
|
terminal.setup()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.setup() colorscheme() end
|
colorscheme()
|
||||||
|
|
||||||
return M
|
|
||||||
|
|||||||
Reference in New Issue
Block a user