summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/custom/config/rustaceanvim.lua
blob: b8c2c1b29ba4af06218807d17858eda50d669c6a (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
---@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'] = {},
        },
    },
    ---@type RustaceanDapOpts
    dap = {},
}