ux and editing plugins configured

This commit is contained in:
Ray Elliott 2025-12-07 21:18:09 +00:00
parent ab42f6cebc
commit 9a03d01844
8 changed files with 193 additions and 13 deletions

View File

@ -204,26 +204,26 @@ Source of truth for the step-by-step rebuild. Keep this concise and up to date.
- [x] Add keymaps if needed
## Phase 6.4 — Surround
- [ ] Add `kylechui/nvim-surround`
- [ ] Minimal config with default keymaps (ys, ds, cs)
- [x] Add `kylechui/nvim-surround`
- [x] Minimal config with default keymaps (ys, ds, cs)
## Phase 6.5 — Autopairs
- [ ] Add `windwp/nvim-autopairs`
- [ ] Integrate with nvim-cmp
- [x] Add `windwp/nvim-autopairs`
- [x] Integrate with nvim-cmp
## Phase 6.6 — Indent guides
- [ ] Add `lukas-reineke/indent-blankline.nvim`
- [ ] Configure scope highlighting
- [x] Add `lukas-reineke/indent-blankline.nvim`
- [x] Configure scope highlighting
## Phase 6.7 — Folding (UFO)
- [ ] Add `kevinhwang91/nvim-ufo` for folding
- [ ] Configure with Treesitter and LSP providers
- [ ] Add fold keymaps (za, zR, zM, etc.)
- [x] Add `kevinhwang91/nvim-ufo` for folding
- [x] Configure with Treesitter and LSP providers
- [x] Add fold keymaps (za, zR, zM, etc.)
## Phase 6.8 — Undotree
- [ ] Add `mbbill/undotree`
- [ ] Add keymap to toggle undotree
- [ ] Configure minimal settings
- [x] Add `mbbill/undotree`
- [x] Add keymap to toggle undotree
- [x] Configure minimal settings
## Phase 7 — Git, Markdown, Copilot, Formatting

View File

@ -44,6 +44,11 @@ Record every decision here with a short rationale. Append new entries; do not re
- NO motion plugin (skip leap/flash for simplicity)
- Undotree moved to separate phase (6.8)
- Comment.nvim for commenting (gcc/gc/gbc/gb keymaps)
- nvim-surround for text objects (ys/ds/cs operators)
- nvim-autopairs for auto-closing brackets/quotes with Treesitter and cmp integration
- indent-blankline for visual indent guides with scope highlighting
- nvim-ufo for enhanced folding with Treesitter/LSP providers (zR/zM/K for peek)
- undotree for visual undo history (<leader>u to toggle)
## Project-Local Configuration (design)

View File

