refactor: Complete modular migration from kickstart.nvim

Major architectural overhaul to transform the flat kickstart.nvim structure
  into a maintainable, modular configuration while preserving upstream sync capability.

  ## Structure Changes
  - Migrated from flat `lua/custom/` to organized `lua/core/` and `lua/plugins/`
  - Separated plugin specs from configs: `lua/plugins/spec/` and `lua/plugins/config/`
  - Complex configs (LSP, Debug) now use directory structure with sub-modules:
    - `lsp/init.lua`, `lsp/servers.lua`, `lsp/keymaps.lua`
    - `debug/init.lua`, `debug/adapters.lua`, `debug/keymaps.lua`

  ## Core Improvements
  - Created dedicated core modules: options, keymaps, autocmds, bootstrap, health
  - Added comprehensive health check (`lua/core/health.lua`) for diagnostics
  - Simplified init.lua to just orchestrate module loading
  - Better separation of concerns throughout

  ## Plugin Updates
  - Fixed Blink.cmp configuration (removed invalid fuzzy options)
  - Integrated Copilot with Blink.cmp for unified completion experience
  - Added autopairs and indent-line from kickstart examples
  - Optimized for Nix development environments (removed venv assumptions)

  ## Documentation
  - Updated README with modular structure and kickstart sync instructions
  - Created comprehensive KEYBIND_ANALYSIS.md with all mappings
  - Added modular.txt help documentation
  - Created TODO_TEST.md checklist for testing

  ## Benefits
  - Easier to maintain and extend
  - Clean separation allows upstream kickstart merges without conflicts
  - Scalable architecture for adding new languages/tools
  - Better code organization and discoverability

  All kickstart functionality preserved while gaining modularity and maintainability.
This commit is contained in:
dlond 2025-09-02 13:21:18 +12:00 committed by Daniel Lond
parent 277be1e79b
commit f81cab2da3
55 changed files with 2039 additions and 2299 deletions

View file

@ -0,0 +1,24 @@
-- Auto-pairs - Automatically close brackets, quotes, etc.
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
opts = {
check_ts = true,
ts_config = {
lua = { 'string', 'source' },
javascript = { 'string', 'template_string' },
},
disable_filetype = { 'TelescopePrompt', 'spectre_panel' },
fast_wrap = {
map = '<M-e>',
chars = { '{', '[', '(', '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], '%s+', ''),
offset = 0,
end_key = '$',
keys = 'qwertyuiopzxcvbnmasdfghjkl',
check_comma = true,
highlight = 'PmenuSel',
highlight_grey = 'LineNr',
},
},
}

View file

@ -0,0 +1,12 @@
-- Blink.cmp - Modern completion plugin
return {
'saghen/blink.cmp',
lazy = false, -- Lazy loading handled internally
dependencies = {
'giuxtaposition/blink-cmp-copilot',
},
version = 'v0.*', -- Use stable releases
config = function()
require('plugins.config.blink').setup()
end,
}

View file

@ -0,0 +1,21 @@
-- GitHub Copilot integration
return {
'zbirenbaum/copilot.lua',
cmd = 'Copilot',
event = 'InsertEnter',
opts = {
suggestion = { enabled = false }, -- Disable inline ghost text (handled by blink.cmp)
panel = { enabled = false }, -- Disable panel view
filetypes = {
yaml = false,
markdown = false,
help = false,
gitcommit = false,
gitrebase = false,
hgcommit = false,
svn = false,
cvs = false,
['.'] = false,
},
},
}

View file

@ -0,0 +1,20 @@
-- Debug Adapter Protocol (DAP) support
return {
'mfussenegger/nvim-dap',
dependencies = {
-- DAP UI
{
'rcarriga/nvim-dap-ui',
dependencies = { 'nvim-neotest/nvim-nio' },
},
-- Virtual text for debugging
{
'theHamsta/nvim-dap-virtual-text',
opts = {},
},
},
config = function()
require('plugins.config.debug').setup()
end,
}

View file

