diff --git a/lua/user/lsp/null-ls.lua b/lua/user/lsp/null-ls.lua index 56637fd..e969c84 100644 --- a/lua/user/lsp/null-ls.lua +++ b/lua/user/lsp/null-ls.lua @@ -19,37 +19,53 @@ if data_exists then end end -null_ls.setup({ - debug = false, - sources = sources, - --sources = { - --formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }), - --formatting.prettier, - -- formatting.prettierd, - -- formatting.black.with({ extra_args = { "--fast" } }), - -- formatting.stylua, - -- formatting.eslint_d, - -- formatting.google_java_format, - -- formatting.phpcbf, - -- formatting.clang_format, - -- diagnostics.flake8 - -- diagnostics.eslint_d, - --}, +local run = 0 +local data_exists, frmt = pcall(require, "custom.format_onsave") +if not data_exists then + run = 1 +end +if frmt.disable == 0 then + run = 1 +end - -- on_attach = function(client, bufnr) - -- --if client.resolved_capabilities.document_formatting then - -- --vim.cmd("autocmd BufWritePre lua vim.lsp.buf.format{async=true}") - -- --end - -- if client.supports_method("textDocument/formatting") then - -- vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) - -- vim.api.nvim_create_autocmd("BufWritePre", { - -- group = augroup, - -- buffer = bufnr, - -- callback = function() - -- vim.lsp.buf.format({ bufnr = bufnr }) - -- -- vim.lsp.buf.formatting_sync() - -- end, - -- }) - -- end - -- end, -}) +if run == 1 then + null_ls.setup({ + debug = false, + sources = sources, + --sources = { + --formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }), + --formatting.prettier, + -- formatting.prettierd, + -- formatting.black.with({ extra_args = { "--fast" } }), + -- formatting.stylua, + -- formatting.eslint_d, + -- formatting.google_java_format, + -- formatting.phpcbf, + -- formatting.clang_format, + -- diagnostics.flake8 + -- diagnostics.eslint_d, + --}, + + on_attach = function(client, bufnr) + --if client.resolved_capabilities.document_formatting then + --vim.cmd("autocmd BufWritePre lua vim.lsp.buf.format{async=true}") + --end + if client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + vim.lsp.buf.format({ bufnr = bufnr }) + -- vim.lsp.buf.formatting_sync() + end, + }) + end + end, + }) +else + null_ls.setup({ + debug = false, + sources = sources, + }) +end diff --git a/lua/user/webdevicons.lua b/lua/user/webdevicons.lua index 3290247..7eae019 100644 --- a/lua/user/webdevicons.lua +++ b/lua/user/webdevicons.lua @@ -7,6 +7,18 @@ local material_icon_ok, material_icon = pcall(require, "nvim-material-icon") if not material_icon_ok then return end +material_icon.setup({ + override = { + ["mjs"] = { + icon = "", + color = "#efd81d", + cterm_color = "220", + name = "Mjs", + }, + }, + color_icons = true, + default = true, +}) web_devicons.setup({ override = material_icon.get_icons(),