├── init.lua ├── chadrc.lua ├── configs ├── lspconfig.lua ├── rustaceanvim.lua └── rust-tools.lua ├── mappings.lua └── plugins.lua /init.lua: -------------------------------------------------------------------------------- 1 | vim.g.dap_virtual_text = true 2 | 3 | -------------------------------------------------------------------------------- /chadrc.lua: -------------------------------------------------------------------------------- 1 | ---@type ChadrcConfig 2 | local M = {} 3 | M.ui = {theme = 'catppuccin'} 4 | M.plugins = "custom.plugins" 5 | M.mappings = require "custom.mappings" 6 | return M 7 | -------------------------------------------------------------------------------- /configs/lspconfig.lua: -------------------------------------------------------------------------------- 1 | local on_attach = require("plugins.configs.lspconfig").on_attach 2 | local capabilities = require("plugins.configs.lspconfig").capabilities 3 | 4 | local lspconfig = require("lspconfig") 5 | local util = require "lspconfig/util" 6 | 7 | -------------------------------------------------------------------------------- /configs/rustaceanvim.lua: -------------------------------------------------------------------------------- 1 | local on_attach = require("plugins.configs.lspconfig").on_attach 2 | local capabilities = require("plugins.configs.lspconfig").capabilities 3 | 4 | vim.g.rustaceanvim = { 5 | server = { 6 | on_attach = on_attach, 7 | capabilities = capabilities, 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /configs/rust-tools.lua: -------------------------------------------------------------------------------- 1 | local on_attach = require("plugins.configs.lspconfig").on_attach 2 | local capabilities = require("plugins.configs.lspconfig").capabilities 3 | 4 | local options = { 5 | server = { 6 | on_attach = on_attach, 7 | capabilities = capabilities, 8 | } 9 | } 10 | 11 | return options 12 | -------------------------------------------------------------------------------- /mappings.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | M.dap = { 4 | plugin = true, 5 | n = { 6 | ["db"] = { " DapToggleBreakpoint " }, 7 | ["dus"] = { 8 | function () 9 | local widgets = require('dap.ui.widgets'); 10 | local sidebar = widgets.sidebar(widgets.scopes); 11 | sidebar.open(); 12 | end, 13 | "Open debugging sidebar" 14 | } 15 | } 16 | } 17 | 18 | M.crates = { 19 | plugin = true, 20 | n = { 21 | ["rcu"] = { 22 | function () 23 | require('crates').upgrade_all_crates() 24 | end, 25 | "update crates" 26 | } 27 | } 28 | } 29 | 30 | return M 31 | -------------------------------------------------------------------------------- /plugins.lua: -------------------------------------------------------------------------------- 1 | local cmp = require "cmp" 2 | 3 | local plugins = { 4 | { 5 | "williamboman/mason.nvim", 6 | opts = { 7 | ensure_installed = { 8 | "rust-analyzer", 9 | }, 10 | }, 11 | }, 12 | { 13 | "neovim/nvim-lspconfig", 14 | config = function() 15 | require "plugins.configs.lspconfig" 16 | require "custom.configs.lspconfig" 17 | end, 18 | }, 19 | { 20 | "mrcjkb/rustaceanvim", 21 | version = "^4", 22 | ft = { "rust" }, 23 | dependencies = "neovim/nvim-lspconfig", 24 | config = function() 25 | require "custom.configs.rustaceanvim" 26 | end 27 | }, 28 | { 29 | "mfussenegger/nvim-dap", 30 | init = function() 31 | require("core.utils").load_mappings("dap") 32 | end 33 | }, 34 | { 35 | 'saecki/crates.nvim', 36 | ft = {"toml"}, 37 | config = function(_, opts) 38 | local crates = require('crates') 39 | crates.setup(opts) 40 | require('cmp').setup.buffer({ 41 | sources = { { name = "crates" }} 42 | }) 43 | crates.show() 44 | require("core.utils").load_mappings("crates") 45 | end, 46 | }, 47 | { 48 | "rust-lang/rust.vim", 49 | ft = "rust", 50 | init = function () 51 | vim.g.rustfmt_autosave = 1 52 | end 53 | }, 54 | { 55 | "theHamsta/nvim-dap-virtual-text", 56 | lazy = false, 57 | config = function(_, opts) 58 | require("nvim-dap-virtual-text").setup() 59 | end 60 | }, 61 | { 62 | "hrsh7th/nvim-cmp", 63 | opts = function() 64 | local M = require "plugins.configs.cmp" 65 | M.completion.completeopt = "menu,menuone,noselect" 66 | M.mapping[""] = cmp.mapping.confirm { 67 | behavior = cmp.ConfirmBehavior.Insert, 68 | select = false, 69 | } 70 | table.insert(M.sources, {name = "crates"}) 71 | return M 72 | end, 73 | } 74 | } 75 | return plugins 76 | --------------------------------------------------------------------------------