Organize and commit nvim configuration improvements

**Configuration Enhancements:**
- Enable Nerd Font support in init.lua
- Enhanced LSP configuration with better clangd setup
- Improved query driver paths and error handling
- Added support for more filetypes (cmake, tex, etc.)

**Plugin Management:**
- Add GitHub Copilot integration
- Remove experimental plugins (avante, completion, statusline, theme)
- Reorganize plugin imports for better structure

**Repository Maintenance:**
- Update .gitignore for better artifact handling
- Clean up unused plugin configurations
- Establish clean baseline for future development

Resolves #12
This commit is contained in:
dlond 2025-08-20 15:20:01 +12:00 committed by Daniel Lond
parent 25cab9b193
commit 217e448188
9 changed files with 83 additions and 243 deletions

32
.gitignore vendored
View File

@ -1,14 +1,24 @@
tags
test.sh
.luarc.json
nvim
# OS files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
spell/
# Project status tracking (local only)
CLAUDE.md
STATUS.md
VIDINTEL.md
KEYBIND_ANALYSIS.md
# Neovim runtime files
.cache/
.local/
*.tmp
*.swp
*.swo
*~
# Plugin artifacts
lazy-lock.json
.luarc.json
# Development artifacts
*.disabled
todo.md

View File

@ -91,7 +91,7 @@ vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = false
vim.g.have_nerd_font = true
-- [[ Setting options ]]
-- See `:help vim.o`
@ -631,19 +631,7 @@ require('lazy').setup({
-- - settings (table): Override the default settings passed when initializing the server.
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = {
clangd = {
cmd = {
'clangd',
'--background-index',
'--clang-tidy',
'--header-insertion=never',
'--query-driver=' .. vim.fn.exepath 'clang++',
'--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1],
},
filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' },
root_dir = require('lspconfig.util').root_pattern '.git',
single_file_support = true,
},
-- clangd = {},
-- gopls = {},
-- pyright = {},
-- rust_analyzer = {},
@ -658,7 +646,7 @@ require('lazy').setup({
lua_ls = {
-- cmd = { ... },
-- filetypes = { ... },
filetypes = { 'lua', 'luau' },
-- capabilities = {},
settings = {
Lua = {

View File

@ -1,46 +0,0 @@
return {
"yetone/avante.nvim",
event = "VeryLazy",
lazy = false,
version = false, -- set this if you want to always pull the latest change
opts = {
-- add any opts here
},
-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
build = "make",
-- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
dependencies = {
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
--- The below dependencies are optional,
"hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions
"nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
"zbirenbaum/copilot.lua", -- for providers='copilot'
{
-- support for image pasting
"HakonHarnes/img-clip.nvim",
event = "VeryLazy",
opts = {
-- recommended settings
default = {
embed_image_as_base64 = false,
prompt_for_file_name = false,
drag_and_drop = {
insert_mode = true,
},
-- required for Windows users
use_absolute_path = true,
},
},
},
{
-- Make sure to set this up properly if you have lazy=true
'MeanderingProgrammer/render-markdown.nvim',
opts = {
file_types = { "markdown", "Avante" },
},
ft = { "markdown", "Avante" },
},
},
}

View File

@ -1,112 +0,0 @@
return {
{
'hrsh7th/nvim-cmp',
event = 'InsertEnter', -- Load when entering insert mode
dependencies = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
{ -- LuaSnip and its potential build step
'L3MON4D3/LuaSnip',
-- Follow latest V2 release.
version = 'v2.*',
-- tag = '<your-desired-luasnip-tag>', -- Removed tag specification
-- install jsregexp (optional!:).
build = (function()
-- Build Step is needed for regex support in snippets. This step is optional.
-- Remove the below condition to build Luasnip with regex support on Mac and Linux.
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
return
end
return 'make install_jsregexp'
end)(),
},
'saadparwaiz1/cmp_luasnip', -- Snippet source for nvim-cmp
-- Add other cmp sources if needed, e.g.:
-- 'hrsh7th/cmp-cmdline',
},
config = function()
local cmp = require 'cmp'
local luasnip = require 'luasnip'
luasnip.config.setup {} -- Setup luasnip first
local function toggle_path_completion()
local config = cmp.get_config()
local snippet = config.snippet
local completion = config.completion
local mapping = config.mapping
local path_enabled = vim.tbl_any(function(src)
return src.name == 'path'
end, config.sources)
local new_sources = {
{ name = 'lazydev', group_index = 0 },
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
}
if not path_enabled then
table.insert(new_sources, { name = 'path' })
end
cmp.setup {
snippet = snippet,
completion = completion,
mapping = mapping,
sources = new_sources,
}
print('Path completion ' .. (path_enabled and 'disabled' or 'enabled'))
end
-- Configure nvim-cmp
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body) -- Expand snippets using luasnip
end,
},
completion = {
-- Set completeopt to have a better completion experience
-- :help completeopt
-- menuone: popup even when there's only one match
-- noinsert: Do not insert text until a selection is made
-- noselect: Do not select the first item by default
completeopt = 'menu,menuone,noinsert',
},
-- Key Mappings for completion
mapping = cmp.mapping.preset.insert {
['<C-n>'] = cmp.mapping.select_next_item(), -- Select next item
['<C-p>'] = cmp.mapping.select_prev_item(), -- Select previous item
['<C-b>'] = cmp.mapping.scroll_docs(-4), -- Scroll documentation back
['<C-f>'] = cmp.mapping.scroll_docs(4), -- Scroll documentation forward
['<C-y>'] = cmp.mapping.confirm { select = true }, -- Confirm selection
['<C-Space>'] = cmp.mapping.complete {}, -- Trigger completion manually
-- Handle snippet jumping
['<C-l>'] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
end
end, { 'i', 's' }), -- Jump forward in snippet
['<C-h>'] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
end
end, { 'i', 's' }), -- Jump backward in snippet
},
-- Completion sources
sources = cmp.config.sources {
{ name = 'nvim_lsp' }, -- LSP symbols
{ name = 'luasnip' }, -- Snippets
{ name = 'buffer' }, -- Words from current buffer
{ name = 'path' }, -- Filesystem paths
},
-- Add other cmp setup options from your old config if any
}
vim.keymap.set('n', '<leader>tp', toggle_path_completion, { desc = '[T]oggle [p]ath completion' })
end, -- End of config function
},
}

View File

@ -0,0 +1,14 @@
return {
{
'github/copilot.vim',
event = 'VimEnter',
config = function()
-- Accept suggestion with Ctrl-y
vim.keymap.set('i', '<C-y>', 'copilot#Accept("\\<CR>")', {
expr = true,
replace_keycodes = false
})
vim.g.copilot_no_tab_map = true
end,
},
}

View File

@ -3,14 +3,15 @@
--
-- See the kickstart.nvim README for more information
return {
{ import = 'custom.plugins.avante' },
-- { import = 'custom.plugins.completion' },
-- { import = 'custom.plugins.theme' },
-- { import = 'custom.plugins.avante' },
{ import = 'custom.plugins.copilot' },
{ import = 'custom.plugins.debug' },
{ import = 'custom.plugins.formatting' },
{ import = 'custom.plugins.git' },
{ import = 'custom.plugins.lsp' },
{ import = 'custom.plugins.nvim-tmux-navigator' },
{ import = 'custom.plugins.telescope' },
-- { import = 'custom.plugins.theme' },
{ import = 'custom.plugins.treesitter' },
}

View File

@ -5,10 +5,33 @@ return {
{
'neovim/nvim-lspconfig',
-- only load when editing these filetypes (optional)
ft = { 'python', 'lua', 'nix', 'rust', 'go', 'c', 'cpp' },
ft = {
'c',
'cpp',
'objc',
'objcpp',
'cuda',
'cmake',
--
'go',
'nix',
'python',
'rust',
'tex',
},
opts = function()
local lspconfig = require 'lspconfig'
local capabilities = require('blink.cmp').get_lsp_capabilities()
local capabilities = {}
pcall(function()
capabilities = require('blink.cmp').get_lsp_capabilities()
end)
local util = require 'lspconfig.util'
local query_driver = table.concat({
'/nix/store/*/bin/clang*',
'/opt/homebrew/opt/llvm/bin/clang*',
'/usr/bin/clang*',
}, ';')
local servers = {
clangd = {
@ -17,13 +40,22 @@ return {
'--background-index',
'--clang-tidy',
'--header-insertion=never',
'--query-driver=' .. vim.fn.exepath('clang++'),
'--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1],
'--query-driver=' .. query_driver,
'--compile-commands-dir=build',
'--resource-dir=' .. (function()
local ok, result = pcall(vim.fn.systemlist, { 'clang++', '--print-resource-dir' })
if ok and result and result[1] then
return result[1]
else
return '/usr/lib/clang/19/include' -- fallback
end
end)(),
},
filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' },
root_dir = require('lspconfig.util').root_pattern('.git'),
root_dir = util.root_pattern('CMakeLists.txt', '.git'),
single_file_support = true,
},
pyright = {
settings = {
python = {
@ -37,13 +69,16 @@ return {
},
positionEncoding = 'utf-8',
},
nixd = {},
ruff = {},
nixd = {},
texlab = {},
cmake = {
cmd = { 'cmake-language-server' },
filetypes = { 'cmake' },
root_dir = require('lspconfig.util').root_pattern('CMakeLists.txt', '.git'),
root_dir = util.root_pattern('CMakeLists.txt', '.git'),
},
}

View File

@ -1,38 +0,0 @@
return {
'echasnovski/mini.statusline',
dependencies = { 'nvim-tree/nvim-web-devicons' }, -- optional for icons
opts = function(_, opts)
local statusline = require 'mini.statusline'
-- Add new section function
-- statusline.section_target = function()
-- local target = require('custom.utils'):get_target()
-- return target and (' ' .. target) or ''
-- end
-- Override content.active to include target
opts.content = opts.content or {}
opts.content.active = function()
local mode, git, diagnostics, filename, fileinfo, target, location =
statusline.section_mode {},
statusline.section_git {},
statusline.section_diagnostics {},
statusline.section_filename {},
statusline.section_fileinfo {},
-- statusline.section_target {},
statusline.section_location {}
return statusline.combine_groups {
{ hl = 'MiniStatuslineModeNormal', strings = { mode } },
{ hl = 'MiniStatuslineDevinfo', strings = { git, diagnostics } },
'%<',
{ hl = 'MiniStatuslineFilename', strings = { filename } },
{ hl = 'MiniStatuslineFileinfo', strings = { fileinfo } },
{ hl = 'MiniStatuslineTarget', strings = { target } },
{ hl = 'MiniStatuslineLocation', strings = { location } },
}
end
return opts
end,
}

View File

@ -1,12 +0,0 @@
-- Theme configuration
return {
{
'catppuccin/nvim',
priority = 1000,
config = function()
vim.cmd.colorscheme 'catppuccin-mocha'
end,
},
{ 'folke/tokyonight.nvim', enabled = false },
}