@ -4,16 +4,22 @@
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "0b9bb925c000ae649ff7e7149c8cd00031f4b539" },
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
"nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" },
"nvim-cmp": { "branch": "main", "commit": "d97d85e01339f01b842e6ec1502f639b080cb0fc" },
"nvim-lspconfig": { "branch": "master", "commit": "9c923997123ff9071198ea3b594d4c1931fab169" },
"nvim-surround": { "branch": "main", "commit": "fcfa7e02323d57bfacc3a141f8a74498e1522064" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" },
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
"nvim-ufo": { "branch": "main", "commit": "72d54c31079d38d8dfc5456131b1d0fb5c0264b0" },
"oil.nvim": { "branch": "master", "commit": "cbcb3f997f6f261c577b943ec94e4ef55108dd95" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"undotree": { "branch": "master", "commit": "0f1c9816975b5d7f87d5003a19c53c6fd2ff6f7f" }
}

33
lua/plugins/autopairs.lua Normal file
View File

@ -0,0 +1,33 @@
-- Phase 6.5: nvim-autopairs for auto-closing brackets, quotes, etc.
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
config = function()
local autopairs = require('nvim-autopairs')
autopairs.setup({
check_ts = true, -- Use treesitter to check for valid pair
ts_config = {
lua = { 'string' }, -- Don't add pairs in lua string treesitter nodes
javascript = { 'template_string' }, -- Don't add pairs in JS template strings
php = { 'string' }, -- Don't add pairs in PHP strings
},
disable_filetype = { 'TelescopePrompt', 'vim' },
fast_wrap = {
map = '<M-e>', -- Alt+e for fast wrap
chars = { '{', '[', '(', '"', "'" },
pattern = [=[[%'%"%>%]%)%}%,]]=],
end_key = '$',
keys = 'qwertyuiopzxcvbnmasdfghjkl',
check_comma = true,
highlight = 'Search',
highlight_grey = 'Comment',
},
})
-- Integration with nvim-cmp
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
end,
}

View File

@ -0,0 +1,37 @@
-- Phase 6.6: indent-blankline for visual indent guides
return {
'lukas-reineke/indent-blankline.nvim',
main = 'ibl',
event = { 'BufReadPost', 'BufNewFile' },
opts = {
indent = {
char = '', -- Use same character as listchars tab
tab_char = '',
},
scope = {
enabled = true, -- Highlight current scope
show_start = true, -- Show underline at start of scope
show_end = false, -- Don't show underline at end (can be noisy)
},
exclude = {
filetypes = {
'help',
'alpha',
'dashboard',
'neo-tree',
'Trouble',
'lazy',
'mason',
'notify',
'toggleterm',
'lazyterm',
},
buftypes = {
'terminal',
'nofile',
'quickfix',
'prompt',
},
},
},
}

28
lua/plugins/surround.lua Normal file
View File

@ -0,0 +1,28 @@
-- Phase 6.4: nvim-surround for surrounding text with quotes, brackets, tags, etc.
return {
'kylechui/nvim-surround',
version = '*', -- Use stable releases
event = 'VeryLazy',
opts = {
-- Default keymaps:
-- ys{motion}{char} - Add surround in normal mode (e.g., ysiw" to surround word with quotes)
-- ds{char} - Delete surround (e.g., ds" to delete surrounding quotes)
-- cs{old}{new} - Change surround (e.g., cs"' to change " to ')
-- S{char} - Add surround in visual mode (e.g., select text, S" to wrap in quotes)
-- Keep default keymaps; minimal config
keymaps = {
insert = '<C-g>s',
insert_line = '<C-g>S',
normal = 'ys',
normal_cur = 'yss',
normal_line = 'yS',
normal_cur_line = 'ySS',
visual = 'S',
visual_line = 'gS',
delete = 'ds',
change = 'cs',
change_line = 'cS',
},
},
}

56
lua/plugins/ufo.lua Normal file
View File

@ -0,0 +1,56 @@
-- Phase 6.7: nvim-ufo for better folding with Treesitter and LSP support
return {
'kevinhwang91/nvim-ufo',
dependencies = {
'kevinhwang91/promise-async',
},
event = { 'BufReadPost', 'BufNewFile' },
keys = {
{ 'zR', function() require('ufo').openAllFolds() end, desc = 'Open all folds' },
{ 'zM', function() require('ufo').closeAllFolds() end, desc = 'Close all folds' },
{ 'zr', function() require('ufo').openFoldsExceptKinds() end, desc = 'Open folds except kinds' },
{ 'zm', function() require('ufo').closeFoldsWith() end, desc = 'Close folds with' },
{ 'K', function()
local winid = require('ufo').peekFoldedLinesUnderCursor()
if not winid then
-- Fall back to LSP hover if not on a fold
vim.lsp.buf.hover()
end
end, desc = 'Peek fold or LSP hover' },
},
opts = {
provider_selector = function(bufnr, filetype, buftype)
-- Use Treesitter for supported languages, LSP for others, indent as fallback
return { 'treesitter', 'indent' }
end,
-- Open folds when searching
open_fold_hl_timeout = 150,
close_fold_kinds_for_ft = {
default = { 'imports', 'comment' },
},
preview = {
win_config = {
border = { '', '', '', '', '', '', '', '' },
winhighlight = 'Normal:Folded',
winblend = 0,
},
mappings = {
scrollU = '<C-u>',
scrollD = '<C-d>',
jumpTop = '[',
jumpBot = ']',
},
},
},
config = function(_, opts)
-- Set fold settings for nvim-ufo
vim.o.foldcolumn = '1' -- Show fold column
vim.o.foldlevel = 99 -- Open all folds by default
vim.o.foldlevelstart = 99 -- Open all folds when opening a file
vim.o.foldenable = true -- Enable folding
-- Use simple characters for fold indicators
vim.o.fillchars = [[eob: ,fold: ,foldopen:▼,foldsep: ,foldclose:▶]]
require('ufo').setup(opts)
end,
}

15
lua/plugins/undotree.lua Normal file
View File

@ -0,0 +1,15 @@
-- Phase 6.8: undotree for visual undo history
return {
'mbbill/undotree',
cmd = 'UndotreeToggle', -- Lazy load on command
keys = {
{ '<leader>u', '<cmd>UndotreeToggle<cr>', desc = 'Toggle Undotree' },
},
config = function()
-- Configure undotree
vim.g.undotree_WindowLayout = 2 -- Layout: diff at bottom
vim.g.undotree_ShortIndicators = 1 -- Use short time indicators
vim.g.undotree_SetFocusWhenToggle = 1 -- Focus undotree when toggled
vim.g.undotree_DiffAutoOpen = 1 -- Auto open diff window
end,
}