This commit is contained in:
Ray Elliott 2025-12-07 18:53:18 +00:00
parent 770c9ae01f
commit b247db8531
4 changed files with 48 additions and 2 deletions

View File

@ -116,8 +116,9 @@ Source of truth for the step-by-step rebuild. Keep this concise and up to date.
- [x] Note: Oil.nvim is for evaluation; alternative is mini.files if too heavy
## Phase 4.2 — Configure netrw
- [ ] Configure netrw with tree view, preview split, and basic settings (no banner, sensible defaults)
- [ ] Add simple keymaps for opening netrw (e.g., in split, tab, or current window)
- [x] Configure netrw with tree view, preview split, and basic settings (no banner, sensible defaults)
- [x] Created `lua/netrw-config.lua` with settings: tree view, preview split, 25% width, human-readable sizes
- [x] Add simple keymaps for opening netrw: `<leader>e` (current window), `<leader>v` (vertical split), `<leader>te` (new tab)
## Phase 4.2.1 — PHP gf enhancement
- [x] Add PHP `includeexpr` for intelligent `gf` behavior (handles `__DIR__`, `__FILE__`, `dirname(__FILE__)` patterns)

View File

@ -4,6 +4,7 @@ vim.g.maplocalleader = ' '
-- Load basic settings, keymaps, autocmds (kept minimal for now)
require('settings')
require('netrw-config')
require('keymaps')
require('autocmds')

View File

@ -39,4 +39,11 @@ map('n', 'K', function()
if lsp_has(0, 'hoverProvider') then vim.lsp.buf.hover() end
end, { desc = 'Hover (LSP)', silent = true })
-- Netrw file explorer keymaps
-- Open netrw in new tab at current file's directory
map('n', '<leader>te', function()
vim.cmd('tabnew')
vim.cmd('Explore ' .. vim.fn.expand('%:p:h'))
end, { desc = 'Tab explore (netrw in new tab)', silent = true })
return {}

37
lua/netrw-config.lua Normal file
View File

@ -0,0 +1,37 @@
-- Netrw configuration for file browsing
-- Native Neovim file explorer (no plugins required)
-- Hide the banner (that annoying help text at the top)
vim.g.netrw_banner = 0
-- Tree view by default (3 = tree style)
-- Options: 0=thin, 1=long, 2=wide, 3=tree
vim.g.netrw_liststyle = 3
-- Preview in horizontal split (underneath)
vim.g.netrw_preview = 0
-- Open preview splits below (1=below, 0=above)
vim.g.netrw_alto = 0
-- Window size for preview splits (percentage for preview window)
-- 50% split when pressing 'p'
vim.g.netrw_winsize = 50
-- Keep the current directory and browsing directory synced
-- This makes netrw respect your current working directory
vim.g.netrw_keepdir = 0
-- Open files in the same window (replace netrw buffer)
-- Options: 0=same window, 1=horizontal split, 2=vertical split, 3=new tab, 4=previous window
-- Using 0 so Enter opens file in netrw window itself
vim.g.netrw_browse_split = 0
-- Sort order: name (empty), time (t), size (s), exten (e)
vim.g.netrw_sort_by = 'name'
-- Hide dotfiles by default (toggle with 'gh' in netrw)
vim.g.netrw_list_hide = [[^\.\.\=/\=$]]
-- Use human-readable file sizes
vim.g.netrw_sizestyle = 'H'