@ -0,0 +1,36 @@
-- Editor enhancement plugins
return {
-- Collection of various small independent plugins/modules
{
'echasnovski/mini.nvim',
config = function()
require('plugins.config.editor').setup_mini()
end,
},
-- Highlight, edit, and navigate code
{
'nvim-treesitter/nvim-treesitter-textobjects',
event = 'VeryLazy',
dependencies = { 'nvim-treesitter/nvim-treesitter' },
},
-- Detect tabstop and shiftwidth automatically
{ 'tpope/vim-sleuth' },
-- Comment plugin
{
'numToStr/Comment.nvim',
event = 'VeryLazy',
opts = {},
},
-- Highlight word under cursor
{
'RRethy/vim-illuminate',
event = { 'BufReadPost', 'BufNewFile' },
config = function()
require('plugins.config.editor').setup_illuminate()
end,
},
}

View file

@ -0,0 +1,40 @@
-- Formatter configuration
return {
-- ========================================
-- Formatter Configuration (conform.nvim)
-- ========================================
{
'stevearc/conform.nvim',
event = 'BufWritePre', -- Format on save
-- cmd = { 'ConformInfo' }, -- Optional: If you want the command available
-- keys = { ... } -- Optional: Define keys if needed
opts = {
formatters_by_ft = {
lua = { 'stylua' },
c = { 'clang_format' },
cpp = { 'clang_format' },
-- Use ruff for Python formatting (includes isort and is faster than black
-- Ensure 'ruff' is installed via Home Manager (pkgs.ruff)
python = { 'ruff_format', 'ruff_fix' },
-- python = { 'isort', 'black' },
nix = { 'alejandra' }, -- Add nix formatter
-- Add other filetypes and formatters, e.g.:
-- javascript = { "prettier" },
-- typescript = { "prettier" },
-- css = { "prettier" },
-- html = { "prettier" },
-- json = { "prettier" },
-- yaml = { "prettier" },
-- markdown = { "prettier" },
-- bash = { "shfmt" },
},
-- Configure format_on_save behavior
format_on_save = {
-- I recommend these options, but adjust to your liking
timeout_ms = 500, -- Stop formatting if it takes too long
lsp_fallback = true, -- Fallback to LSP formatting if conform fails
},
},
},
}

26
lua/plugins/spec/git.lua Normal file
View file

@ -0,0 +1,26 @@
-- Git integration plugins
return {
-- Fugitive - Git integration
{
'tpope/vim-fugitive',
cmd = { 'Git', 'G', 'Gdiff', 'Gread', 'Gwrite', 'Ggrep', 'GMove', 'GDelete', 'GBrowse', 'GRemove' },
keys = {
{ '<leader>gs', '<cmd>Git<cr>', desc = 'Git status' },
{ '<leader>gd', '<cmd>Gdiff<cr>', desc = 'Git diff' },
{ '<leader>gc', '<cmd>Git commit<cr>', desc = 'Git commit' },
{ '<leader>gb', '<cmd>Git blame<cr>', desc = 'Git blame' },
{ '<leader>gl', '<cmd>Git log<cr>', desc = 'Git log' },
{ '<leader>gp', '<cmd>Git push<cr>', desc = 'Git push' },
{ '<leader>gf', '<cmd>Git fetch<cr>', desc = 'Git fetch' },
},
},
-- Gitsigns - Git gutter and hunk operations
{
'lewis6991/gitsigns.nvim',
event = 'VeryLazy',
config = function()
require('plugins.config.git').setup_gitsigns()
end,
},
}

View file

@ -0,0 +1,33 @@
-- Indent guides - Show vertical lines at indentation levels
return {
'lukas-reineke/indent-blankline.nvim',
event = { 'BufReadPost', 'BufNewFile' },
main = 'ibl',
opts = {
indent = {
char = '',
tab_char = '',
},
scope = {
enabled = true,
show_start = true,
show_end = false,
injected_languages = false,
highlight = { 'Function', 'Label' },
},
exclude = {
filetypes = {
'help',
'alpha',
'dashboard',
'neo-tree',
'Trouble',
'lazy',
'mason',
'notify',
'toggleterm',
'lazyterm',
},
},
},
}

25
lua/plugins/spec/init.lua Normal file
View file

@ -0,0 +1,25 @@
-- Main plugin loader - imports all plugin specifications
return {
-- UI and Theme
{ import = 'plugins.spec.ui' },
{ import = 'plugins.spec.editor' },
{ import = 'plugins.spec.autopairs' },
{ import = 'plugins.spec.indent-line' },
-- Core functionality
{ import = 'plugins.spec.lsp' },
{ import = 'plugins.spec.treesitter' },
{ import = 'plugins.spec.telescope' },
{ import = 'plugins.spec.blink' },
-- Git integration
{ import = 'plugins.spec.git' },
-- Development tools
{ import = 'plugins.spec.copilot' },
{ import = 'plugins.spec.debug' },
{ import = 'plugins.spec.formatting' },
-- Navigation
{ import = 'plugins.spec.nvim-tmux-navigator' },
}

26
lua/plugins/spec/lsp.lua Normal file
View file

@ -0,0 +1,26 @@
-- LSP Plugin Specification
return {
{
'neovim/nvim-lspconfig',
event = { 'BufReadPost', 'BufNewFile' },
dependencies = {
{ 'j-hui/fidget.nvim', opts = {} },
'folke/lazydev.nvim',
},
config = function()
require('plugins.config.lsp').setup()
end,
},
-- LazyDev for better Neovim Lua development
{
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
},
},
},
}

