add neovim config

This commit is contained in:
vogonwann 2026-02-06 09:15:12 +01:00
commit a61afa3889
25 changed files with 1269 additions and 0 deletions

View File

@ -0,0 +1,11 @@
-- English comments only.
local ok, animate = pcall(require, "mini.animate")
if not ok then return end
animate.setup({
-- Keep it subtle: enable cursor + scroll, disable resize/open/close if you want less motion
resize = { enable = false },
open = { enable = false },
close = { enable = false },
})

View File

@ -0,0 +1,21 @@
-- English comments only.
local ok, bufferline = pcall(require, "bufferline")
if not ok then return end
bufferline.setup({
options = {
diagnostics = "nvim_lsp",
show_buffer_close_icons = true,
show_close_icon = false,
separator_style = "slant",
offsets = {
{
filetype = "NvimTree",
text = "File Explorer",
text_align = "left",
separator = true,
},
},
},
})

View File

@ -0,0 +1,51 @@
-- English comments only.
local ok, chatgpt = pcall(require, "chatgpt")
if not ok then return end
chatgpt.setup({
-- Personality + language
system_prompt = [[
You are Burke, a senior software engineer and pragmatic coding assistant.
Always respond in Serbian (Cyrillic).
Be concise, direct, and practical.
If the user is casual or jokes, respond casually.
If the user asks about code, focus on actionable solutions, not theory.
When unsure, ask a short clarifying question.
]],
-- Model choice: smart but not insane on cost
openai_params = {
model = "gpt-4.1",
max_tokens = 4096,
temperature = 0.4,
top_p = 1,
frequency_penalty = 0,
presence_penalty = 0,
},
-- UI / UX
popup_layout = {
default = "center",
center = {
width = "82%",
height = "82%",
},
},
-- Terminal-safe keymaps
keymaps = {
close = { "<Esc>" },
submit = "<C-Enter>",
},
-- Small quality-of-life tweaks
yank_register = "+",
edit_with_instructions = {
diff = true, -- show diff when modifying code
keymaps = {
accept = "<C-y>",
reject = "<C-n>",
},
},
})

View File

@ -0,0 +1,50 @@
-- English comments only.
local ok_cmp, cmp = pcall(require, "cmp")
if not ok_cmp then
return
end
local ok_snip, luasnip = pcall(require, "luasnip")
if not ok_snip then
return
end
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<C-Space>"] = cmp.mapping.complete(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
}),
})

View File

@ -0,0 +1,80 @@
-- English comments only.
local ok_dap, dap = pcall(require, "dap")
if not ok_dap then return end
local ok_dapui, dapui = pcall(require, "dapui")
if not ok_dapui then return end
dapui.setup({
layouts = {
{
elements = {
{ id = "scopes", size = 0.35 },
{ id = "breakpoints", size = 0.20 },
{ id = "stacks", size = 0.25 },
{ id = "watches", size = 0.20 },
},
position = "left",
size = 45,
},
{
elements = {
{ id = "repl", size = 0.50 },
{ id = "console", size = 0.50 },
},
position = "bottom",
size = 12,
},
},
})
-- Auto open/close dapui
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
-- Visible signs in gutter
vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticError" })
vim.fn.sign_define("DapBreakpointCondition", { text = "", texthl = "DiagnosticWarn" })
vim.fn.sign_define("DapLogPoint", { text = "", texthl = "DiagnosticInfo" })
vim.fn.sign_define("DapStopped", { text = "", texthl = "DiagnosticOk" })
-- Keymaps
vim.keymap.set("n", "<F5>", dap.continue, { desc = "DAP continue" })
vim.keymap.set("n", "<F10>", dap.step_over, { desc = "DAP step over" })
vim.keymap.set("n", "<F11>", dap.step_into, { desc = "DAP step into" })
vim.keymap.set("n", "<F12>", dap.step_out, { desc = "DAP step out" })
vim.keymap.set("n", "<leader>db", dap.toggle_breakpoint, { desc = "DAP toggle breakpoint" })
vim.keymap.set("n", "<leader>dB", function()
dap.set_breakpoint(vim.fn.input("Breakpoint condition: "))
end, { desc = "DAP conditional breakpoint" })
vim.keymap.set("n", "<leader>dc", dap.clear_breakpoints, { desc = "DAP clear breakpoints" })
vim.keymap.set("n", "<leader>dl", function()
dap.run_last()
end, { desc = "DAP run last" })
vim.keymap.set("n", "<leader>dr", dap.repl.open, { desc = "DAP REPL" })
vim.keymap.set("n", "<leader>du", dapui.toggle, { desc = "DAP UI toggle" })
-- Evaluate helpers
vim.keymap.set("n", "<leader>de", function()
dapui.eval()
end, { desc = "DAP eval under cursor" })
vim.keymap.set("v", "<leader>de", function()
dapui.eval()
end, { desc = "DAP eval selection" })
-- Optional: hover to eval during debug (nice IDE behavior)
vim.keymap.set("n", "<leader>dh", function()
dapui.eval()
end, { desc = "DAP hover eval" })

