first commit

This commit is contained in:
Matt Anderson
2026-03-28 10:40:48 -05:00
commit 605c99bc01
36 changed files with 14317 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
require('plugins')
require('lsp')
require('settings')
require('maps')
require('line')

View File

@@ -0,0 +1,30 @@
{
"CopilotChat.nvim": { "branch": "main", "commit": "743d6005fb412c85309d3f3aa45f18f3a2fb2098" },
"LuaSnip": { "branch": "master", "commit": "1f4ad8bb72bdeb60975e98652636b991a9b7475d" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
"copilot.vim": { "branch": "release", "commit": "a12fd5672110c8aa7e3c8419e28c96943ca179be" },
"formatter.nvim": { "branch": "master", "commit": "b9d7f853da1197b83b8edb4cc4952f7ad3a42e41" },
"gitsigns.nvim": { "branch": "main", "commit": "9f3c6dd7868bcc116e9c1c1929ce063b978fa519" },
"headlines.nvim": { "branch": "master", "commit": "bf17c96a836ea27c0a7a2650ba385a7783ed322e" },
"helm-ls.nvim": { "branch": "main", "commit": "f0b9a1723890971a6d84890b50dbf5f40974ea1b" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"leetcode.nvim": { "branch": "master", "commit": "fdd3f91800b3983e27bc9fcfb99cfa7293d7f11a" },
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
"nnn.nvim": { "branch": "master", "commit": "efe690293eee87558f034a83ed96157e52639cdb" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" },
"nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" },
"nvim-dap": { "branch": "master", "commit": "b516f20b487b0ac6a281e376dfac1d16b5040041" },
"nvim-dap-go": { "branch": "main", "commit": "b4421153ead5d726603b02743ea40cf26a51ed5f" },
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
"nvim-lspconfig": { "branch": "master", "commit": "ead0f5f342d8d323441e7d4b88f0fc436a81ad5f" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-tree.lua": { "branch": "master", "commit": "c8d8d515c29f0f0b1a352e0d75616f74f42fc03b" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"orgmode": { "branch": "master", "commit": "f3ea61f6d71486c9062d40efe3c882050758e9b3" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "5255aa27c422de944791318024167ad5d40aad20" },
"zen-mode.nvim": { "branch": "main", "commit": "8564ce6d29ec7554eb9df578efa882d33b3c23a7" }
}

View File

@@ -0,0 +1,30 @@
-- 1) define a global helper to fetch counts
function _G.lsp_diag_status()
local buf = 0 -- current buffer
local errs = #vim.diagnostic.get(buf, { severity = vim.diagnostic.severity.ERROR })
local warns = #vim.diagnostic.get(buf, { severity = vim.diagnostic.severity.WARN })
local infos = #vim.diagnostic.get(buf, { severity = vim.diagnostic.severity.INFO })
local hints = #vim.diagnostic.get(buf, { severity = vim.diagnostic.severity.HINT })
if errs + warns + infos + hints == 0 then
return "" -- no diagnostics → empty
end
-- only show non-zero categories
local parts = {}
if errs > 0 then table.insert(parts, "E:"..errs) end
if warns > 0 then table.insert(parts, "W:"..warns) end
if infos > 0 then table.insert(parts, "I:"..infos) end
if hints > 0 then table.insert(parts, "H:"..hints) end
return table.concat(parts, " ")
end
-- 2) wire it into your statusline
-- %< … left-side, %= split, … right-side
vim.o.statusline = table.concat({
"%<%f", -- file path, cut off if too long
"%m%r%h", -- modified/read-only/help flags
-- "%=", -- right align from here
"%{v:lua.lsp_diag_status()}", -- << your diagnostics <<
"%=",
"%l:%c %p%%", -- line:col and percent through file
}, " ")

View File

@@ -0,0 +1,167 @@
-- Add additional capabilities supported by nvim-cmp
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
vim.lsp.config('*', {
capabilities = capabilities,
})
-- Enable some language servers with the additional completion capabilities
local servers = { 'lua_ls', 'pyright', 'gopls', 'clangd', 'helm_ls', 'bashls', 'angularls', 'djls' }
for _, lsp in ipairs(servers) do
vim.lsp.enable(lsp)
end
-- HTML LSP
vim.lsp.config('html', {
filetypes = { "html", "templ", "javascript", "css" },
capabilities = capabilities,
init_options = {
configurationSection = { "html", "css", "javascript" },
embeddedLanguages = { css = true, javascript = true },
provideFormatter = true
}
})
vim.lsp.enable('html')
-- CSS LSP
vim.lsp.config('cssls', {
filetypes = { "css", "scss", "less" },
capabilities = capabilities,
})
vim.lsp.enable('cssls')
-- TypeScript LSP
vim.lsp.config('ts_ls', {
filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact", "html" },
capabilities = capabilities,
})
vim.lsp.enable('ts_ls')
-- JSON LSP
vim.lsp.config('jsonls', {
capabilities = capabilities,
})
vim.lsp.enable('jsonls')
-- Emmet LSP
vim.lsp.config('emmet_ls', {
filetypes = { "html", "template", "javascript" },
})
vim.lsp.enable('emmet_ls')
-- YAML LSP
vim.lsp.config('yamlls', {
capabilities = capabilities,
settings = {
yaml = {
schemas = {
kubernetes = "*.yaml",
},
},
}
})
vim.lsp.enable('yamlls')
vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, {
pattern = "*.jenkinsfile",
command = "set filetype=groovy"
})
-- luasnip setup
local luasnip = require('luasnip')
-- nvim-cmp setup
local cmp = require('cmp')
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-u>'] = cmp.mapping.scroll_docs(-4), -- Up
['<C-d>'] = cmp.mapping.scroll_docs(4), -- Down
-- C-b (back) C-f (forward) for snippet placeholder navigation.
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, { 'i', 's' }),
}),
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'orgmode' },
},
window = {
completion = {
style = "minimal",
border = "rounded",
winhighlight = 'Normal:Normal,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None',
},
documentation = {
style = "minimal",
border = "rounded",
winhighlight = 'Normal:Normal,FloatBorder:FloatBorder'
}
},
}
-- Bordered LSP UI
local float = { focusable = true, style = "minimal", border = "rounded", }
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, float)
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, float)
-- Global mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
vim.api.nvim_set_keymap('i', '<c-n>', '<c-x><c-o>', { noremap = true, silent = true })
-- Use LspAttach autocommand to only map the following keys
-- after the language server attaches to the current buffer
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
-- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
-- Buffer local mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = { buffer = ev.buf }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
vim.keymap.set('n', '<space>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, opts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<space>f', function()
vim.lsp.buf.format { async = true }
end, opts)
end,
})

View File

@@ -0,0 +1,62 @@
vim.keymap.set('n', '<M-h>', '5<C-w><', { desc = 'Resize left' })
vim.keymap.set('n', '<M-j>', '5<C-w>+', { desc = 'Resize down' })
vim.keymap.set('n', '<M-k>', '5<C-w>-', { desc = 'Resize up' })
vim.keymap.set('n', '<M-l>', '5<C-w>>', { desc = 'Resize right' })
vim.api.nvim_set_keymap('n', '<leader>ev', ':edit $MYVIMRC<CR>', { noremap = true })
-- Map Ctrl+Shift+h/j/k/l to resize panes
local builtin = require('telescope.builtin')
-- nnn
vim.api.nvim_set_keymap('n', '<C-f>', ':NnnPicker %:p:h<CR>', { noremap = true })
vim.api.nvim_set_keymap('t', '<C-f>', '<cmd>NnnPicker %:p:h<CR>', { noremap = true })
-- nvim-tree
vim.api.nvim_set_keymap('n', '<C-b>', '<cmd>NvimTreeToggle <CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>b', ':NvimTreeResize ', { noremap = true })
-- Telescope
vim.keymap.set('n', '<C-l>', builtin.find_files, {})
vim.keymap.set('n', '<C-k>', builtin.live_grep, {})
vim.keymap.set('n', '<C-p>', builtin.commands, {})
-- etc
vim.keymap.set('n', '?', ':WhichKey<CR>', {})
-- zen mode
vim.keymap.set('n', '<leader>z', ':ZenMode<CR>', { silent = true })
-- Language shortcuts
vim.keymap.set('i', '<C-e>', 'if err != nil {}<Left>', { noremap = true })
vim.cmd [[autocmd BufWritePre *.go lua vim.lsp.buf.format()]]
-- Change Tabs
vim.keymap.set('n', '<leader>1', '1gt', {})
vim.keymap.set('n', '<leader>2', '2gt', {})
vim.keymap.set('n', '<leader>3', '3gt', {})
vim.keymap.set('n', '<leader>4', '4gt', {})
vim.keymap.set('n', '<leader>5', '5gt', {})
vim.keymap.set('n', '<leader>6', '6gt', {})
vim.keymap.set('n', '<leader>7', '7gt', {})
vim.keymap.set('n', '<leader>8', '8gt', {})
vim.keymap.set('n', '<leader>9', '9gt', {})
-- DAP
vim.api.nvim_set_keymap('n', '<leader>d', ':DapViewToggle<cr>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>w', ':DapViewWatch<cr>', { noremap = true })
vim.keymap.set('n', '<F5>', function() require('dap').continue() end)
vim.keymap.set('n', '<F6>', function() require('dap').restart() end)
vim.keymap.set('n', '<F10>', function() require('dap').step_over() end)
vim.keymap.set('n', '<F11>', function() require('dap').step_into() end)
vim.keymap.set('n', '<F12>', function() require('dap').step_out() end)
vim.keymap.set('n', '<leader>b', function() require('dap').toggle_breakpoint() end)
-- Copilot
vim.api.nvim_set_keymap('n', '<C-C>', ':CopilotChatToggle <CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('i', '<C-J>', 'copilot#Accept("<CR>")', { expr=true, noremap = true, silent = true })
vim.keymap.set('i', '<C-H>', '<Plug>(copilot-accept-word)', { noremap=true, silent=true })
vim.keymap.set("i", "<C-U>", '<Plug>(copilot-next)', { noremap=true, silent=true })
vim.keymap.set("i", "<C-B>", '<Plug>(copilot-previous)', { noremap=true, silent=true })
vim.g.copilot_no_tab_map = true

View File

@@ -0,0 +1,208 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- Install Plugins
require('lazy').setup({
-- Core
'williamboman/mason.nvim',
-- LSP
'neovim/nvim-lspconfig',
'hrsh7th/nvim-cmp',
'hrsh7th/cmp-nvim-lsp',
'folke/neodev.nvim',
'qvalentin/helm-ls.nvim',
{ 'L3MON4D3/LuaSnip', version = 'v2.1.0' },
-- DAP
'mfussenegger/nvim-dap',
'rcarriga/nvim-dap-ui',
'nvim-neotest/nvim-nio',
'leoluz/nvim-dap-go',
-- 'mfussenegger/nvim-dap-python',
-- Visual
'nvim-treesitter/nvim-treesitter',
'luukvbaal/nnn.nvim',
'nvim-tree/nvim-tree.lua',
'lewis6991/gitsigns.nvim',
'mhartington/formatter.nvim',
{
'folke/zen-mode.nvim',
opts = {
window = {
width = 0.5,
options = {
signcolumn = "no",
number = false,
relativenumber = false,
linebreak = true,
wrap = true,
}
},
}
},
{
"CopilotC-Nvim/CopilotChat.nvim",
dependencies = {
{ "github/copilot.vim" }, -- or zbirenbaum/copilot.lua
},
build = "make tiktoken", -- Only on MacOS or Linux
opts = {
window = {
layout = 'replace',
},
mappings = {
accept_diff = false, -- disables the default <C-y> “accept nearest diff”
},
},
},
-- Utility
'windwp/nvim-autopairs',
'nvim-telescope/telescope.nvim',
'nvim-telescope/telescope-ui-select.nvim',
'nvim-lua/plenary.nvim',
-- 'folke/which-key.nvim',
{
"nvim-orgmode/orgmode",
dependencies = {
"lukas-reineke/headlines.nvim",
},
event = 'VeryLazy',
ft = { 'org' },
config = function()
require("orgmode").setup({
org_startup_indented = true, -- ← this gives Emacs-style virtual indentation under headings (huge for legibility)
org_agenda_files = '~/org/**/*',
org_default_notes_file = '~/org/scratch.org',
org_startup_indented = true,
org_deadline_warning_days = 0,
org_agenda_custom_commands = {
w = {
description = "Work",
types = {
{
type = 'agenda',
org_agenda_tag_filter_preset = 'work'
}
}
},
p = {
description = "Personal",
types = {
{
type = 'agenda',
org_agenda_tag_filter_preset = 'personal'
}
}
},
}
})
require("headlines").setup({
org = {
fat_headlines = false, -- ← no more huge blocks
headline_highlights = { "Headline1", "Headline2", "Headline3", "Headline4" },
quote_string = "", -- thinner vertical bar for quotes (optional but nicer)
quote_highlight = "Quote",
},
})
end,
},
-- Study
{
"kawre/leetcode.nvim",
dependencies = {
-- include a picker of your choice, see picker section for more details
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
},
opts = {
lang = "python3"
},
}
})
-- Initialize Plugins
require("mason").setup()
require('neodev').setup()
require('nvim-treesitter.configs').setup {
ensured_installed = { "go", "bash", "javascript", "html", "lua", "org" },
sync_install = false,
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = true,
},
}
require('nnn').setup({
picker = {
cmd = "nnn -C",
style = { border = "rounded" },
fullscreen = false,
},
})
local function tree_on_attach(bufnr)
local api = require('nvim-tree.api')
api.config.mappings.default_on_attach(bufnr)
vim.keymap.del('n', '<C-e>', { buffer = bufnr })
vim.keymap.set("n", "<M-h>", function() api.tree.resize({ relative = -5 }) end, { buffer = bufnr })
vim.keymap.set("n", "<M-l>", function() api.tree.resize({ relative = 5 }) end, { buffer = bufnr })
end
require('nvim-tree').setup({
on_attach = tree_on_attach,
view = {
side = "left",
},
tab = {
sync = {
open = true,
close = true,
},
},
})
-- require('gitsigns').setup()
require('formatter').setup({
filetype = {
python = {
function()
return {
exe = "black",
args = { "--quiet", "-" },
stdin = true
}
end
}
}
})
require('telescope').setup({
defaults = {
file_ignore_patterns = {
"%.git/",
"node_modules/",
"%.DS_Store",
},
},
pickers = {
find_files = {
hidden = true,
no_ignore = true,
},
},
})
require("telescope").load_extension("ui-select")
require('nvim-autopairs').setup()
-- require('which-key').setup()
-- DAP Setup
-- require('dap-python').setup('~/venv/bin/python')
require('dap-go').setup()

