diff options
| author | beeb5k (Vivek Tiwari) <beebeeb5k@gmail.com> | 2026-06-04 20:25:23 +0530 |
|---|---|---|
| committer | beeb5k (Vivek Tiwari) <beebeeb5k@gmail.com> | 2026-06-04 20:25:23 +0530 |
| commit | bfe5ef76b95725451707f6061d5dfa5e3b024c61 (patch) | |
| tree | e61fd46ffbb77e131edbc0ffe1019cef2d7662a9 /lua/bee/LSPs/on_attach.lua | |
| parent | 3ab5bbeda2c86b62999b5a662374c38e3ef0c01b (diff) | |
Use better Plugins
- codediff
- neogit
- nvim-surround
- hlchunk
- fff.nvim
- gitsigns
Diffstat (limited to 'lua/bee/LSPs/on_attach.lua')
| -rw-r--r-- | lua/bee/LSPs/on_attach.lua | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/lua/bee/LSPs/on_attach.lua b/lua/bee/LSPs/on_attach.lua index d4d69e4..8199fb1 100644 --- a/lua/bee/LSPs/on_attach.lua +++ b/lua/bee/LSPs/on_attach.lua @@ -5,50 +5,50 @@ -- end, -- }) return function(_, bufnr) - -- we create a function that lets us more easily define mappings specific - -- for LSP related items. It sets the mode, buffer and description for us each time. + -- we create a function that lets us more easily define mappings specific + -- for LSP related items. It sets the mode, buffer and description for us each time. - local map = function(keys, func, desc, mode) - if desc then - desc = "LSP: " .. desc - end - vim.keymap.set(mode or "n", keys, func, { buffer = bufnr, desc = desc }) - end + local map = function(keys, func, desc, mode) + if desc then + desc = "LSP: " .. desc + end + vim.keymap.set(mode or "n", keys, func, { buffer = bufnr, desc = desc }) + end - map("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame") - map("<leader>la", vim.lsp.buf.code_action, "[L]sp [A]ction") + map("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame") + map("<leader>la", vim.lsp.buf.code_action, "[L]sp [A]ction") - -- See `:help K` for why this keymap - map("K", vim.lsp.buf.hover, "Hover Documentation") - map("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation") + -- See `:help K` for why this keymap + map("K", vim.lsp.buf.hover, "Hover Documentation") + map("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation") - -- Lesser used LSP functionality - map("<leader>wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder") - map("<leader>wr", vim.lsp.buf.remove_workspace_folder, "[W]orkspace [R]emove Folder") - map("<leader>wl", function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, "[W]orkspace [L]ist Folders") + -- Lesser used LSP functionality + map("<leader>wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder") + map("<leader>wr", vim.lsp.buf.remove_workspace_folder, "[W]orkspace [R]emove Folder") + map("<leader>wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, "[W]orkspace [L]ist Folders") - -- Create a command `:Format` local to the LSP buffer - vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_) - vim.lsp.buf.format() - end, { desc = "Format current buffer with LSP" }) - map("<leader>Fl", ":Format<CR>", "[F]ormat with [l]sp") - map("<leader>FL", ":Format<CR>", "[F]ormat with [L]SP") - -- The following two autocommands are used to highlight references of the - -- word under your cursor when your cursor rests there for a little while. - -- See `:help CursorHold` for information about when this is executed - -- When you move your cursor, the highlights will be cleared (the second autocommand). - -- local client = vim.lsp.get_client_by_id(event.data.client_id) - -- if client and client.server_capabilities.documentHighlightProvider then - -- vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { - -- buffer = event.buf, - -- callback = vim.lsp.buf.document_highlight, - -- }) + -- Create a command `:Format` local to the LSP buffer + vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_) + vim.lsp.buf.format() + end, { desc = "Format current buffer with LSP" }) + map("<leader>Fl", ":Format<CR>", "[F]ormat with [l]sp") + map("<leader>FL", ":Format<CR>", "[F]ormat with [L]SP") + -- The following two autocommands are used to highlight references of the + -- word under your cursor when your cursor rests there for a little while. + -- See `:help CursorHold` for information about when this is executed + -- When you move your cursor, the highlights will be cleared (the second autocommand). + -- local client = vim.lsp.get_client_by_id(event.data.client_id) + -- if client and client.server_capabilities.documentHighlightProvider then + -- vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + -- buffer = event.buf, + -- callback = vim.lsp.buf.document_highlight, + -- }) - -- vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { - -- buffer = event.buf, - -- callback = vim.lsp.buf.clear_references, - -- }) - -- end + -- vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { + -- buffer = event.buf, + -- callback = vim.lsp.buf.clear_references, + -- }) + -- end end |