View File

@ -0,0 +1,19 @@
-- English comments only.
local ok, db = pcall(require, "dashboard")
if not ok then return end
db.setup({
theme = "hyper",
config = {
week_header = { enable = true },
shortcut = {
{ desc = "Files", group = "Label", key = "f", action = "Telescope find_files" },
{ desc = "Grep", group = "Label", key = "g", action = "Telescope live_grep" },
{ desc = "Config", group = "Label", key = "c", action = "edit ~/.config/nvim/init.lua" },
{ desc = "Quit", group = "Label", key = "q", action = "qa" },
},
project = { enable = true, limit = 8 },
mru = { limit = 10 },
},
})

View File

@ -0,0 +1,9 @@
-- English comments only.
local ok, dressing = pcall(require, "dressing")
if not ok then return end
dressing.setup({
input = { border = "rounded" },
select = { backend = { "telescope", "builtin" } },
})

View File

@ -0,0 +1,43 @@
-- English comments only.
local function set_hl(group, opts)
vim.api.nvim_set_hl(0, group, opts)
end
local ok, tn = pcall(require, "tokyonight.colors")
if not ok then
-- Fallback links
set_hl("NvimTreeGitDirty", { link = "DiagnosticWarn" })
set_hl("NvimTreeGitNew", { link = "DiagnosticHint" })
set_hl("NvimTreeGitStaged", { link = "DiagnosticOk" })
set_hl("NvimTreeGitDeleted", { link = "DiagnosticError" })
set_hl("NvimTreeGitRenamed", { link = "DiagnosticInfo" })
set_hl("NvimTreeGitIgnored", { link = "Comment" })
set_hl("GitSignsAdd", { link = "DiagnosticOk" })
set_hl("GitSignsChange", { link = "DiagnosticWarn" })
set_hl("GitSignsDelete", { link = "DiagnosticError" })
return
end
local c = tn.setup()
-- Nvim-tree git highlights (strong + readable)
set_hl("NvimTreeGitDirty", { fg = c.yellow, bold = true }) -- modified
set_hl("NvimTreeGitNew", { fg = c.green, bold = true }) -- untracked/new
set_hl("NvimTreeGitStaged", { fg = c.green, bold = true }) -- staged
set_hl("NvimTreeGitDeleted", { fg = c.red, bold = true }) -- deleted
set_hl("NvimTreeGitRenamed", { fg = c.blue, bold = true, italic = true }) -- renamed
set_hl("NvimTreeGitMerged", { fg = c.magenta, bold = true, italic = true }) -- merged/unmerged flavor
-- Ignored: dim / almost invisible
-- blend makes it translucent (works best in GUIs/truecolor terminals)
set_hl("NvimTreeGitIgnored", { fg = c.comment, italic = true, blend = 70 })
-- GitSigns gutter to match (clean VS vibe)
set_hl("GitSignsAdd", { fg = c.green, bold = true })
set_hl("GitSignsChange", { fg = c.yellow, bold = true })
set_hl("GitSignsDelete", { fg = c.red, bold = true })
-- Also make blame text subtle if you enabled it
set_hl("GitSignsCurrentLineBlame", { fg = c.comment, italic = true })

View File

@ -0,0 +1,10 @@
-- English comments only.
local ok, gitsigns = pcall(require, "gitsigns")
if not ok then return end
gitsigns.setup({
signcolumn = true,
current_line_blame = true,
current_line_blame_opts = { delay = 500 },
})

View File

@ -0,0 +1,9 @@
-- English comments only.
local ok, ibl = pcall(require, "ibl")
if not ok then return end
ibl.setup({
indent = { char = "" },
scope = { enabled = true },
})

View File

@ -0,0 +1,14 @@
-- English comments only.
local ok, lualine = pcall(require, "lualine")
if not ok then return end
lualine.setup({
options = {
theme = "tokyonight",
icons_enabled = true,
section_separators = { left = "", right = "" },
component_separators = { left = "", right = "" },
globalstatus = true,
},
})

View File

@ -0,0 +1,11 @@
-- English comments only.
local ok, neoscroll = pcall(require, "neoscroll")
if not ok then return end
neoscroll.setup({
mappings = { "<C-u>", "<C-d>", "<C-b>", "<C-f>", "zt", "zz", "zb" },
hide_cursor = true,
stop_eof = true,
respect_scrolloff = true,
})

View File

@ -0,0 +1,53 @@
-- English comments only.
local ok_notify, notify = pcall(require, "notify")
if ok_notify then
notify.setup({
stages = "fade_in_slide_out",
timeout = 2000,
render = "wrapped-compact",
})
vim.notify = notify
end
local ok_noice, noice = pcall(require, "noice")
if not ok_noice then return end
noice.setup({
presets = {
bottom_search = true,
command_palette = true,
long_message_to_split = true,
inc_rename = false,
lsp_doc_border = true,
},
cmdline = {
enabled = true,
view = "cmdline_popup",
format = {
-- Force / to use the popup view
search_down = {
kind = "search",
pattern = "^/",
icon = " ",
lang = "regex",
view = "cmdline_popup",
},
-- Force ? to use the popup view as well
search_up = {
kind = "search",
pattern = "^%?",
icon = " ",
lang = "regex",
view = "cmdline_popup",
},
},
},
lsp = {
progress = { enabled = true },
hover = { enabled = true },
signature = { enabled = true },
},
})

View File

@ -0,0 +1,59 @@
-- English comments only.
local ok, nvimtree = pcall(require, "nvim-tree")
if not ok then
return
end
nvimtree.setup({
disable_netrw = true,
hijack_netrw = true,
view = {
width = 32,
side = "left",
preserve_window_proportions = true
},
renderer = {
root_folder_label = false,
highlight_git = true,
highlight_opened_files = "name",
icons = {
show = {
file = true,
folder = true,
folder_arrow = true,
git = true
},
glyphs = {
git = {
unstaged = "", -- modified
staged = "",
untracked = "",
renamed = "",
deleted = "",
ignored = "",
unmerged = ""
}
}
}
},
git = {
enable = true,
ignore = false,
show_on_dirs = true,
show_on_open_dirs = true
},
filters = {
dotfiles = false
},
actions = {
open_file = {
quit_on_open = false, -- keep tree open like VS Code
resize_window = true
}
}
})

View File

@ -0,0 +1,18 @@
-- English comments only.
vim.opt.termguicolors = true
-- TokyoNight config
require("tokyonight").setup({
style = "night",
transparent = false,
terminal_colors = true,
styles = {
comments = { italic = true },
keywords = { italic = false },
functions = {},
variables = {},
},
})
vim.cmd.colorscheme("tokyonight")

View File

