summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/rustaceanvim.lua
blob: 91b10929b0f88e213a7af463dbe96b6df195b197 (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
35
36
37
---@type RustaceanOpts
vim.g.rustaceanvim = {
    ---@type RustaceanToolsOpts
    tools = {
        float_win_config = {
            border = 'rounded',
        },
    },
    ---@type RustaceanLspClientOpts
    server = {
        on_attach = function(_, bufnr)
            local keymaps = {
                { { 'n', 'i' }, '<M-Enter>', '<cmd>RustLsp codeAction<cr>', { desc = 'Code Action' } },
            }

            for _, keymap in ipairs(keymaps) do
                local modes = keymap[1]
                local lhs = keymap[2]
                local rhs = keymap[3]
                local opts = keymap[4]
                opts.buffer = bufnr

                vim.keymap.set(modes, lhs, rhs, opts)
            end
        end,
        default_settings = {
            ['rust-analyzer'] = {
                semanticHighlighting = {
                    operator = { specialization = { enable = true } },
                    punctuation = { enable = true, specialization = { enable = true } },
                },
            },
        },
    },
    ---@type RustaceanDapOpts
    dap = {},
}