ux and editing plugins configured
This commit is contained in:
parent
ab42f6cebc
commit
9a03d01844
8 changed files with 193 additions and 13 deletions
33
lua/plugins/autopairs.lua
Normal file
33
lua/plugins/autopairs.lua
Normal 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,
|
||||
}
|
||||
37
lua/plugins/indent-blankline.lua
Normal file
37
lua/plugins/indent-blankline.lua
Normal 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
28
lua/plugins/surround.lua
Normal 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
56
lua/plugins/ufo.lua
Normal 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
15
lua/plugins/undotree.lua
Normal 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,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue