This commit is contained in:
Ray Elliott 2026-07-07 01:02:07 +01:00
parent 21d788c46e
commit b1967bc6a1
7 changed files with 89 additions and 1 deletions

2
LOG.md
View File

@ -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 `<C-6>`/`<C-^>` 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! <C-^>` 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 `<C-6>` 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)

View File

@ -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

View File

@ -74,6 +74,7 @@ Core keymaps available globally (not plugin-specific). These provide fallbacks f
| n | `<leader>nt` | Open netrw in new tab at current file's directory |
| n | `<leader>nT` | Open netrw in new tab at project root |
| n | `<leader>nr` | Open netrw in current window at project root |
| n | `<C-6>` / `<C-^>` | 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.

View File

@ -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', '<leader>nr', function()
vim.cmd('Explore ' .. vim.fn.fnameescape(vim.g.project_root))
end, { desc = 'Netrw: Open at project root', silent = true })
map('n', '<C-6>', jump_to_alternate_file, { desc = 'Buffer: Alternate file skipping netrw', silent = true })
map('n', '<C-^>', 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,

View File

@ -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,
})

View File

@ -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

Binary file not shown.