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

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'