feat: phase 2 migration
This commit is contained in:
parent
fc1fcc0c8c
commit
c0c1148fde
20 changed files with 663 additions and 2645 deletions
64
lua/plugins/core/completion.lua
Normal file
64
lua/plugins/core/completion.lua
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
-- ========================================================================
|
||||
-- COMPLETION PLUGIN
|
||||
-- ========================================================================
|
||||
-- Autocompletion engine with LSP integration
|
||||
-- - Blink.cmp: Fast completion engine
|
||||
-- - LuaSnip: Snippet engine
|
||||
-- - Lazydev: Lua LSP for Neovim config
|
||||
-- ========================================================================
|
||||
|
||||
return {
|
||||
-- Autocompletion
|
||||
{
|
||||
'saghen/blink.cmp',
|
||||
event = 'VimEnter',
|
||||
version = '1.*',
|
||||
dependencies = {
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
version = '2.*',
|
||||
build = (function()
|
||||
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
||||
return
|
||||
end
|
||||
return 'make install_jsregexp'
|
||||
end)(),
|
||||
opts = {},
|
||||
},
|
||||
'folke/lazydev.nvim',
|
||||
},
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
keymap = {
|
||||
preset = 'enter',
|
||||
},
|
||||
appearance = {
|
||||
nerd_font_variant = 'mono',
|
||||
},
|
||||
completion = {
|
||||
documentation = { auto_show = false, auto_show_delay_ms = 500 },
|
||||
},
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets', 'lazydev' },
|
||||
providers = {
|
||||
lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
|
||||
},
|
||||
},
|
||||
snippets = { preset = 'luasnip' },
|
||||
fuzzy = { implementation = 'lua' },
|
||||
signature = { enabled = true },
|
||||
},
|
||||
},
|
||||
|
||||
-- Lazydev: Lua LSP for Neovim config
|
||||
{
|
||||
'folke/lazydev.nvim',
|
||||
ft = 'lua',
|
||||
opts = {
|
||||
library = {
|
||||
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
138
lua/plugins/core/editor.lua
Normal file
138
lua/plugins/core/editor.lua
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
-- ========================================================================
|
||||
-- CORE EDITOR PLUGINS
|
||||
-- ========================================================================
|
||||
-- Essential editing tools that are always loaded
|
||||
-- - Telescope: Fuzzy finder
|
||||
-- - Which-key: Keybinding helper
|
||||
-- - Neo-tree: File explorer
|
||||
-- - guess-indent: Auto-detect indentation
|
||||
-- ========================================================================
|
||||
|
||||
return {
|
||||
-- Detect tabstop and shiftwidth automatically
|
||||
'NMAC427/guess-indent.nvim',
|
||||
|
||||
-- Telescope: Fuzzy finder (files, LSP, etc)
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
event = 'VimEnter',
|
||||
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('telescope').setup {
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
['<C-j>'] = require('telescope.actions').move_selection_next,
|
||||
['<C-k>'] = require('telescope.actions').move_selection_previous,
|
||||
['<C-d>'] = require('telescope.actions').preview_scrolling_down,
|
||||
['<C-u>'] = require('telescope.actions').preview_scrolling_up,
|
||||
},
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
['ui-select'] = {
|
||||
require('telescope.themes').get_dropdown(),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
pcall(require('telescope').load_extension, 'ui-select')
|
||||
|
||||
local builtin = require 'telescope.builtin'
|
||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
||||
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
|
||||
vim.keymap.set('n', '<leader>s/', function()
|
||||
builtin.live_grep {
|
||||
grep_open_files = true,
|
||||
prompt_title = 'Live Grep in Open Files',
|
||||
}
|
||||
end, { desc = '[S]earch [/] in Open Files' })
|
||||
|
||||
vim.keymap.set('n', '<leader>sn', function()
|
||||
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
||||
end, { desc = '[S]earch [N]eovim files' })
|
||||
end,
|
||||
},
|
||||
|
||||
-- Which-key: Shows pending keybinds
|
||||
{
|
||||
'folke/which-key.nvim',
|
||||
event = 'VimEnter',
|
||||
opts = {
|
||||
delay = 0,
|
||||
icons = {
|
||||
mappings = vim.g.have_nerd_font,
|
||||
keys = vim.g.have_nerd_font and {} or {
|
||||
Up = '<Up> ',
|
||||
Down = '<Down> ',
|
||||
Left = '<Left> ',
|
||||
Right = '<Right> ',
|
||||
C = '<C-…> ',
|
||||
M = '<M-…> ',
|
||||
D = '<D-…> ',
|
||||
S = '<S-…> ',
|
||||
CR = '<CR> ',
|
||||
Esc = '<Esc> ',
|
||||
ScrollWheelDown = '<ScrollWheelDown> ',
|
||||
ScrollWheelUp = '<ScrollWheelUp> ',
|
||||
NL = '<NL> ',
|
||||
BS = '<BS> ',
|
||||
Space = '<Space> ',
|
||||
Tab = '<Tab> ',
|
||||
F1 = '<F1>',
|
||||
F2 = '<F2>',
|
||||
F3 = '<F3>',
|
||||
F4 = '<F4>',
|
||||
F5 = '<F5>',
|
||||
F6 = '<F6>',
|
||||
F7 = '<F7>',
|
||||
F8 = '<F8>',
|
||||
F9 = '<F9>',
|
||||
F10 = '<F10>',
|
||||
F11 = '<F11>',
|
||||
F12 = '<F12>',
|
||||
},
|
||||
},
|
||||
spec = {
|
||||
{ '<leader>Q', group = '[Q]uit' },
|
||||
{ '<leader>c', group = '[c]ode' },
|
||||
{ '<leader>s', group = '[s]earch' },
|
||||
{ '<leader>S', group = '[S]ession' },
|
||||
{ '<leader>t', group = '[T]oggle' },
|
||||
{ '<leader>x', group = 'diagnostics/quickfi[x]' },
|
||||
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Neo-tree: File explorer
|
||||
-- Imported from kickstart/plugins/neo-tree.lua
|
||||
}
|
||||
406
lua/plugins/core/extras.lua
Normal file
406
lua/plugins/core/extras.lua
Normal file
|
|
@ -0,0 +1,406 @@
|
|||
-- ========================================================================
|
||||
-- COMMON PLUGINS - Loaded for all filetypes/profiles
|
||||
-- ========================================================================
|
||||
--
|
||||
-- This file contains plugins that are always loaded regardless of what
|
||||
-- file type you're working with. These are your "core" plugins that
|
||||
-- provide functionality across all your language profiles.
|
||||
--
|
||||
-- Examples: file explorers, git tools, common UI elements, copilot, etc.
|
||||
--
|
||||
-- See the kickstart.nvim README for more information
|
||||
-- ========================================================================
|
||||
|
||||
return {
|
||||
-- ========================================================================
|
||||
-- FILE EXPLORER - Neo-tree
|
||||
-- ========================================================================
|
||||
-- Neo-tree provides a modern file explorer sidebar similar to VS Code.
|
||||
-- It's loaded for all profiles so you can browse files regardless of
|
||||
-- what language you're working with.
|
||||
--
|
||||
-- Keybindings:
|
||||
-- \ (backslash) - Toggle Neo-tree file explorer
|
||||
-- Within Neo-tree:
|
||||
-- a - Add file/folder
|
||||
-- d - Delete
|
||||
-- r - Rename
|
||||
-- x - Cut
|
||||
-- c - Copy
|
||||
-- p - Paste
|
||||
-- ? - Show help (see all keybindings)
|
||||
--
|
||||
-- Note: This references the existing neo-tree configuration from
|
||||
-- kickstart/plugins/neo-tree.lua. We're just ensuring it's loaded.
|
||||
-- ========================================================================
|
||||
-- {
|
||||
-- 'nvim-neo-tree/neo-tree.nvim',
|
||||
-- version = '*',
|
||||
-- dependencies = {
|
||||
-- 'nvim-lua/plenary.nvim',
|
||||
-- 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
||||
-- 'MunifTanjim/nui.nvim',
|
||||
-- },
|
||||
-- cmd = 'Neotree', -- Lazy load on command
|
||||
-- keys = {
|
||||
-- { '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
|
||||
-- },
|
||||
-- opts = {
|
||||
-- filesystem = {
|
||||
-- window = {
|
||||
-- mappings = {
|
||||
-- ['\\'] = 'close_window',
|
||||
-- },
|
||||
-- },
|
||||
-- follow_current_file = {
|
||||
-- enabled = true, -- Focus on the current file when opening
|
||||
-- },
|
||||
-- hijack_netrw_behavior = 'open_current', -- Use neo-tree instead of netrw
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
|
||||
-- ========================================================================
|
||||
-- GITHUB COPILOT - AI pair programming assistant
|
||||
-- ========================================================================
|
||||
-- GitHub Copilot provides AI-powered code completions and suggestions.
|
||||
-- Works across all file types and integrates with your completion engine.
|
||||
--
|
||||
-- Setup:
|
||||
-- 1. After installing, run :Copilot setup
|
||||
-- 2. Follow the authentication flow
|
||||
-- 3. You'll need an active GitHub Copilot subscription
|
||||
--
|
||||
-- Usage:
|
||||
-- - Copilot suggestions appear automatically as you type
|
||||
-- - Press Tab to accept a suggestion
|
||||
-- - Press Ctrl+] to see next suggestion
|
||||
-- - Press Ctrl+[ to see previous suggestion
|
||||
-- - :Copilot panel - Open completion panel with multiple suggestions
|
||||
--
|
||||
-- Commands:
|
||||
-- :Copilot setup - Authenticate with GitHub
|
||||
-- :Copilot status - Check authentication status
|
||||
-- :Copilot enable - Enable Copilot
|
||||
-- :Copilot disable - Disable Copilot
|
||||
-- ========================================================================
|
||||
{
|
||||
'github/copilot.vim',
|
||||
lazy = false, -- Load immediately on startup (not lazy-loaded)
|
||||
config = function()
|
||||
-- Copilot keybindings (optional customization)
|
||||
-- By default, Tab accepts suggestions, but this might conflict with completion
|
||||
-- Uncomment below to use Ctrl+J to accept instead:
|
||||
-- vim.keymap.set('i', '<C-J>', 'copilot#Accept("\\<CR>")', {
|
||||
-- expr = true,
|
||||
-- replace_keycodes = false,
|
||||
-- })
|
||||
-- vim.g.copilot_no_tab_map = true
|
||||
|
||||
-- Optional: Disable Copilot for certain filetypes
|
||||
-- vim.g.copilot_filetypes = {
|
||||
-- ['*'] = true,
|
||||
-- ['markdown'] = false,
|
||||
-- ['text'] = false,
|
||||
-- }
|
||||
end,
|
||||
},
|
||||
|
||||
-- ========================================================================
|
||||
-- SMOOTH SCROLLING & ANIMATIONS - mini.animate
|
||||
-- ========================================================================
|
||||
-- Provides smooth scrolling and cursor animations for a better visual experience.
|
||||
--
|
||||
-- Features:
|
||||
-- - Smooth scrolling (when using Ctrl+D, Ctrl+U, etc.)
|
||||
-- - Cursor path animation when jumping
|
||||
-- - Window resize animations
|
||||
-- - Window open/close animations
|
||||
--
|
||||
-- All animations are non-blocking and can be customized or disabled independently.
|
||||
-- ========================================================================
|
||||
{
|
||||
'echasnovski/mini.animate',
|
||||
event = 'VeryLazy', -- Load after UI is ready
|
||||
opts = function()
|
||||
-- Don't use animate when scrolling with the mouse
|
||||
local mouse_scrolled = false
|
||||
for _, scroll in ipairs({ 'Up', 'Down' }) do
|
||||
local key = '<ScrollWheel' .. scroll .. '>'
|
||||
vim.keymap.set({ '', 'i' }, key, function()
|
||||
mouse_scrolled = true
|
||||
return key
|
||||
end, { expr = true })
|
||||
end
|
||||
|
||||
local animate = require('mini.animate')
|
||||
return {
|
||||
-- Cursor path animation - shows path when cursor jumps
|
||||
cursor = {
|
||||
enable = true,
|
||||
timing = animate.gen_timing.linear({ duration = 100, unit = 'total' }),
|
||||
},
|
||||
|
||||
-- Smooth scrolling
|
||||
scroll = {
|
||||
enable = true,
|
||||
timing = animate.gen_timing.linear({ duration = 150, unit = 'total' }),
|
||||
subscroll = animate.gen_subscroll.equal({
|
||||
predicate = function(total_scroll)
|
||||
if mouse_scrolled then
|
||||
mouse_scrolled = false
|
||||
return false
|
||||
end
|
||||
return total_scroll > 1
|
||||
end,
|
||||
}),
|
||||
},
|
||||
|
||||
-- Window resize animation
|
||||
resize = {
|
||||
enable = true,
|
||||
timing = animate.gen_timing.linear({ duration = 50, unit = 'total' }),
|
||||
},
|
||||
|
||||
-- Window open/close animation
|
||||
open = {
|
||||
enable = false, -- Disabled by default as it can be distracting
|
||||
timing = animate.gen_timing.linear({ duration = 150, unit = 'total' }),
|
||||
},
|
||||
|
||||
close = {
|
||||
enable = false, -- Disabled by default
|
||||
timing = animate.gen_timing.linear({ duration = 150, unit = 'total' }),
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- ========================================================================
|
||||
-- TROUBLE.NVIM - Beautiful diagnostics list (LazyVim-style)
|
||||
-- ========================================================================
|
||||
-- Provides a nice list view of diagnostics, quickfix, LSP references, etc.
|
||||
-- Shows errors inline in a dedicated panel like LazyVim/VS Code.
|
||||
-- Auto-opens when diagnostics are present to show errors in editor area.
|
||||
--
|
||||
-- Keymaps:
|
||||
-- <leader>xx - Toggle diagnostics list
|
||||
-- <leader>xX - Buffer diagnostics
|
||||
-- <leader>cs - Symbols list
|
||||
-- <leader>cl - LSP references
|
||||
-- <leader>xL - Location list
|
||||
-- <leader>xQ - Quickfix list
|
||||
-- [q / ]q - Previous/next item in trouble list
|
||||
-- ========================================================================
|
||||
{
|
||||
'folke/trouble.nvim',
|
||||
cmd = 'Trouble', -- Lazy load on command
|
||||
opts = {
|
||||
focus = false, -- Don't focus the window when opened (LazyVim behavior)
|
||||
auto_close = true, -- Auto close when no items
|
||||
auto_open = false, -- Don't auto open (we'll handle this with autocmd)
|
||||
warn_no_results = false,
|
||||
open_no_results = false,
|
||||
modes = {
|
||||
-- Configure the diagnostics mode to show in editor area
|
||||
diagnostics = {
|
||||
mode = 'diagnostics',
|
||||
preview = {
|
||||
type = 'split',
|
||||
relative = 'win',
|
||||
position = 'right',
|
||||
size = 0.3,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
'<leader>xx',
|
||||
'<cmd>Trouble diagnostics toggle<cr>',
|
||||
desc = 'Diagnostics (Trouble)',
|
||||
},
|
||||
{
|
||||
'<leader>xX',
|
||||
'<cmd>Trouble diagnostics toggle filter.buf=0<cr>',
|
||||
desc = 'Buffer Diagnostics (Trouble)',
|
||||
},
|
||||
{
|
||||
'<leader>cs',
|
||||
'<cmd>Trouble symbols toggle focus=false<cr>',
|
||||
desc = 'Symbols (Trouble)',
|
||||
},
|
||||
{
|
||||
'<leader>cl',
|
||||
'<cmd>Trouble lsp toggle focus=false win.position=right<cr>',
|
||||
desc = 'LSP Definitions / references / ... (Trouble)',
|
||||
},
|
||||
{
|
||||
'<leader>xL',
|
||||
'<cmd>Trouble loclist toggle<cr>',
|
||||
desc = 'Location List (Trouble)',
|
||||
},
|
||||
{
|
||||
'<leader>xQ',
|
||||
'<cmd>Trouble qflist toggle<cr>',
|
||||
desc = 'Quickfix List (Trouble)',
|
||||
},
|
||||
{
|
||||
'[q',
|
||||
function()
|
||||
if require('trouble').is_open() then
|
||||
require('trouble').prev({ skip_groups = true, jump = true })
|
||||
else
|
||||
local ok, err = pcall(vim.cmd.cprev)
|
||||
if not ok then
|
||||
vim.notify(err, vim.log.levels.ERROR)
|
||||
end
|
||||
end
|
||||
end,
|
||||
desc = 'Previous Trouble/Quickfix Item',
|
||||
},
|
||||
{
|
||||
']q',
|
||||
function()
|
||||
if require('trouble').is_open() then
|
||||
require('trouble').next({ skip_groups = true, jump = true })
|
||||
else
|
||||
local ok, err = pcall(vim.cmd.cnext)
|
||||
if not ok then
|
||||
vim.notify(err, vim.log.levels.ERROR)
|
||||
end
|
||||
end
|
||||
end,
|
||||
desc = 'Next Trouble/Quickfix Item',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- ========================================================================
|
||||
-- NOICE.NVIM - Better UI for messages, cmdline, and notifications
|
||||
-- ========================================================================
|
||||
-- Provides a modern UI for command line, messages, and notifications (LazyVim-style).
|
||||
-- Makes the editor feel more polished with popup notifications and floating cmdline.
|
||||
--
|
||||
-- Features:
|
||||
-- - Floating command line
|
||||
-- - Modern notification system
|
||||
-- - Better message display
|
||||
-- - Signature help while typing
|
||||
--
|
||||
-- Note: This can be disabled if you prefer the classic Vim UI
|
||||
-- ========================================================================
|
||||
{
|
||||
'folke/noice.nvim',
|
||||
event = 'VeryLazy',
|
||||
dependencies = {
|
||||
'MunifTanjim/nui.nvim',
|
||||
-- Optional: If you want to use `nvim-notify` for notifications
|
||||
-- 'rcarriga/nvim-notify',
|
||||
},
|
||||
opts = {
|
||||
lsp = {
|
||||
-- Override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||
override = {
|
||||
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
|
||||
['vim.lsp.util.stylize_markdown'] = true,
|
||||
['cmp.entry.get_documentation'] = true,
|
||||
},
|
||||
},
|
||||
-- Presets for easier configuration
|
||||
presets = {
|
||||
bottom_search = true, -- Use a classic bottom cmdline for search
|
||||
command_palette = true, -- Position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- Long messages will be sent to a split
|
||||
inc_rename = false, -- Enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = true, -- Add a border to hover docs and signature help
|
||||
},
|
||||
-- Routes configuration (optional customization)
|
||||
routes = {
|
||||
{
|
||||
filter = {
|
||||
event = 'msg_show',
|
||||
kind = '',
|
||||
find = 'written',
|
||||
},
|
||||
opts = { skip = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
'<leader>sn',
|
||||
'',
|
||||
desc = '+noice',
|
||||
},
|
||||
{
|
||||
'<leader>snl',
|
||||
function()
|
||||
require('noice').cmd('last')
|
||||
end,
|
||||
desc = 'Noice Last Message',
|
||||
},
|
||||
{
|
||||
'<leader>snh',
|
||||
function()
|
||||
require('noice').cmd('history')
|
||||
end,
|
||||
desc = 'Noice History',
|
||||
},
|
||||
{
|
||||
'<leader>sna',
|
||||
function()
|
||||
require('noice').cmd('all')
|
||||
end,
|
||||
desc = 'Noice All',
|
||||
},
|
||||
{
|
||||
'<leader>snd',
|
||||
function()
|
||||
require('noice').cmd('dismiss')
|
||||
end,
|
||||
desc = 'Dismiss All',
|
||||
},
|
||||
{
|
||||
'<c-f>',
|
||||
function()
|
||||
if not require('noice.lsp').scroll(4) then
|
||||
return '<c-f>'
|
||||
end
|
||||
end,
|
||||
silent = true,
|
||||
expr = true,
|
||||
desc = 'Scroll Forward',
|
||||
mode = { 'i', 'n', 's' },
|
||||
},
|
||||
{
|
||||
'<c-b>',
|
||||
function()
|
||||
if not require('noice.lsp').scroll(-4) then
|
||||
return '<c-b>'
|
||||
end
|
||||
end,
|
||||
silent = true,
|
||||
expr = true,
|
||||
desc = 'Scroll Backward',
|
||||
mode = { 'i', 'n', 's' },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- ========================================================================
|
||||
-- ADDITIONAL COMMON PLUGINS
|
||||
-- ========================================================================
|
||||
-- You can add more common plugins here that should be available across
|
||||
-- all language profiles. Examples:
|
||||
--
|
||||
-- - Better terminal integration
|
||||
-- - Git integration enhancements (beyond gitsigns in init.lua)
|
||||
-- - Session management
|
||||
-- - Project management
|
||||
-- - Alternative completion sources
|
||||
-- - UI enhancements
|
||||
--
|
||||
-- Just add them to this return table following the same pattern as above.
|
||||
-- ========================================================================
|
||||
}
|
||||
22
lua/plugins/core/git.lua
Normal file
22
lua/plugins/core/git.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
-- ========================================================================
|
||||
-- GIT INTEGRATION PLUGINS
|
||||
-- ========================================================================
|
||||
-- Git tools for version control
|
||||
-- - Gitsigns: Git decorations and utilities
|
||||
-- ========================================================================
|
||||
|
||||
return {
|
||||
-- Git signs in gutter and utilities for managing changes
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
81
lua/plugins/core/neo-tree.lua
Normal file
81
lua/plugins/core/neo-tree.lua
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
-- Neo-tree is a Neovim plugin to browse the file system
|
||||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||
|
||||
return {
|
||||
'nvim-neo-tree/neo-tree.nvim',
|
||||
version = '*',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
||||
'MunifTanjim/nui.nvim',
|
||||
},
|
||||
lazy = false,
|
||||
keys = {
|
||||
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
|
||||
},
|
||||
opts = {
|
||||
-- Don't open Neo-tree on startup, only when toggled
|
||||
close_if_last_window = true, -- Close Neo-tree if it's the last window
|
||||
popup_border_style = 'rounded',
|
||||
enable_git_status = true,
|
||||
enable_diagnostics = true,
|
||||
|
||||
-- Default to filesystem view
|
||||
default_component_configs = {
|
||||
indent = {
|
||||
padding = 0,
|
||||
},
|
||||
},
|
||||
|
||||
-- Global window mappings (apply to all Neo-tree windows)
|
||||
window = {
|
||||
mappings = {
|
||||
-- Disable <Space> for toggle_node to allow <leader> (Space) to work
|
||||
['<space>'] = 'none',
|
||||
-- Use <CR> (Enter) to toggle nodes instead (already default, but making it explicit)
|
||||
['<cr>'] = 'toggle_node',
|
||||
-- Use 'za' (vim fold toggle) as alternative for toggle node
|
||||
['za'] = 'toggle_node',
|
||||
},
|
||||
},
|
||||
|
||||
filesystem = {
|
||||
-- Follow the current file in the tree
|
||||
follow_current_file = {
|
||||
enabled = true,
|
||||
leave_dirs_open = false,
|
||||
},
|
||||
-- Use system commands for file operations
|
||||
use_libuv_file_watcher = true,
|
||||
|
||||
window = {
|
||||
position = 'left',
|
||||
width = 30,
|
||||
mappings = {
|
||||
['\\'] = 'close_window',
|
||||
-- Make <leader>sf work the same in Neo-tree as in editor
|
||||
['<leader>sf'] = 'telescope_find',
|
||||
['<leader>sg'] = 'telescope_grep',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Add custom commands for Telescope integration
|
||||
commands = {
|
||||
telescope_find = function(state)
|
||||
local node = state.tree:get_node()
|
||||
local path = node:get_id()
|
||||
require('telescope.builtin').find_files {
|
||||
cwd = vim.fn.isdirectory(path) == 1 and path or vim.fn.fnamemodify(path, ':h'),
|
||||
}
|
||||
end,
|
||||
telescope_grep = function(state)
|
||||
local node = state.tree:get_node()
|
||||
local path = node:get_id()
|
||||
require('telescope.builtin').live_grep {
|
||||
cwd = vim.fn.isdirectory(path) == 1 and path or vim.fn.fnamemodify(path, ':h'),
|
||||
}
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
105
lua/plugins/core/session.lua
Normal file
105
lua/plugins/core/session.lua
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
-- ========================================================================
|
||||
-- SESSION MANAGEMENT - Auto-save and restore your workspace
|
||||
-- ========================================================================
|
||||
--
|
||||
-- This plugin automatically saves your session (open files, window layout,
|
||||
-- buffers, etc.) when you quit Neovim and restores it when you reopen
|
||||
-- the same directory.
|
||||
--
|
||||
-- Features:
|
||||
-- - ✅ Auto-saves session on exit (automatically!)
|
||||
-- - ✅ Auto-restores session when you `cd` into a directory and run `nvim`
|
||||
-- - Saves per-directory (each project has its own session)
|
||||
-- - Saves open buffers, window splits, cursor positions, and more
|
||||
--
|
||||
-- IMPORTANT: Auto-restore works when you:
|
||||
-- 1. cd /path/to/your/project
|
||||
-- 2. nvim (without specifying files)
|
||||
--
|
||||
-- If you open a specific file (e.g., `nvim main.dart`), auto-restore is skipped.
|
||||
-- Use manual restore (<leader>Sr) if needed.
|
||||
--
|
||||
-- Keymaps:
|
||||
-- <leader>Ss - Save session manually
|
||||
-- <leader>Sr - Restore session manually (if auto-restore didn't trigger)
|
||||
-- <leader>Sd - Delete session for current directory
|
||||
-- <leader>Sf - Find/search all sessions (Telescope)
|
||||
--
|
||||
-- Quit keymaps (in init.lua, integrated with auto-session):
|
||||
-- <leader>Qa - Quit all and save session (most common)
|
||||
-- <leader>Qq - Force quit all without saving (no session save)
|
||||
-- <leader>Qw - Save all files, save session, then quit
|
||||
--
|
||||
-- WORKFLOW:
|
||||
-- 1. cd into your project directory
|
||||
-- 2. nvim (session auto-restores if it exists!)
|
||||
-- 3. Work on your project
|
||||
-- 4. Quit with <leader>Qa or just :qa (auto-saves!)
|
||||
-- 5. Next time: repeat from step 1 - your workspace is restored!
|
||||
--
|
||||
-- Sessions are saved in: ~/.local/share/nvim/sessions/
|
||||
-- ========================================================================
|
||||
|
||||
return {
|
||||
'rmagatti/auto-session',
|
||||
lazy = false, -- Load on startup to restore session
|
||||
opts = {
|
||||
-- Session save/restore options
|
||||
auto_session_enabled = true, -- Automatically save sessions on exit
|
||||
auto_restore_enabled = true, -- Automatically restore sessions on startup
|
||||
auto_save_enabled = true, -- Auto-save session on exit
|
||||
auto_session_suppress_dirs = { '~/', '~/Downloads', '/' }, -- Don't save sessions in these dirs
|
||||
auto_session_use_git_branch = false, -- One session per directory (not per git branch)
|
||||
|
||||
-- What to save in the session
|
||||
auto_session_enable_last_session = false, -- Don't restore last session if not in a project
|
||||
auto_session_create_enabled = true, -- Auto-create session on first save
|
||||
|
||||
-- Hooks to run before/after session save/restore
|
||||
pre_save_cmds = {
|
||||
'Neotree close', -- Close Neo-tree before saving session
|
||||
},
|
||||
post_restore_cmds = {
|
||||
-- You can add commands to run after restore here
|
||||
},
|
||||
|
||||
-- Session lens (Telescope integration for browsing sessions)
|
||||
session_lens = {
|
||||
load_on_setup = true,
|
||||
theme_conf = { border = true },
|
||||
previewer = false,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
-- Manual session control (Capital S to avoid conflict with search)
|
||||
{
|
||||
'<leader>Ss',
|
||||
'<cmd>AutoSession save<cr>',
|
||||
desc = '[S]ession: [S]ave',
|
||||
},
|
||||
{
|
||||
'<leader>Sr',
|
||||
'<cmd>AutoSession restore<cr>',
|
||||
desc = '[S]ession: [R]estore',
|
||||
},
|
||||
{
|
||||
'<leader>Sd',
|
||||
'<cmd>AutoSession delete<cr>',
|
||||
desc = '[S]ession: [D]elete',
|
||||
},
|
||||
{
|
||||
'<leader>Sf',
|
||||
'<cmd>AutoSession search<cr>',
|
||||
desc = '[S]ession: [F]ind/search',
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require('auto-session').setup(opts)
|
||||
|
||||
-- Register with which-key
|
||||
require('which-key').add {
|
||||
{ '<leader>s', group = '[S]ession' },
|
||||
{ '<leader>Q', group = '[Q]uit' },
|
||||
}
|
||||
end,
|
||||
}
|
||||
93
lua/plugins/core/ui.lua
Normal file
93
lua/plugins/core/ui.lua
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
-- ========================================================================
|
||||
-- UI PLUGINS
|
||||
-- ========================================================================
|
||||
-- Visual enhancements and UI components
|
||||
-- - Colorscheme: tokyonight
|
||||
-- - Statusline: mini.statusline
|
||||
-- - Treesitter: Syntax highlighting
|
||||
-- - Mini modules: Textobjects, surround, pairs
|
||||
-- - Todo comments: Highlight TODOs/FIXMEs
|
||||
-- ========================================================================
|
||||
|
||||
return {
|
||||
-- Colorscheme
|
||||
{
|
||||
'folke/tokyonight.nvim',
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require('tokyonight').setup {
|
||||
styles = {
|
||||
comments = { italic = false },
|
||||
},
|
||||
}
|
||||
vim.cmd.colorscheme 'tokyonight-night'
|
||||
end,
|
||||
},
|
||||
|
||||
-- Highlight todo, notes, etc in comments
|
||||
{
|
||||
'folke/todo-comments.nvim',
|
||||
event = 'VimEnter',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
opts = { signs = false },
|
||||
},
|
||||
|
||||
-- Mini.nvim collection
|
||||
{
|
||||
'echasnovski/mini.nvim',
|
||||
config = function()
|
||||
-- Better Around/Inside textobjects
|
||||
require('mini.ai').setup { n_lines = 500 }
|
||||
|
||||
-- Add/delete/replace surroundings (brackets, quotes, etc.)
|
||||
require('mini.surround').setup()
|
||||
|
||||
-- Autopairs - automatically close brackets, quotes, etc.
|
||||
require('mini.pairs').setup()
|
||||
|
||||
-- Simple and easy statusline
|
||||
local statusline = require 'mini.statusline'
|
||||
statusline.setup { use_icons = vim.g.have_nerd_font }
|
||||
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
statusline.section_location = function()
|
||||
return '%2l:%-2v'
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
-- Treesitter: Syntax highlighting and code understanding
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
main = 'nvim-treesitter.configs',
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
'bash',
|
||||
'c',
|
||||
'diff',
|
||||
'html',
|
||||
'lua',
|
||||
'luadoc',
|
||||
'markdown',
|
||||
'markdown_inline',
|
||||
'query',
|
||||
'vim',
|
||||
'vimdoc',
|
||||
'javascript',
|
||||
'typescript',
|
||||
'css',
|
||||
'json',
|
||||
},
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = { 'ruby' },
|
||||
},
|
||||
indent = { enable = true, disable = { 'ruby' } },
|
||||
fold = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue