local map = vim.keymap.set -- 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' -- Netrw file explorer keymaps -- Open netrw in new tab at current file's directory 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 }) -- 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 })