@ -0,0 +1,51 @@
-- English comments only.
local ok, toggleterm = pcall(require, "toggleterm")
if not ok then
return
end
toggleterm.setup({
open_mapping = [[<c-\>]], -- Ctrl + \
direction = "float", -- "horizontal" | "vertical" | "tab" | "float"
close_on_exit = true,
start_in_insert = true,
shade_terminals = true,
float_opts = {
border = "rounded",
},
})
-- Terminal mode keymaps (quality of life)
function _G.set_terminal_keymaps()
local opts = { buffer = 0, silent = true }
-- Exit terminal insert mode
vim.keymap.set("t", "<Esc>", [[<C-\><C-n>]], opts)
-- Navigate windows from terminal
vim.keymap.set("t", "<C-h>", [[<C-\><C-n><C-w>h]], opts)
vim.keymap.set("t", "<C-j>", [[<C-\><C-n><C-w>j]], opts)
vim.keymap.set("t", "<C-k>", [[<C-\><C-n><C-w>k]], opts)
vim.keymap.set("t", "<C-l>", [[<C-\><C-n><C-w>l]], opts)
end
vim.cmd([[autocmd! TermOpen term://* lua set_terminal_keymaps()]])
-- LazyGit terminal
local ok_term, Term = pcall(require, "toggleterm.terminal")
if not ok_term then
return
end
local lazygit = Term.Terminal:new({
cmd = "lazygit",
hidden = true,
direction = "float",
float_opts = { border = "rounded" },
})
function _G.LazygitToggle()
lazygit:toggle()
end
vim.keymap.set("n", "<leader>gg", "<cmd>lua LazygitToggle()<CR>", { silent = true, desc = "LazyGit" })

View File

@ -0,0 +1,12 @@
-- English comments only.
local ok, configs = pcall(require, "nvim-treesitter.configs")
if not ok then
return
end
configs.setup({
ensure_installed = { "lua", "vim", "vimdoc", "rust", "toml", "json" },
highlight = { enable = true },
indent = { enable = true },
})

View File

@ -0,0 +1,9 @@
-- English comments only.
local ok, wk = pcall(require, "which-key")
if not ok then return end
wk.setup({
plugins = { spelling = true },
window = { border = "rounded" },
})

39
dot_config/nvim/init.lua Normal file
View File

@ -0,0 +1,39 @@
-- English comments only.
-- Bootstrap packer.nvim if not installed
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({
"git",
"clone",
"--depth",
"1",
"https://github.com/wbthomason/packer.nvim",
install_path,
})
vim.cmd("packadd packer.nvim")
return true
end
return false
end
local packer_bootstrap = ensure_packer()
-- Load core config
require("core.options")
require("core.keymaps")
require("core.lsp")
require("lang.rust")
-- Load plugins (packer startup)
require("plugins")
-- If packer was just installed, sync plugins once
if packer_bootstrap then
require("packer").sync()
end

View File

@ -0,0 +1,66 @@
-- English comments only.
vim.g.mapleader = " "
vim.g.maplocalleader = " "
local keymap = vim.keymap.set
local opts = { silent = true }
-- Basic
keymap("n", "<leader>w", ":w<CR>", opts)
keymap("n", "<leader>q", ":q<CR>", opts)
-- Better window navigation
keymap("n", "<C-h>", "<C-w>h", opts)
keymap("n", "<C-j>", "<C-w>j", opts)
keymap("n", "<C-k>", "<C-w>k", opts)
keymap("n", "<C-l>", "<C-w>l", opts)
-- Resize splits
keymap("n", "<C-Up>", ":resize -2<CR>", opts)
keymap("n", "<C-Down>", ":resize +2<CR>", opts)
keymap("n", "<C-Left>", ":vertical resize -2<CR>", opts)
keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts)
-- Clear search highlight
keymap("n", "<leader>h", ":nohlsearch<CR>", opts)
-- Telescope
keymap("n", "<leader>ff", "<cmd>Telescope find_files<CR>", opts)
keymap("n", "<leader>fg", "<cmd>Telescope live_grep<CR>", opts)
keymap("n", "<leader>fb", "<cmd>Telescope buffers<CR>", opts)
keymap("n", "<leader>fh", "<cmd>Telescope help_tags<CR>", opts)
-- Trouble
keymap("n", "<leader>xx", "<cmd>TroubleToggle<CR>", opts)
vim.keymap.set("n", "<S-l>", ":BufferLineCycleNext<CR>", { silent = true, desc = "Next buffer" })
vim.keymap.set("n", "<S-h>", ":BufferLineCyclePrev<CR>", { silent = true, desc = "Prev buffer" })
vim.keymap.set("n", "<leader>bd", ":bdelete<CR>", { silent = true, desc = "Delete buffer" })
-- English comments only.
local tb = require("telescope.builtin")
-- LSP via Telescope (IDE-like)
vim.keymap.set("n", "<leader>gd", tb.lsp_definitions, { silent = true, desc = "LSP definitions" })
vim.keymap.set("n", "<leader>gr", tb.lsp_references, { silent = true, desc = "LSP references" })
vim.keymap.set("n", "<leader>gi", tb.lsp_implementations, { silent = true, desc = "LSP implementations" })
vim.keymap.set("n", "<leader>gt", tb.lsp_type_definitions, { silent = true, desc = "LSP type definitions" })
vim.keymap.set("n", "<leader>ss", tb.lsp_document_symbols, { silent = true, desc = "Document symbols" })
vim.keymap.set("n", "<leader>sS", tb.lsp_workspace_symbols, { silent = true, desc = "Workspace symbols" })
vim.keymap.set("n", "<leader>sd", tb.diagnostics, { silent = true, desc = "Diagnostics (Telescope)" })
-- ChatGPT
vim.keymap.set("n", "<leader>cc", "<cmd>ChatGPT<CR>", { desc = "ChatGPT" })
vim.keymap.set("n", "<leader>ce", "<cmd>ChatGPTExplain<CR>", { desc = "Explain code" })
vim.keymap.set("n", "<leader>cf", "<cmd>ChatGPTFix<CR>", { desc = "Fix code" })
vim.keymap.set("n", "<leader>co", "<cmd>ChatGPTOptimize<CR>", { desc = "Optimize code" })
vim.keymap.set("n", "<leader>ct", "<cmd>ChatGPTTests<CR>", { desc = "Generate tests" })
vim.keymap.set("v", "<leader>ce", "<cmd>ChatGPTExplain<CR>", { desc = "Explain selection" })
vim.keymap.set("v", "<leader>cf", "<cmd>ChatGPTFix<CR>", { desc = "Fix selection" })
vim.keymap.set("v", "<leader>co", "<cmd>ChatGPTOptimize<CR>", { desc = "Optimize selection" })

View File

@ -0,0 +1,67 @@
-- English comments only.
-- LSP capabilities for completion
local capabilities = require("cmp_nvim_lsp").default_capabilities()
-- Shared on_attach (LSP keymaps)
local on_attach = function(_, bufnr)
local opts = {
buffer = bufnr,
silent = true
}
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "<leader>ds", vim.lsp.buf.document_symbol, opts)
vim.keymap.set("n", "<leader>ws", vim.lsp.buf.workspace_symbol, opts)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, opts)
vim.keymap.set("n", "<leader>dl", vim.diagnostic.setloclist, opts)
vim.keymap.set("n", "<leader>f", function()
vim.lsp.buf.format({
async = true
})
end, opts)
end
-- Better diagnostics UI defaults
vim.diagnostic.config({
virtual_text = true,
signs = true,
underline = true,
update_in_insert = false,
severity_sort = true,
float = {
border = "rounded"
}
})
-- Neovim 0.11+ API: configure + enable
-- See :help lspconfig-nvim-0.11
vim.lsp.config("rust_analyzer", {
capabilities = capabilities,
on_attach = on_attach,
settings = {
["rust-analyzer"] = {
checkOnSave = true,
check = {
command = "clippy"
},
cargo = {
allFeatures = true
}
}
}
})
vim.lsp.enable({"rust_analyzer"})