View File

@@ -0,0 +1,53 @@
vim.o.mouse = "a"
vim.o.shiftwidth = 4
vim.o.tabstop = 4
vim.o.expandtab = true
vim.o.autoindent = true
vim.o.foldmethod = "indent"
vim.o.foldlevel = 99
vim.o.wrap = false
vim.wo.number = true
vim.wo.relativenumber = true
vim.g.mapleader = ' '
vim.o.splitright = true
-- vim.o.scrolloff = 999
-- vim.o.clipboard="unnamedplus"
vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown",
command = "setlocal wrap linebreak",
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "org",
command = "setlocal shiftwidth=2 tabstop=2 expandtab",
})
-- Highlighting for orgmode files with highlight.nvim
vim.api.nvim_create_autocmd("ColorScheme", {
callback = function()
local cursorline = vim.api.nvim_get_hl(0, { name = "CursorLine" })
local sep = vim.api.nvim_get_hl(0, { name = "WinSeparator" }).fg
or vim.api.nvim_get_hl(0, { name = "Comment" }).fg
vim.api.nvim_set_hl(0, "Headline1", { bg = cursorline.bg, underline = true, sp = sep })
vim.api.nvim_set_hl(0, "Headline2", { bg = cursorline.bg, underline = true, sp = sep })
vim.api.nvim_set_hl(0, "Headline3", { bg = cursorline.bg, underline = true, sp = sep })
vim.api.nvim_set_hl(0, "Headline4", { bg = cursorline.bg, underline = true, sp = sep })
end,
})
-- Global colorscheme based on terminal colors
vim.cmd("Copilot disable")
vim.cmd([[
autocmd ColorScheme * highlight Statement cterm=bold ctermfg=5
autocmd ColorScheme * highlight Keyword ctermfg=5
autocmd ColorScheme * highlight Type ctermfg=6
autocmd ColorScheme * highlight Function cterm=bold ctermfg=4
autocmd ColorScheme * highlight Constant ctermfg=3
autocmd ColorScheme * highlight String ctermfg=2
" autocmd ColorScheme * highlight Comment cterm=italic ctermfg=lightgray
syntax on
set notermguicolors
colorscheme default
]])