This commit is contained in:
2025-06-30 22:57:51 +03:00
commit 94097c5a1c
13 changed files with 410 additions and 0 deletions

17
lua/chadrc.lua Normal file
View File

@@ -0,0 +1,17 @@
-- This file needs to have same structure as nvconfig.lua
-- https://github.com/NvChad/ui/blob/v3.0/lua/nvconfig.lua
-- Please read that file to know all available options :(
---@type ChadrcConfig
local M = {}
M.base46 = {
theme = "bearded-arc",
-- hl_override = {
-- Comment = { italic = true },
-- ["@comment"] = { italic = true },
-- },
}
return M

15
lua/configs/conform.lua Normal file
View File

@@ -0,0 +1,15 @@
local options = {
formatters_by_ft = {
lua = { "stylua" },
-- css = { "prettier" },
-- html = { "prettier" },
},
-- format_on_save = {
-- -- These options will be passed to conform.format()
-- timeout_ms = 500,
-- lsp_fallback = true,
-- },
}
return options

52
lua/configs/dap.lua Normal file
View File

@@ -0,0 +1,52 @@
local dap = require("dap")
local dapui = require("dapui")
-- Setup dap-ui
dapui.setup()
-- Auto-open UI on DAP start
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
-- Paths for Mason v2 codelldb adapter
local mason_path = vim.fn.stdpath("data") .. "/mason/packages/codelldb/extension"
local adapter_path = mason_path .. "/adapter/codelldb"
local liblldb_path = mason_path .. "/lldb/lib/liblldb.so"
-- Register the DAP adapter
dap.adapters.codelldb = {
type = "server",
host = "127.0.0.1",
port = "${port}",
executable = {
command = adapter_path,
args = { "--port", "${port}" },
},
}
-- Debug configuration for Rust
dap.configurations.rust = {
{
name = "Launch Rust",
type = "codelldb",
request = "launch",
program = function()
return vim.fn.input(
"Path to executable: ",
vim.fn.getcwd() .. "/target/debug/",
"file"
)
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
args = {},
runInTerminal = false,
},
}

47
lua/configs/lazy.lua Normal file
View File

@@ -0,0 +1,47 @@
return {
defaults = { lazy = true },
install = { colorscheme = { "nvchad" } },
ui = {
icons = {
ft = "",
lazy = "󰂠 ",
loaded = "",
not_loaded = "",
},
},
performance = {
rtp = {
disabled_plugins = {
"2html_plugin",
"tohtml",
"getscript",
"getscriptPlugin",
"gzip",
"logipat",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"matchit",
"tar",
"tarPlugin",
"rrhelper",
"spellfile_plugin",
"vimball",
"vimballPlugin",
"zip",
"zipPlugin",
"tutor",
"rplugin",
"syntax",
"synmenu",
"optwin",
"compiler",
"bugreport",
"ftplugin",
},
},
},
}

31
lua/configs/lspconfig.lua Normal file
View File

@@ -0,0 +1,31 @@
-- load defaults i.e lua_lsp
require("nvchad.configs.lspconfig").defaults()
local lspconfig = require "lspconfig"
-- EXAMPLE
local servers = {
"html",
"cssls",
"clangd",
"pyright",
"zls",
"gopls",
}
local nvlsp = require "nvchad.configs.lspconfig"
-- lsps with default config
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = nvlsp.on_attach,
on_init = nvlsp.on_init,
capabilities = nvlsp.capabilities,
}
end
-- configuring single server, example: typescript
-- lspconfig.ts_ls.setup {
-- on_attach = nvlsp.on_attach,
-- on_init = nvlsp.on_init,
-- capabilities = nvlsp.capabilities,
-- }

32
lua/mappings.lua Normal file
View File