View File

@ -0,0 +1,45 @@
-- English comments only.
local opt = vim.opt
-- General
opt.encoding = "utf-8"
opt.mouse = "a"
opt.clipboard = "unnamedplus"
opt.swapfile = false
opt.backup = false
opt.undofile = true
opt.hidden = true
-- UI
opt.number = true
opt.relativenumber = true
opt.cursorline = true
opt.termguicolors = true
opt.signcolumn = "yes"
opt.wrap = false
opt.scrolloff = 8
opt.sidescrolloff = 8
-- Splits
opt.splitbelow = true
opt.splitright = true
-- Tabs / Indent
opt.expandtab = true
opt.tabstop = 2
opt.shiftwidth = 2
opt.smartindent = true
-- Search
opt.ignorecase = true
opt.smartcase = true
opt.incsearch = true
opt.hlsearch = false
-- Performance
opt.updatetime = 300
opt.timeoutlen = 500
-- Better completion menu
opt.completeopt = { "menu", "menuone", "noselect" }

View File

@ -0,0 +1,101 @@
-- English comments only.
-- =========================
-- Formatting (Conform)
-- =========================
local ok_conform, conform = pcall(require, "conform")
if ok_conform then
conform.setup({
formatters_by_ft = {
rust = { "rustfmt" },
},
format_on_save = function(_)
return { timeout_ms = 2000, lsp_fallback = true }
end,
})
end
vim.keymap.set("n", "<leader>rf", function()
if ok_conform then
conform.format({ timeout_ms = 2000, lsp_fallback = true })
else
vim.lsp.buf.format({ async = true })
end
end, { desc = "Rust format" })
-- =========================
-- Cargo -> Quickfix
-- =========================
local function cargo_to_quickfix(cmd)
local output = vim.fn.systemlist(cmd)
vim.fn.setqflist({}, " ", { title = cmd, lines = output })
vim.cmd("copen")
end
vim.keymap.set("n", "<leader>rr", function() cargo_to_quickfix("cargo run") end, { desc = "Cargo run (quickfix)" })
vim.keymap.set("n", "<leader>rt", function() cargo_to_quickfix("cargo test") end, { desc = "Cargo test (quickfix)" })
vim.keymap.set("n", "<leader>rc", function() cargo_to_quickfix("cargo check") end, { desc = "Cargo check (quickfix)" })
vim.keymap.set("n", "<leader>rl", function() cargo_to_quickfix("cargo clippy") end, { desc = "Cargo clippy (quickfix)" })
vim.keymap.set("n", "<leader>rb", function() cargo_to_quickfix("cargo build") end, { desc = "Cargo build (quickfix)" })
-- =========================
-- DAP (Rust adapter + configurations)
-- =========================
local ok_dap, dap = pcall(require, "dap")
if not ok_dap then
return
end
local function rust_default_binary()
-- Try to read package name from Cargo.toml (common single-crate case).
local cargo_toml = vim.fn.getcwd() .. "/Cargo.toml"
if vim.fn.filereadable(cargo_toml) == 1 then
for _, line in ipairs(vim.fn.readfile(cargo_toml)) do
local name = line:match('^name%s*=%s*"(.-)"')
if name then
return vim.fn.getcwd() .. "/target/debug/" .. name
end
end
end
return vim.fn.getcwd() .. "/target/debug/"
end
-- codelldb adapter (installed via Mason)
local mason_path = vim.fn.stdpath("data") .. "/mason"
local codelldb_path = mason_path .. "/packages/codelldb/extension/adapter/codelldb"
dap.adapters.codelldb = {
type = "server",
port = "${port}",
executable = {
command = codelldb_path,
args = { "--port", "${port}" },
},
}
dap.configurations.rust = {
{
name = "Debug (default binary)",
type = "codelldb",
request = "launch",
program = function()
local default_path = rust_default_binary()
return vim.fn.input("Path to executable: ", default_path, "file")
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
},
{
name = "Debug tests (cargo test)",
type = "codelldb",
request = "launch",
-- This runs the test binary; you'll pick it once, then you can use <leader>dl (run last).
program = function()
-- Tip: run `cargo test --no-run` once, then pick the produced test binary.
local default_path = vim.fn.getcwd() .. "/target/debug/deps/"
return vim.fn.input("Path to test executable: ", default_path, "file")
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
},
}

