From b1967bc6a13c7785cb89ec945c5e9f9d09dde54a Mon Sep 17 00:00:00 2001 From: ray Date: Tue, 7 Jul 2026 01:02:07 +0100 Subject: [PATCH] update --- LOG.md | 2 ++ MIGRATION_PLAN.md | 1 + README.md | 3 ++- lua/netrw-config.lua | 60 +++++++++++++++++++++++++++++++++++++++++ lua/plugins/lsp.lua | 4 +++ spell/en.utf-8.add | 20 ++++++++++++++ spell/en.utf-8.add.spl | Bin 9901 -> 10070 bytes 7 files changed, 89 insertions(+), 1 deletion(-) diff --git a/LOG.md b/LOG.md index 80518f2..0b8276a 100644 --- a/LOG.md +++ b/LOG.md @@ -30,6 +30,8 @@ Record every decision here with a short rationale. Append new entries; do not re - netrw for tree view and preview splits; Oil for operations that would break buffer names - PHP `gf` enhancement via `includeexpr` for WordPress/PHP path resolution - **Working directory locked to project root**: Disabled `autochdir`, set `netrw_keepdir = 1`, captured initial cwd in `vim.g.project_root`, configured Telescope to always search from project root regardless of current buffer +- 2026-07-06: **Alternate-buffer netrw skip**: Added a lightweight real-file buffer tracker and mapped ``/`` so alternate-buffer jumps skip netrw explorer buffers when `#` points at netrw. Netrw buffers are also marked unlisted on FileType to reduce their impact on buffer navigation while preserving netrw browsing behavior. Fallback uses explicit `:buffer #` instead of `:normal! ` so regular alternate-file switching still works from the Lua mapping. +- 2026-07-07: **Netrw alternate detection fix**: Real netrw alternate buffers can lose `filetype=netrw` and remain as an unlisted `NetrwTreeListing` buffer. The alternate-buffer skip now detects that buffer name as netrw so `` returns to the previous real file instead of reopening an empty explorer buffer. - 2025-12-07: Treesitter Phase 5 decisions: - Focus on core languages: PHP, HTML, JavaScript, TypeScript, CSS, Markdown, Lua, Bash, JSON - Enable syntax highlighting with performance safeguard (disable for files >100KB) diff --git a/MIGRATION_PLAN.md b/MIGRATION_PLAN.md index 001dc84..1286e61 100644 --- a/MIGRATION_PLAN.md +++ b/MIGRATION_PLAN.md @@ -481,6 +481,7 @@ Source of truth for the step-by-step rebuild. Keep this concise and up to date. - [ ] Validate netrw browsing and preview splits - [ ] Validate Oil.nvim file operations - [x] Fix working directory behavior (disabled autochdir, locked Telescope to project root) +- [x] Make alternate-buffer jumps skip netrw explorer buffers when returning to the last real file ## Phase 12.5 — Language tooling validation - [ ] Validate HTML/PHP/JS/Markdown tooling diff --git a/README.md b/README.md index b233d8d..067fc05 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ Core keymaps available globally (not plugin-specific). These provide fallbacks f | n | `nt` | Open netrw in new tab at current file's directory | | n | `nT` | Open netrw in new tab at project root | | n | `nr` | Open netrw in current window at project root | +| n | `` / `` | Jump to alternate file, skipping netrw explorer buffers | **Note:** Project root is stored as the initial working directory when Neovim starts. This allows navigation back to the project root even after following symlinks to external directories. @@ -504,4 +505,4 @@ The working directory (`:pwd`) is locked to the directory where you opened Neovi - `netrw_keepdir = 1` prevents netrw from changing directory when browsing - Project root is captured at startup in `vim.g.project_root` (used by Telescope and netrw) - Telescope searches from the initial project root regardless of current buffer -- Use `:cd ` to manually change directory if needed (affects Telescope search scope) \ No newline at end of file +- Use `:cd ` to manually change directory if needed (affects Telescope search scope) diff --git a/lua/netrw-config.lua b/lua/netrw-config.lua index de3e558..94b9fcd 100644 --- a/lua/netrw-config.lua +++ b/lua/netrw-config.lua @@ -1,4 +1,46 @@ local map = vim.keymap.set +local last_file_buf +local previous_file_buf + +local function is_real_file_buffer(buf) + return vim.api.nvim_buf_is_valid(buf) + and vim.bo[buf].buflisted + and vim.bo[buf].buftype == '' + and vim.bo[buf].filetype ~= 'netrw' + and vim.api.nvim_buf_get_name(buf) ~= '' +end + +local function is_netrw_buffer(buf) + if not vim.api.nvim_buf_is_valid(buf) then + return false + end + + return vim.bo[buf].filetype == 'netrw' or vim.api.nvim_buf_get_name(buf):match('NetrwTreeListing$') ~= nil +end + +local function switch_to_buffer(buf) + vim.cmd('buffer ' .. buf) +end + +local function switch_to_native_alternate() + pcall(vim.cmd, 'buffer #') +end + +local function jump_to_alternate_file() + local alternate = vim.fn.bufnr('#') + + if is_real_file_buffer(alternate) then + switch_to_buffer(alternate) + return + end + + if is_netrw_buffer(alternate) and is_real_file_buffer(previous_file_buf) then + switch_to_buffer(previous_file_buf) + return + end + + switch_to_native_alternate() +end -- Netrw configuration for file browsing -- Native Neovim file explorer (no plugins required) @@ -56,10 +98,28 @@ end, { desc = 'Netrw: Tab at project root', silent = true }) map('n', 'nr', function() vim.cmd('Explore ' .. vim.fn.fnameescape(vim.g.project_root)) end, { desc = 'Netrw: Open at project root', silent = true }) + +map('n', '', jump_to_alternate_file, { desc = 'Buffer: Alternate file skipping netrw', silent = true }) +map('n', '', jump_to_alternate_file, { desc = 'Buffer: Alternate file skipping netrw', silent = true }) + +vim.api.nvim_create_autocmd('BufEnter', { + desc = 'Track recent real file buffers for alternate-buffer jumps', + callback = function(args) + local buf = args.buf + + if is_real_file_buffer(buf) and buf ~= last_file_buf then + previous_file_buf = last_file_buf + last_file_buf = buf + end + end, +}) + -- Enable line numbers in netrw buffers vim.api.nvim_create_autocmd('FileType', { pattern = 'netrw', + desc = 'Configure netrw buffer-local options', callback = function() + vim.bo.buflisted = false vim.opt_local.number = true vim.opt_local.relativenumber = true end, diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index c8eed65..b208327 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -93,6 +93,10 @@ return { configure("bashls") configure("marksman") configure("intelephense", { + init_options = { + storagePath = vim.fn.stdpath("cache") .. "/intelephense", + globalStoragePath = vim.fn.stdpath("data") .. "/intelephense", + }, single_file_support = false, }) diff --git a/spell/en.utf-8.add b/spell/en.utf-8.add index bcf6093..285bde4 100644 --- a/spell/en.utf-8.add +++ b/spell/en.utf-8.add @@ -813,3 +813,23 @@ Jax APA RIS mathjax +wp +Imagick +Gipitty +sudo +render_box_row +microservices +Saa +tradeoffs +deduplication +signoff +wireframing +LOA +max +Nau +hardcode +NauSYS +rdv +Marmaris +EL2 +RigPro diff --git a/spell/en.utf-8.add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