Skip to content

Commit

Permalink
[neovim] Add additional LSP bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
sestrella committed Apr 9, 2024
1 parent 587fef6 commit ca47f4a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ nix run home-manager/release-23.11 -- switch

A list of projects that inspired me to write this one:

- https://github.com/nvim-lua/kickstart.nvim
- https://github.com/HugoReeves/nix-home
- https://github.com/gvolpe/nix-config
- https://github.com/ryantm/home-manager-template
Expand Down
12 changes: 9 additions & 3 deletions home/neovim/plugins/lspconfig/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,27 @@ for server, options in pairs(servers) do
end

-- https://github.com/neovim/nvim-lspconfig
-- https://github.com/nvim-lua/kickstart.nvim
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(event)
vim.bo[event.buf].omnifunc = "v:lua.vim.lsp.omnifunc"

local map = function(keys, func, desc)
vim.keymap.set("n", keys, func, { buffer = event.buf, desc = desc })
local map = function(keys, f, desc)
vim.keymap.set("n", keys, f, { buffer = event.buf, desc = desc })
end

local builtin = require("telescope.builtin")
map("gI", builtin.lsp_implementations, "[G]oto [I]mplementation")
map("gd", builtin.lsp_definitions, "[G]oto [D]efinition")
map("gr", builtin.lsp_references, "[G]oto [R]eferences")

map("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
map("<leader>D", builtin.lsp_type_definitions, "Type [D]efinition")
map("<leader>ds", builtin.lsp_document_symbols, "[D]ocument [S]ymbols")

map("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
map("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
map("K", vim.lsp.buf.hover, "Hover Documentation")

-- TODO: Replace this with https://github.com/stevearc/conform.nvim
map("<space>f", function()
Expand Down

0 comments on commit ca47f4a

Please sign in to comment.