diff --git a/lua/keymaps.lua b/lua/keymaps.lua index d7029b7..2a254b2 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -14,16 +14,16 @@ local map = vim.keymap.set map('n', 'gd', function() -- Built-in: jump to definition via tags or included files vim.cmd("normal! gd") -end, { desc = 'Go to definition (built-in fallback)', silent = true }) +end, { desc = 'Vim: Go to definition (built-in fallback)', silent = true }) map('n', 'gD', function() -- Built-in: jump to declaration (global) vim.cmd("normal! gD") -end, { desc = 'Go to declaration (built-in fallback)', silent = true }) +end, { desc = 'Vim: Go to declaration (built-in fallback)', silent = true }) -- LSP-only keymaps (no useful fallback for these in non-LSP contexts) -map('n', 'gr', '', { desc = 'References (requires LSP)', silent = true }) -map('n', 'gI', '', { desc = 'Implementation (requires LSP)', silent = true }) +map('n', 'gr', '', { desc = 'LSP: References (requires LSP)', silent = true }) +map('n', 'gI', '', { desc = 'LSP: Implementation (requires LSP)', silent = true }) -- K: Hover/Help with sensible fallback map('n', 'K', function() @@ -32,20 +32,20 @@ map('n', 'K', function() if vim.bo.keywordprg ~= '' then vim.cmd("normal! K") end -end, { desc = 'Hover/Help (LSP or keywordprg fallback)', silent = true }) +end, { desc = 'Vim: Hover/Help (keywordprg fallback)', silent = true }) -- Diagnostic keymaps -map('n', 'xx', vim.diagnostic.setloclist, { desc = 'Show buffer diagnostics in location list', silent = true }) -map('n', 'xX', vim.diagnostic.setqflist, { desc = 'Show all diagnostics in quickfix', silent = true }) +map('n', 'xx', vim.diagnostic.setloclist, { desc = 'Diagnostics: Buffer diagnostics (location list)', silent = true }) +map('n', 'xX', vim.diagnostic.setqflist, { desc = 'Diagnostics: All diagnostics (quickfix)', silent = true }) map('n', 'xe', function() vim.diagnostic.setloclist({ severity = vim.diagnostic.severity.ERROR }) -end, { desc = 'Show buffer errors in location list', silent = true }) +end, { desc = 'Diagnostics: Buffer errors (location list)', silent = true }) map('n', 'xE', function() vim.diagnostic.setqflist({ severity = vim.diagnostic.severity.ERROR }) -end, { desc = 'Show all errors in quickfix', silent = true }) -map('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic', silent = true }) -map('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic', silent = true }) -map('n', 'xd', vim.diagnostic.open_float, { desc = 'Show diagnostic under cursor', silent = true }) +end, { desc = 'Diagnostics: All errors (quickfix)', silent = true }) +map('n', '[d', vim.diagnostic.goto_prev, { desc = 'Diagnostics: Previous diagnostic', silent = true }) +map('n', ']d', vim.diagnostic.goto_next, { desc = 'Diagnostics: Next diagnostic', silent = true }) +map('n', 'xd', vim.diagnostic.open_float, { desc = 'Diagnostics: Show diagnostic under cursor', silent = true }) -- Debug: Show highlight group and color under cursor map('n', 'hi', function() @@ -180,4 +180,4 @@ map('n', 'hi', function() } vim.api.nvim_open_win(buf, false, opts) -end, { desc = 'Show highlight group and color under cursor', silent = true }) +end, { desc = 'Debug: Show highlight group and color under cursor', silent = true }) diff --git a/lua/netrw-config.lua b/lua/netrw-config.lua index 22746b7..8f8870d 100644 --- a/lua/netrw-config.lua +++ b/lua/netrw-config.lua @@ -44,10 +44,18 @@ map('n', 'te', function() local current_file_dir = vim.fn.expand('%:p:h') vim.cmd('tabnew') vim.cmd('Explore ' .. vim.fn.fnameescape(current_file_dir)) -end, { desc = 'Tab explore (current file dir)', silent = true }) +end, { desc = 'Netrw: Tab explore (current file dir)', silent = true }) -- Open netrw in new tab at project root (cwd) map('n', 'tE', function() vim.cmd('tabnew') vim.cmd('Explore ' .. vim.fn.fnameescape(vim.fn.getcwd())) -end, { desc = 'Tab explore (project root)', silent = true }) \ No newline at end of file +end, { desc = 'Netrw: Tab explore (project root)', silent = true }) +-- Enable line numbers in netrw buffers +vim.api.nvim_create_autocmd('FileType', { + pattern = 'netrw', + callback = function() + vim.opt_local.number = true + vim.opt_local.relativenumber = true + end, +}) diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua index 475af29..cb7fa2f 100644 --- a/lua/plugins/gitsigns.lua +++ b/lua/plugins/gitsigns.lua @@ -30,28 +30,28 @@ return { if vim.wo.diff then return ']c' end vim.schedule(function() gs.next_hunk() end) return '' - end, { expr = true, desc = 'Next hunk' }) + end, { expr = true, desc = 'Gitsigns: Next hunk' }) map('n', '[h', function() if vim.wo.diff then return '[c' end vim.schedule(function() gs.prev_hunk() end) return '' - end, { expr = true, desc = 'Previous hunk' }) + end, { expr = true, desc = 'Gitsigns: Previous hunk' }) -- Hunk actions - map('n', 'hs', gs.stage_hunk, { desc = 'Stage hunk' }) - map('n', 'hr', gs.reset_hunk, { desc = 'Reset hunk' }) - map('v', 'hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end, { desc = 'Stage hunk' }) - map('v', 'hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end, { desc = 'Reset hunk' }) - map('n', 'hS', gs.stage_buffer, { desc = 'Stage buffer' }) - map('n', 'hu', gs.undo_stage_hunk, { desc = 'Undo stage hunk' }) - map('n', 'hR', gs.reset_buffer, { desc = 'Reset buffer' }) - map('n', 'hp', gs.preview_hunk, { desc = 'Preview hunk' }) - map('n', 'hd', gs.diffthis, { desc = 'Diff this' }) - map('n', 'hD', function() gs.diffthis('~') end, { desc = 'Diff this ~' }) + map('n', 'hs', gs.stage_hunk, { desc = 'Gitsigns: Stage hunk' }) + map('n', 'hr', gs.reset_hunk, { desc = 'Gitsigns: Reset hunk' }) + map('v', 'hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end, { desc = 'Gitsigns: Stage hunk' }) + map('v', 'hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end, { desc = 'Gitsigns: Reset hunk' }) + map('n', 'hS', gs.stage_buffer, { desc = 'Gitsigns: Stage buffer' }) + map('n', 'hu', gs.undo_stage_hunk, { desc = 'Gitsigns: Undo stage hunk' }) + map('n', 'hR', gs.reset_buffer, { desc = 'Gitsigns: Reset buffer' }) + map('n', 'hp', gs.preview_hunk, { desc = 'Gitsigns: Preview hunk' }) + map('n', 'hd', gs.diffthis, { desc = 'Gitsigns: Diff this' }) + map('n', 'hD', function() gs.diffthis('~') end, { desc = 'Gitsigns: Diff this ~' }) -- Text object - map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'Select hunk' }) + map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'Gitsigns: Select hunk' }) end, }, } diff --git a/lua/plugins/none-ls.lua b/lua/plugins/none-ls.lua index 9696965..bdb25d5 100644 --- a/lua/plugins/none-ls.lua +++ b/lua/plugins/none-ls.lua @@ -104,16 +104,16 @@ return { vim.g.format_on_save = not vim.g.format_on_save local status = vim.g.format_on_save and "enabled" or "disabled" vim.notify("Format on save " .. status, vim.log.levels.INFO) - end, { desc = "Toggle format on save", silent = true, noremap = true }) + end, { desc = "Formatting: Toggle format on save", silent = true, noremap = true }) -- Manual format (buffer) vim.keymap.set("n", "lf", function() vim.lsp.buf.format({ async = false }) - end, { desc = "Format buffer", silent = true, noremap = true }) + end, { desc = "Formatting: Format buffer", silent = true, noremap = true }) -- Manual format (visual range) vim.keymap.set("v", "lf", function() vim.lsp.buf.format({ async = false }) - end, { desc = "Format selection", silent = true, noremap = true }) + end, { desc = "Formatting: Format selection", silent = true, noremap = true }) end, } diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua index 685837c..1041373 100644 --- a/lua/plugins/oil.lua +++ b/lua/plugins/oil.lua @@ -4,12 +4,15 @@ return { 'stevearc/oil.nvim', - lazy = false, + -- set lazy loading + lazy = true, keys = { - { 'fo', 'Oil', desc = 'Open Oil file browser' }, - { 'fO', 'Oil --float', desc = 'Open Oil in floating window' }, + { 'fo', 'Oil', desc = 'Oil: Open file browser' }, + { 'fO', 'Oil --float', desc = 'Oil: Open in floating window' }, }, opts = { + -- Don't hijack netrw - allow both to coexist + default_file_explorer = false, -- Columns shown in the oil buffer columns = { 'icon', @@ -32,6 +35,8 @@ return { list = false, conceallevel = 3, concealcursor = 'nvic', + number = true, + relativenumber = true, }, -- Delete to trash instead of permanently deleting delete_to_trash = false, diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index bf4159d..1cc81d2 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -80,26 +80,30 @@ return { end, keys = { -- Find files in current working directory - { 'ff', 'Telescope find_files', desc = 'Find files' }, + { 'ff', 'Telescope find_files', desc = 'Telescope: Find files' }, -- Live grep (search text across project) - { 'fg', 'Telescope live_grep', desc = 'Live grep' }, + { 'fg', 'Telescope live_grep', desc = 'Telescope: Live grep' }, -- Search in open buffers - { 'fb', 'Telescope buffers', desc = 'Find buffers' }, + { 'fb', 'Telescope buffers', desc = 'Telescope: Find buffers' }, -- Search help tags - { 'fh', 'Telescope help_tags', desc = 'Find help' }, + { 'fh', 'Telescope help_tags', desc = 'Telescope: Find help' }, -- Recent files - { 'fr', 'Telescope oldfiles', desc = 'Recent files' }, + { 'fr', 'Telescope oldfiles', desc = 'Telescope: Recent files' }, -- Search current buffer - { '/', 'Telescope current_buffer_fuzzy_find', desc = 'Search buffer' }, + { '/', 'Telescope current_buffer_fuzzy_find', desc = 'Telescope: Search buffer' }, + + -- Search keymaps + { 'fk', 'Telescope keymaps', desc = 'Telescope: Find keymaps' }, + { '?', 'Telescope keymaps', desc = 'Telescope: Find keymaps' }, -- LSP-related pickers (optional, for when LSP is active) - { 'fs', 'Telescope lsp_document_symbols', desc = 'Document symbols' }, - { 'fS', 'Telescope lsp_dynamic_workspace_symbols', desc = 'Workspace symbols (dynamic)' }, + { 'fs', 'Telescope lsp_document_symbols', desc = 'Telescope: Document symbols' }, + { 'fS', 'Telescope lsp_dynamic_workspace_symbols', desc = 'Telescope: Workspace symbols' }, }, }, } diff --git a/lua/plugins/ufo.lua b/lua/plugins/ufo.lua index d5e053c..5920173 100644 --- a/lua/plugins/ufo.lua +++ b/lua/plugins/ufo.lua @@ -6,17 +6,17 @@ return { }, 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' }, + { 'zR', function() require('ufo').openAllFolds() end, desc = 'UFO: Open all folds' }, + { 'zM', function() require('ufo').closeAllFolds() end, desc = 'UFO: Close all folds' }, + { 'zr', function() require('ufo').openFoldsExceptKinds() end, desc = 'UFO: Open folds except kinds' }, + { 'zm', function() require('ufo').closeFoldsWith() end, desc = 'UFO: 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' }, + end, desc = 'UFO: Peek fold or LSP hover' }, }, opts = { provider_selector = function(bufnr, filetype, buftype) diff --git a/lua/plugins/undotree.lua b/lua/plugins/undotree.lua index 219cb92..6e43d24 100644 --- a/lua/plugins/undotree.lua +++ b/lua/plugins/undotree.lua @@ -3,7 +3,7 @@ return { 'mbbill/undotree', cmd = 'UndotreeToggle', -- Lazy load on command keys = { - { 'u', 'UndotreeToggle', desc = 'Toggle Undotree' }, + { 'u', 'UndotreeToggle', desc = 'Undotree: Toggle undo tree' }, }, config = function() -- Configure undotree diff --git a/test-diagnostics.php b/test-diagnostics.php index d82b9c0..cffaed4 100644 --- a/test-diagnostics.php +++ b/test-diagnostics.php @@ -1,8 +1,9 @@ someMethod(); // ERROR: Invalid array access (multiple levels) -$emptyArray = []; +$emptyArray = array(); echo $emptyArray['key']['nested']['deep']; // Valid function call -requiresTwoArgs("hello", "world"); +requiresTwoArgs( 'hello', 'world' ); // HINT/WARNING: Unreachable code (some configs) function hasDeadCode(): string { - return "done"; - echo "This is unreachable"; // Dead code + return 'done'; + echo 'This is unreachable'; // Dead code. } echo "Test complete!\n"; -