View File

@ -0,0 +1,129 @@
-- English comments only.
vim.cmd([[packadd packer.nvim]])
return require("packer").startup(function(use)
-- Packer can manage itself
use("wbthomason/packer.nvim")
-- LSP
use("neovim/nvim-lspconfig")
-- Mason (LSP/DAP/formatters installer)
use({
"williamboman/mason.nvim",
config = function()
require("mason").setup()
end
})
use({
"williamboman/mason-lspconfig.nvim",
after = "mason.nvim",
config = function()
require("mason-lspconfig").setup({
ensure_installed = {"rust_analyzer" -- Add more later: "ts_ls", "gopls", "pyright", ...
},
automatic_installation = true
})
end
})
-- Autocomplete
use("hrsh7th/nvim-cmp")
use("hrsh7th/cmp-nvim-lsp")
use("L3MON4D3/LuaSnip")
-- Treesitter
use({
"nvim-treesitter/nvim-treesitter",
run = function()
pcall(vim.cmd, "TSUpdate")
end
})
-- Telescope
use({
"nvim-telescope/telescope.nvim",
requires = {"nvim-lua/plenary.nvim"},
config = function()
require("telescope").setup({})
end
})
-- Trouble (diagnostics list)
use({
"folke/trouble.nvim",
requires = {"nvim-tree/nvim-web-devicons"},
config = function()
require("trouble").setup({})
end
})
-- Formatting (conform)
use({"stevearc/conform.nvim"})
-- Debugging
-- Debugging
use("mfussenegger/nvim-dap")
use({
"rcarriga/nvim-dap-ui",
requires = {"mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" -- REQUIRED dependency
},
config = function()
require("dapui").setup()
end
})
-- Optional icons (used by trouble/telescope)
use("nvim-tree/nvim-web-devicons")
-- Eye candy
use("folke/tokyonight.nvim")
use("nvim-lualine/lualine.nvim")
use("lewis6991/gitsigns.nvim")
use("lukas-reineke/indent-blankline.nvim")
use("stevearc/dressing.nvim")
use({
"akinsho/bufferline.nvim",
tag = "*",
requires = {"nvim-tree/nvim-web-devicons"}
})
use("MunifTanjim/nui.nvim")
use({"rcarriga/nvim-notify"})
use({
"folke/noice.nvim",
requires = {"MunifTanjim/nui.nvim", "rcarriga/nvim-notify"}
})
use({
"nvimdev/dashboard-nvim",
requires = {"nvim-tree/nvim-web-devicons"}
})
use("folke/which-key.nvim")
use("karb94/neoscroll.nvim")
use("echasnovski/mini.animate")
use({
"nvim-tree/nvim-tree.lua",
requires = {"nvim-tree/nvim-web-devicons"}
})
use({
"akinsho/toggleterm.nvim",
tag = "*"
})
use({
"jackMort/ChatGPT.nvim",
requires = {"MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim"}
})
use("github/copilot.vim")
end)

