Adam Pippin
2 years ago
5 changed files with 117 additions and 21 deletions
@ -1,4 +0,0 @@ |
|||
{ |
|||
"html.autoClosingTags": false, |
|||
"html.autoCreateQuotes": false |
|||
} |
@ -1,18 +1,53 @@ |
|||
local M = require('module'):new() |
|||
|
|||
function M:boot() |
|||
|
|||
extensions = { } |
|||
for extension, config in pairs(self.config.extensions) do |
|||
table.insert(extensions, extension) |
|||
end |
|||
|
|||
vim.g.coc_global_extensions = extensions |
|||
|
|||
opts = {} |
|||
for extension, config in pairs(self.config.extensions) do |
|||
for key,value in pairs(config) do |
|||
components = {} |
|||
for str in key:gmatch('([^.]+)') do |
|||
table.insert(components, str) |
|||
end |
|||
key = components[#components] |
|||
table.remove(components, #components) |
|||
namespace = table.concat(components, '.') |
|||
if (opts[namespace] == nil) then |
|||
opts[namespace] = {} |
|||
end |
|||
opts[namespace][key] = value |
|||
end |
|||
end |
|||
|
|||
for namespace,config in pairs(opts) do |
|||
vim.fn['coc#config'](namespace, config) |
|||
end |
|||
end |
|||
|
|||
function M:run() |
|||
-- if you leave the cursor on a variable/etc for a moment, this will cause |
|||
-- all other occurrences to be subtly highlighted. |
|||
vim.api.nvim_create_autocmd('CursorHold', { |
|||
pattern = { '*' }, |
|||
command = "silent call CocActionAsync('highlight')" |
|||
}) |
|||
end |
|||
|
|||
function M:install() |
|||
if (self.config.extensions == nil) then return end |
|||
exts = table.concat(self.config.extensions, ' ') |
|||
vim.cmd(':CocInstall -sync '..exts) |
|||
-- enable tailwindcss completion in blade files |
|||
-- TODO: Figure out a better way to enable tailwind in blade. |
|||
-- Currently this only works when opening in an existing instance, not when |
|||
-- starting vim with a blade file. |
|||
-- Also maybe the tailwindCSS.includeLanguages option should do this? |
|||
vim.api.nvim_create_autocmd('FileType', { |
|||
pattern = { 'blade' }, |
|||
command = 'silent CocCommand tailwindCSS.forceActivate' |
|||
}) |
|||
end |
|||
|
|||
return M |
|||
|
Loading…
Reference in new issue