diff options
Diffstat (limited to 'lua/utils')
-rw-r--r-- | lua/utils/init.lua | 67 |
1 files changed, 10 insertions, 57 deletions
diff --git a/lua/utils/init.lua b/lua/utils/init.lua index 8264189d..8ea842ca 100644 --- a/lua/utils/init.lua +++ b/lua/utils/init.lua @@ -70,9 +70,7 @@ function utils.toggle_autoformat() }, }, } - if Log:get_default() then - Log:get_default().info "Format on save active" - end + Log:debug "Format on save active" end if not lvim.format_on_save then @@ -81,15 +79,16 @@ function utils.toggle_autoformat() :autocmd! autoformat endif ]] - if Log:get_default() then - Log:get_default().info "Format on save off" - end + Log:debug "Format on save off" end end function utils.reload_lv_config() - vim.cmd "source ~/.local/share/lunarvim/lvim/lua/settings.lua" - vim.cmd("source " .. USER_CONFIG_PATH) + require("core.lualine").config() + + local config = require "config" + config:load() + require("keymappings").setup() -- this should be done before loading the plugins vim.cmd "source ~/.local/share/lunarvim/lvim/lua/plugins.lua" local plugins = require "plugins" @@ -99,55 +98,9 @@ function utils.reload_lv_config() vim.cmd ":PackerCompile" vim.cmd ":PackerInstall" -- vim.cmd ":PackerClean" - Log:get_default().info "Reloaded configuration" -end - -function utils.check_lsp_client_active(name) - local clients = vim.lsp.get_active_clients() - for _, client in pairs(clients) do - if client.name == name then - return true - end - end - return false -end - -function utils.get_active_client_by_ft(filetype) - local clients = vim.lsp.get_active_clients() - for _, client in pairs(clients) do - if client.name == lvim.lang[filetype].lsp.provider then - return client - end - end - return nil -end - --- TODO: consider porting this logic to null-ls instead -function utils.get_supported_linters_by_filetype(filetype) - local null_ls = require "null-ls" - local matches = {} - for _, provider in pairs(null_ls.builtins.diagnostics) do - if vim.tbl_contains(provider.filetypes, filetype) then - local provider_name = provider.name - - table.insert(matches, provider_name) - end - end - - return matches -end - -function utils.get_supported_formatters_by_filetype(filetype) - local null_ls = require "null-ls" - local matches = {} - for _, provider in pairs(null_ls.builtins.formatting) do - if provider.filetypes and vim.tbl_contains(provider.filetypes, filetype) then - -- table.insert(matches, { provider.name, ft }) - table.insert(matches, provider.name) - end - end - - return matches + local null_ls = require "lsp.null-ls" + null_ls.setup(vim.bo.filetype, { force_reload = true }) + Log:info "Reloaded configuration" end function utils.unrequire(m) |