diff --git a/README.md b/README.md index 44901b7..3545b6a 100644 --- a/README.md +++ b/README.md @@ -361,6 +361,12 @@ That is where you saw the current symbol been highlighted. You can override the above highlight to fit your current colorscheme +## commands +| command | function | +|--- |--- | +| LspToggleFmt | toggle lsp auto format | + + ## Screenshots colorscheme: [aurora](https://github.com/ray-x/aurora) diff --git a/lua/navigator.lua b/lua/navigator.lua index d91fd05..883c814 100644 --- a/lua/navigator.lua +++ b/lua/navigator.lua @@ -55,9 +55,10 @@ _NgConfigValues = { } } -vim.cmd("command! -nargs=0 LspLog call v:lua.open_lsp_log()") -vim.cmd("command! -nargs=0 LspRestart call v:lua.reload_lsp()") -vim.cmd("command! -nargs=0 ToggleLspFmt lua require'navigator.lspclient.mapping'.toggle_lspformat()") +vim.cmd("command! -nargs=0 LspLog lua require'navigator.lspclient.config'.open_lsp_log()") +vim.cmd("command! -nargs=0 LspRestart lua require'navigator.lspclient.config'.reload_lsp()") +vim.cmd( + "command! -nargs=0 LspToggleFmt lua require'navigator.lspclient.mapping'.toggle_lspformat()") local extend_config = function(opts) opts = opts or {} diff --git a/lua/navigator/lspclient/config.lua b/lua/navigator/lspclient/config.lua index 46879c9..1debc3f 100644 --- a/lua/navigator/lspclient/config.lua +++ b/lua/navigator/lspclient/config.lua @@ -7,6 +7,7 @@ capabilities.textDocument.completion.completionItem.snippetSupport = true function M.reload_lsp() vim.lsp.stop_client(vim.lsp.get_active_clients()) vim.cmd [[edit]] + require'navigator.lspclient.clients'.setup() end function M.open_lsp_log() @@ -14,10 +15,4 @@ function M.open_lsp_log() vim.cmd("edit " .. path) end -vim.cmd("command! -nargs=0 LspLog call v:lua.open_lsp_log()") -vim.cmd("command! -nargs=0 LspRestart call v:lua.reload_lsp()") - -local cfg = {} - -require("lsp.clients").setup(cfg) return M