View file

@ -0,0 +1,11 @@
-- Tmux navigation integration
return {
'christoomey/vim-tmux-navigator',
keys = {
{ '<C-h>', ':TmuxNavigateLeft<CR>', desc = 'Navigate to left tmux pane' },
{ '<C-j>', ':TmuxNavigateDown<CR>', desc = 'Navigate to down tmux pane' },
{ '<C-k>', ':TmuxNavigateUp<CR>', desc = 'Navigate to up tmux pane' },
{ '<C-l>', ':TmuxNavigateRight<CR>', desc = 'Navigate to right tmux pane' },
{ '<C-\\>', ':TmuxNavigatePrevious<CR>', desc = 'Navigate to previous tmux pane' },
},
}

View file

@ -0,0 +1,21 @@
-- Telescope - Fuzzy finder
return {
'nvim-telescope/telescope.nvim',
event = 'VimEnter',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'make',
cond = function()
return vim.fn.executable 'make' == 1
end,
},
{ 'nvim-telescope/telescope-ui-select.nvim' },
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
},
config = function()
require('plugins.config.telescope').setup()
end,
}

View file

@ -0,0 +1,45 @@
-- Treesitter - Syntax highlighting and text objects
return {
'nvim-treesitter/nvim-treesitter',
event = { 'BufReadPost', 'BufNewFile' },
build = ':TSUpdate',
main = 'nvim-treesitter.configs',
opts = {
ensure_installed = {
'bash',
'c',
'cmake',
'cpp',
'diff',
'html',
'lua',
'luadoc',
'make',
'markdown',
'markdown_inline',
'nix',
'python',
'query',
'vim',
'vimdoc',
'yaml',
},
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = false,
node_decremental = '<bs>',
},
},
},
}

29
lua/plugins/spec/ui.lua Normal file
View file

@ -0,0 +1,29 @@
-- UI and Theme plugins
return {
-- Color scheme
{
'folke/tokyonight.nvim',
priority = 1000,
init = function()
vim.cmd.colorscheme 'tokyonight-night'
vim.cmd.hi 'Comment gui=none'
end,
},
-- Which-key for keybind hints
{
'folke/which-key.nvim',
event = 'VimEnter',
config = function()
require('plugins.config.ui').setup_which_key()
end,
},
-- Todo comments highlighting
{
'folke/todo-comments.nvim',
event = 'VimEnter',
dependencies = { 'nvim-lua/plenary.nvim' },
opts = { signs = false }
},
}