diff --git a/lua/custom/chadrc.lua b/lua/custom/chadrc.lua new file mode 100644 index 0000000..b37a6c1 --- /dev/null +++ b/lua/custom/chadrc.lua @@ -0,0 +1,6 @@ +---@type ChadrcConfig + local M = {} + M.ui = {theme = 'gatekeeper'} + M.plugins = 'custom.plugins' + M.mappings = require "custom.mappings" + return M diff --git a/lua/custom/configs/lspconfig.lua b/lua/custom/configs/lspconfig.lua new file mode 100644 index 0000000..3fe3059 --- /dev/null +++ b/lua/custom/configs/lspconfig.lua @@ -0,0 +1,6 @@ +local on_attach = require("plugins.configs.lspconfig").on_attach +local capabilities = require("plugins.configs.lspconfig").capabilities +local lspconfig = require("lspconfig") +local util = require "lspconfig/util" + + diff --git a/lua/custom/configs/rust-tools.lua b/lua/custom/configs/rust-tools.lua new file mode 100644 index 0000000..2d96381 --- /dev/null +++ b/lua/custom/configs/rust-tools.lua @@ -0,0 +1,10 @@ +local on_attach = require("plugins.configs.lspconfig").on_attach +local capabilities = require("plugins.configs.lspconfig").capabilities + +local options = { + server = { + on_attach = on_attach, + capabilities = capabilities, + } +} +return options diff --git a/lua/custom/init.lua b/lua/custom/init.lua new file mode 100644 index 0000000..a945f62 --- /dev/null +++ b/lua/custom/init.lua @@ -0,0 +1,6 @@ +vim.opt.colorcolumn = "180" +vim.opt.expandtab = true +vim.opt.tabstop = 4 +vim.opt.softtabstop = 0 +vim.opt.shiftwidth = 0 + diff --git a/lua/custom/mappings.lua b/lua/custom/mappings.lua new file mode 100644 index 0000000..ab6b85d --- /dev/null +++ b/lua/custom/mappings.lua @@ -0,0 +1,30 @@ +local M = {} + +M.dap = { + n = { + ["db"] = { + " DapToggleBreakpoint ", + "Toggle Breakpoint" + }, + ["dus"] = { + function () + local widgets = require("dap.ui.widgets"); + local sidebar = widgets.sidebar(widgets.scopes); + sidebar.open(); + end, + "Open debugging sidebar" + }, + ["dc"] = { + " DapContinue ", + "Continue debugging" + }, + ["rcu"] = { + function () + require("crates").upgrade_all_crates() + end, + "Update all rust crates" + } + } +} + +return M diff --git a/lua/custom/plugins.lua b/lua/custom/plugins.lua new file mode 100644 index 0000000..aed54c0 --- /dev/null +++ b/lua/custom/plugins.lua @@ -0,0 +1,57 @@ +local plugins = { + { + "neovim/nvim-lspconfig", + config = function() + require "plugins.configs.lspconfig" +require "custom.configs.lspconfig" + end + }, + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "lua-language-server", + "rust-analyzer" + } + } + }, + { + "rust-lang/rust.vim", + ft = "rust", + init = function () + vim.g.rustfmt_autosave = 1 + end + }, + { + "simrat39/rust-tools.nvim", + ft = "rust", + dependencies = "neovim/nvim-lspconfig", + opts = function () + return require "custom.configs.rust-tools" + end, + config = function (_, opts) + require("rust-tools").setup(opts) + end + }, + { + "mfussenegger/nvim-dap" + }, + { + "saecki/crates.nvim", + ft = {"rust", "toml"}, + config = function (_, opts) + local crates = require("crates") + crates.setup(opts) + crates.show() + end + }, + { + "hrsh7th/nvim-cmp", + opts = function () + local M = require "plugins.configs.cmp", + table.insert(M.sources, {name = "crates"}) + return M + end + } +} +return plugins