Initial Commit - Add nvim config

Signed-off-by: Daniel Henry <iamdanhenry@gmail.com>
This commit is contained in:
2025-08-25 18:23:54 -05:00
commit 7a73f19921
10 changed files with 665 additions and 0 deletions

View File

@@ -0,0 +1,231 @@
-- All generic/global plugins live in this list.
return {
{
"rose-pine/neovim",
name = "rose-pine",
lazy = false, -- load at startup
priority = 1000, -- ensure theme loads before others
config = function()
require("rose-pine").setup({
-- Variants: "auto" | "main" | "moon" | "dawn"
variant = "auto",
styles = { transparency = false },
})
vim.cmd.colorscheme("rose-pine")
end,
},
-- Subtle indent guides
{
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
event = { "BufReadPost", "BufNewFile" },
opts = {
indent = { char = "", tab_char = "" }, -- faint vertical guides; theme controls color
scope = { enabled = false }, -- keep it subtle (no current-scope highlight)
exclude = {
filetypes = { "help", "neo-tree", "Trouble", "lazy", "mason", "dashboard" },
buftypes = { "terminal", "nofile", "quickfix", "prompt" },
},
},
},
-- Keybinding helper (shows hints as you type <leader>…)
{
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
plugins = { spelling = true },
win = { border = "rounded" },
delay = 300, -- ms before popup; tweak if it feels slow/fast
},
},
-- Statusline
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = {
options = {
theme = "rose-pine", -- or "auto"
icons_enabled = true,
globalstatus = true,
component_separators = { left = "", right = "" },
section_separators = { left = " ", right = " " },
},
},
},
-- File explorer (choose Neo-tree; single source of truth lives here)
{
"nvim-neo-tree/neo-tree.nvim",
cmd = "Neotree", -- lazy-load on command or the keymap below
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- optional, but nice
"MunifTanjim/nui.nvim",
},
opts = {
sources = { "filesystem", "buffers", "git_status" },
filesystem = {
follow_current_file = { enabled = true },
hijack_netrw_behavior = "open_default",
filtered_items = { hide_gitignored = false },
},
window = { width = 32 },
},
},
-- Telescope core
{
"nvim-telescope/telescope.nvim",
cmd = "Telescope", -- lazy-load on :Telescope (used by your keymaps)
dependencies = { "nvim-lua/plenary.nvim" },
opts = {
defaults = {
-- small QoL tweaks; change anytime
sorting_strategy = "ascending",
layout_config = { prompt_position = "top" },
mappings = { i = { ["<C-u>"] = false, ["<C-d>"] = false } },
},
pickers = {
find_files = { hidden = true }, -- show dotfiles; respects .gitignore
},
},
},
-- Faster sorting (native fzf) — optional but great
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
cond = function() return vim.fn.executable("make") == 1 end,
config = function()
pcall(function() require("telescope").load_extension("fzf") end)
end,
},
-- Nicer UI for vim.ui.select/inputs (optional)
{
"nvim-telescope/telescope-ui-select.nvim",
event = "VeryLazy",
config = function()
pcall(function() require("telescope").load_extension("ui-select") end)
end,
},
-- Completion engine
{
"hrsh7th/nvim-cmp",
event = "InsertEnter", -- load when you start typing
dependencies = {
"hrsh7th/cmp-nvim-lsp", -- LSP source for cmp
"saadparwaiz1/cmp_luasnip",
{
"L3MON4D3/LuaSnip", -- snippet engine (needed for LSP snippet expansion)
config = function()
pcall(require, "c.snippets")
end
}
},
opts = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
return {
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(), -- manually trigger
["<CR>"] = cmp.mapping.confirm({ select = false }), -- confirm selected (dont auto-pick)
["<C-e>"] = cmp.mapping.abort(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-p>"] = cmp.mapping.select_prev_item(),
["<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 = {
{ name = "nvim_lsp" }, -- LSP completions (clangd, etc.)
{ name = "luasnip" },
-- you can add { name = "path" }, { name = "buffer" } later if you want
},
}
end,
},
-- Auto-close (), {}, [], "", '' and more
{
"windwp/nvim-autopairs",
event = "InsertEnter",
opts = {
check_ts = true, -- respects treesitter contexts if you have it
disable_filetype = { "TelescopePrompt", "neo-tree" },
fast_wrap = {}, -- enables <M-e> fast wrap (optional)
},
config = function(_, opts)
local npairs = require("nvim-autopairs")
npairs.setup(opts)
-- Integrate with nvim-cmp so confirming a function adds () and places cursor inside
local ok_cmp, cmp = pcall(require, "cmp")
if ok_cmp then
local cmp_ap = require("nvim-autopairs.completion.cmp")
cmp.event:on("confirm_done", cmp_ap.on_confirm_done())
end
-- OPTIONAL (C quality-of-life):
-- Pair < > only when typing #include <...>
-- (By default, we *don't* pair < > in C to avoid accidental inserts.)
local Rule = require("nvim-autopairs.rule")
npairs.add_rules({
Rule("<", ">", "c")
:with_pair(function(ctx)
local line = ctx.line:sub(1, ctx.col - 1)
return line:match("^%s*#%s*include%s*$") ~= nil
end),
})
end,
},
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = { "BufReadPre", "BufNewFile" },
opts = {
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "bash", "make" },
highlight = { enable = true },
indent = { enable = false }, -- keep off; clang-format handles indent on save
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn", -- start selection
node_incremental = "grn", -- grow to next node
node_decremental = "grm", -- shrink
scope_incremental = "grc", -- grow to scope
},
},
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
end,
},
{ "folke/trouble.nvim", cmd = { "Trouble", "TroubleToggle" }, opts = {} }
}