View File

@ -0,0 +1,292 @@
-- Automatically generated packer.nvim plugin loader code
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
return
end
vim.api.nvim_command('packadd packer.nvim')
local no_errors, error_msg = pcall(function()
_G._packer = _G._packer or {}
_G._packer.inside_compile = true
local time
local profile_info
local should_profile = false
if should_profile then
local hrtime = vim.loop.hrtime
profile_info = {}
time = function(chunk, start)
if start then
profile_info[chunk] = hrtime()
else
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
end
end
else
time = function(chunk, start) end
end
local function save_profiles(threshold)
local sorted_times = {}
for chunk_name, time_taken in pairs(profile_info) do
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
end
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
local results = {}
for i, elem in ipairs(sorted_times) do
if not threshold or threshold and elem[2] > threshold then
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
end
end
if threshold then
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
end
_G._packer.profile_output = results
end
time([[Luarocks path setup]], true)
local package_path_str = "/home/wann/.cache/nvim/packer_hererocks/2.1.1767980792/share/lua/5.1/?.lua;/home/wann/.cache/nvim/packer_hererocks/2.1.1767980792/share/lua/5.1/?/init.lua;/home/wann/.cache/nvim/packer_hererocks/2.1.1767980792/lib/luarocks/rocks-5.1/?.lua;/home/wann/.cache/nvim/packer_hererocks/2.1.1767980792/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/wann/.cache/nvim/packer_hererocks/2.1.1767980792/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
end
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
package.cpath = package.cpath .. ';' .. install_cpath_pattern
end
time([[Luarocks path setup]], false)
time([[try_loadstring definition]], true)
local function try_loadstring(s, component, name)
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
if not success then
vim.schedule(function()
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
end)
end
return result
end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
["ChatGPT.nvim"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/ChatGPT.nvim",
url = "https://github.com/jackMort/ChatGPT.nvim"
},
LuaSnip = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/LuaSnip",
url = "https://github.com/L3MON4D3/LuaSnip"
},
["bufferline.nvim"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/bufferline.nvim",
url = "https://github.com/akinsho/bufferline.nvim"
},
["cmp-nvim-lsp"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
},
["conform.nvim"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/conform.nvim",
url = "https://github.com/stevearc/conform.nvim"
},
["copilot.vim"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/copilot.vim",
url = "https://github.com/github/copilot.vim"
},
["dashboard-nvim"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/dashboard-nvim",
url = "https://github.com/nvimdev/dashboard-nvim"
},
["dressing.nvim"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/dressing.nvim",
url = "https://github.com/stevearc/dressing.nvim"
},
["gitsigns.nvim"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
url = "https://github.com/lewis6991/gitsigns.nvim"
},
["indent-blankline.nvim"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim",
url = "https://github.com/lukas-reineke/indent-blankline.nvim"
},
["lualine.nvim"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/lualine.nvim",
url = "https://github.com/nvim-lualine/lualine.nvim"
},
["mason-lspconfig.nvim"] = {
config = { "\27LJ\2\n\1\0\0\4\0\6\0\t6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\2B\0\2\1K\0\1\0\21ensure_installed\1\0\2\27automatic_installation\2\21ensure_installed\0\1\2\0\0\18rust_analyzer\nsetup\20mason-lspconfig\frequire\0" },
load_after = {},
loaded = true,
needs_bufread = false,
path = "/home/wann/.local/share/nvim/site/pack/packer/opt/mason-lspconfig.nvim",
url = "https://github.com/williamboman/mason-lspconfig.nvim"
},
["mason.nvim"] = {
after = { "mason-lspconfig.nvim" },
config = { "\27LJ\2\n3\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\nmason\frequire\0" },
loaded = true,
only_config = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/mason.nvim",
url = "https://github.com/williamboman/mason.nvim"
},
["mini.animate"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/mini.animate",
url = "https://github.com/echasnovski/mini.animate"
},
["neoscroll.nvim"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/neoscroll.nvim",
url = "https://github.com/karb94/neoscroll.nvim"
},
["noice.nvim"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/noice.nvim",
url = "https://github.com/folke/noice.nvim"
},
["nui.nvim"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/nui.nvim",
url = "https://github.com/MunifTanjim/nui.nvim"
},
["nvim-cmp"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp"
},
["nvim-dap"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/nvim-dap",
url = "https://github.com/mfussenegger/nvim-dap"
},
["nvim-dap-ui"] = {
config = { "\27LJ\2\n3\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\ndapui\frequire\0" },
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/nvim-dap-ui",
url = "https://github.com/rcarriga/nvim-dap-ui"
},
["nvim-lspconfig"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig"
},
["nvim-nio"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/nvim-nio",
url = "https://github.com/nvim-neotest/nvim-nio"
},
["nvim-notify"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/nvim-notify",
url = "https://github.com/rcarriga/nvim-notify"
},
["nvim-tree.lua"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
url = "https://github.com/nvim-tree/nvim-tree.lua"
},
["nvim-treesitter"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
url = "https://github.com/nvim-treesitter/nvim-treesitter"
},
["nvim-web-devicons"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
url = "https://github.com/nvim-tree/nvim-web-devicons"
},
["packer.nvim"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/packer.nvim",
url = "https://github.com/wbthomason/packer.nvim"
},
["plenary.nvim"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/plenary.nvim",
url = "https://github.com/nvim-lua/plenary.nvim"
},
["telescope.nvim"] = {
config = { "\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14telescope\frequire\0" },
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/telescope.nvim",
url = "https://github.com/nvim-telescope/telescope.nvim"
},
["toggleterm.nvim"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/toggleterm.nvim",
url = "https://github.com/akinsho/toggleterm.nvim"
},
["tokyonight.nvim"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/tokyonight.nvim",
url = "https://github.com/folke/tokyonight.nvim"
},
["trouble.nvim"] = {
config = { "\27LJ\2\n9\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\ftrouble\frequire\0" },
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/trouble.nvim",
url = "https://github.com/folke/trouble.nvim"
},
["which-key.nvim"] = {
loaded = true,
path = "/home/wann/.local/share/nvim/site/pack/packer/start/which-key.nvim",
url = "https://github.com/folke/which-key.nvim"
}
}
time([[Defining packer_plugins]], false)
-- Config for: telescope.nvim
time([[Config for telescope.nvim]], true)
try_loadstring("\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14telescope\frequire\0", "config", "telescope.nvim")
time([[Config for telescope.nvim]], false)
-- Config for: nvim-dap-ui
time([[Config for nvim-dap-ui]], true)
try_loadstring("\27LJ\2\n3\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\ndapui\frequire\0", "config", "nvim-dap-ui")
time([[Config for nvim-dap-ui]], false)
-- Config for: mason.nvim
time([[Config for mason.nvim]], true)
try_loadstring("\27LJ\2\n3\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\nmason\frequire\0", "config", "mason.nvim")
time([[Config for mason.nvim]], false)
-- Config for: trouble.nvim
time([[Config for trouble.nvim]], true)
try_loadstring("\27LJ\2\n9\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\ftrouble\frequire\0", "config", "trouble.nvim")
time([[Config for trouble.nvim]], false)
-- Load plugins in order defined by `after`
time([[Sequenced loading]], true)
vim.cmd [[ packadd mason-lspconfig.nvim ]]
-- Config for: mason-lspconfig.nvim
try_loadstring("\27LJ\2\n\1\0\0\4\0\6\0\t6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\2B\0\2\1K\0\1\0\21ensure_installed\1\0\2\27automatic_installation\2\21ensure_installed\0\1\2\0\0\18rust_analyzer\nsetup\20mason-lspconfig\frequire\0", "config", "mason-lspconfig.nvim")
time([[Sequenced loading]], false)
_G._packer.inside_compile = false
if _G._packer.needs_bufread == true then
vim.cmd("doautocmd BufRead")
end
_G._packer.needs_bufread = false
if should_profile then save_profiles() end
end)
if not no_errors then
error_msg = error_msg:gsub('"', '\\"')
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
end