this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[nvim] lsp changes (temporarily removed AutoFormat)

+43 -12
+40 -11
nvim/lua/core/lsp/handlers.lua
··· 67 67 end 68 68 69 69 M.on_attach = function(client, bufnr) 70 + vim.notify(client.name .. " starting...") 70 71 71 72 -- Enable completion triggered by <c-x><c-o> 72 73 vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'lua.vim.lsp.omnifunc') 73 74 74 - if client.resolved_capabilities.document_formatting then 75 - vim.api.nvim_exec( 76 - [[ 77 - augroup Format 78 - autocmd! * <buffer> 79 - autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync() 80 - augroup END 81 - ]], 82 - false 83 - ) 84 - end 75 + -- if client.resolved_capabilities.document_formatting then 76 + -- vim.api.nvim_exec( 77 + -- [[ 78 + -- augroup Format 79 + -- autocmd! * <buffer> 80 + -- autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync() 81 + -- augroup END 82 + -- ]], 83 + -- false 84 + -- ) 85 + -- end 85 86 86 87 lsp_keymaps(bufnr) 87 88 lsp_highlight_document(client) ··· 93 94 if not ok then return end 94 95 95 96 M.capabilities = cmp_nvim_lsp.update_capabilities(capabilities) 97 + 98 + function M.enable_format_on_save() 99 + vim.cmd [[ 100 + augroup format_on_save 101 + autocmd! 102 + autocmd BufWritePre * lua vim.lsp.buf.formatting_seq_sync() 103 + augroup end 104 + ]] 105 + vim.notify("Enabled format on save") 106 + end 107 + 108 + function M.disable_format_on_save() 109 + local name = "format_on_save" 110 + if vim.fn.exists("#" .. name) == 1 then 111 + vim.api.nvim_del_augroup_by_name(name) 112 + end 113 + vim.notify("Disabled format on save") 114 + end 115 + 116 + function M.toggle_format_on_save() 117 + if vim.fn.exists "#format_on_save#BufWritePre" == 0 then 118 + M.enable_format_on_save() 119 + else 120 + M.disable_format_on_save() 121 + end 122 + end 123 + 124 + vim.api.nvim_create_user_command("LspToggleAutoFormat", M.toggle_format_on_save, {}) 96 125 97 126 return M
+3 -1
nvim/lua/plugins/whichkey.lua
··· 41 41 l = { 42 42 name = "Lsp", 43 43 a = { "<cmd>lua vim.lsp.buf.code_action()<CR>", "Code Action" }, 44 - i = { "<cmd>LspInfo<CR>", "Info" }, 44 + D = { "<cmd>lua vim.lsp.buf.declaration()<CR>", "Declaration" }, 45 + d = { "<cmd>lua vim.lsp.buf.definition()<CR>", "Definition" }, 45 46 I = { "<cmd>LspInstallInfo<CR>", "Installer Info" }, 47 + i = { "<cmd>LspInfo<CR>", "Info" }, 46 48 j = { 47 49 "<cmd>lua vim.diagnostic.goto_next({buffer=0})<CR>", 48 50 "Next Diagnostic",