@@ -0,0 +1,32 @@
require "nvchad.mappings"
-- add yours here
local map = vim.keymap.set
map("n", ";", ":", { desc = "CMD enter command mode" })
map("i", "jk", "<ESC>")
-- map({ "n", "i", "v" }, "<C-s>", "<cmd> w <cr>")
map('i', '<C-l>', function ()
vim.fn.feedkeys(vim.fn['copilot#Accept'](), '')
end, { desc = 'Copilot Accept', noremap = true, silent = true })
-- Nvim DAP
map("n", "<Leader>dl", "<cmd>lua require'dap'.step_into()<CR>", { desc = "Debugger step into" })
map("n", "<Leader>dj", "<cmd>lua require'dap'.step_over()<CR>", { desc = "Debugger step over" })
map("n", "<Leader>dk", "<cmd>lua require'dap'.step_out()<CR>", { desc = "Debugger step out" })
map("n", "<Leader>dc", "<cmd>lua require'dap'.continue()<CR>", { desc = "Debugger continue" })
map("n", "<Leader>db", "<cmd>lua require'dap'.toggle_breakpoint()<CR>", { desc = "Debugger toggle breakpoint" })
map(
"n",
"<Leader>dd",
"<cmd>lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>",
{ desc = "Debugger set conditional breakpoint" }
)
map("n", "<Leader>de", "<cmd>lua require'dap'.terminate()<CR>", { desc = "Debugger reset" })
map("n", "<Leader>dr", "<cmd>lua require'dap'.run_last()<CR>", { desc = "Debugger run last" })
-- rustaceanvim
map("n", "<Leader>dt", "<cmd>lua vim.cmd('RustLsp testables')<CR>", { desc = "Debugger testables" })

6
lua/options.lua Normal file
View File

@@ -0,0 +1,6 @@
require "nvchad.options"
-- add yours here!
-- local o = vim.o
-- o.cursorlineopt ='both' -- to enable cursorline!

106
lua/plugins/init.lua Normal file
View File

@@ -0,0 +1,106 @@
return {
{
"stevearc/conform.nvim",
-- event = 'BufWritePre', -- uncomment for format on save
opts = require "configs.conform",
},
-- These are some examples, uncomment them if you want to see them work!
{
"neovim/nvim-lspconfig",
config = function()
require "configs.lspconfig"
end,
},
-- {
-- "github/copilot.vim",
-- lazy = false,
-- config = function() -- Mapping tab is already used in NvChad
-- vim.g.copilot_no_tab_map = true; -- Disable tab mapping
-- vim.g.copilot_assume_mapped = true; -- Assume that the mapping is already done
-- end
-- },
{
'mrcjkb/rustaceanvim',
version = '^6', -- Recommended
lazy = false, -- This plugin is already lazy
ft = "rust",
config = function()
-- Option A: use executable directly
local codelldb_path = vim.fn.exepath("codelldb")
-- Option B: manual path using $MASON
-- local mroot = vim.fn.expand("$MASON/packages/codelldb")
-- local codelldb_path = mroot .. "/extension/adapter/codelldb"
-- local liblldb_path = mroot .. "/extension/lldb/lib/liblldb.so"
local cfg = require("rustaceanvim.config")
vim.g.rustaceanvim = {
dap = {
adapter = cfg.get_codelldb_adapter(codelldb_path),
},
}
end
},
{
'rust-lang/rust.vim',
ft = "rust",
init = function ()
vim.g.rustfmt_autosave = 1
end
},
{
'mfussenegger/nvim-dap',
config = function()
require("configs.dap")
end,
},
{
'rcarriga/nvim-dap-ui',
dependencies = {"mfussenegger/nvim-dap", "nvim-neotest/nvim-nio"},
config = function()
require("dapui").setup()
end,
},
{
'saecki/crates.nvim',
ft = {"toml"},
config = function()
require("crates").setup {
completion = {
cmp = {
enabled = true
},
},
}
require('cmp').setup.buffer({
sources = { { name = "crates" }}
})
end
},
{
"3rd/image.nvim",
build = false, -- so that it doesn't build the rock https://github.com/3rd/image.nvim/issues/91#issuecomment-2453430239
lazy = false,
opts = {
processor = "magick_cli",
}
},
-- {
-- "nvim-treesitter/nvim-treesitter",
-- opts = {
-- ensure_installed = {
-- "vim", "lua", "vimdoc",
-- "html", "css"
-- },
-- },
-- },
}