summaryrefslogtreecommitdiff
path: root/vim/.config/nvim/lua/plugins/rust-config.lua
blob: c52d382327b5f929b8fe56fb352e9fe497d71956 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
local bufnr = vim.api.nvim_get_current_buf()
vim.keymap.set(
  "n",
  "<leader>a",
  function()
    vim.cmd.RustLsp('codeAction') -- supports rust-analyzer's grouping
    -- or vim.lsp.buf.codeAction() if you don't want grouping.
  end,
  { silent = true, buffer = bufnr }
)
vim.keymap.set(
  "n",
  "K",
  function()
    if vim.bo.filetype == "rust" then
      vim.cmd.RustLsp({'hover', 'actions'})
    else
      vim.lsp.buf.hover()
    end
  end,
  { silent = true, buffer = bufnr }
)

vim.g.rustaceanvim = {
  server = {
    settings = {
      ["rust-analyzer"] = {
        checkOnSave = {
          command = "clippy",
        },
      },
    },
  },
}