add netrw live previews and directory summaries
This commit is contained in:
parent
282e5e0f0b
commit
f31a9b7d74
6 changed files with 625 additions and 40 deletions
|
|
@ -1,4 +1,5 @@
|
|||
local map = vim.keymap.set
|
||||
local netrw_preview = require('netrw-preview')
|
||||
local last_file_buf
|
||||
local previous_file_buf
|
||||
|
||||
|
|
@ -78,7 +79,7 @@ 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)
|
||||
-- Preserve netrw's normal listing filter; toggle dotfile visibility with 'gh'
|
||||
vim.g.netrw_list_hide = [[^\.\.\=/\=$]]
|
||||
|
||||
-- Use human-readable file sizes
|
||||
|
|
@ -123,8 +124,17 @@ vim.api.nvim_create_autocmd('FileType', {
|
|||
pattern = 'netrw',
|
||||
desc = 'Configure netrw buffer-local options',
|
||||
callback = function()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
vim.bo.buflisted = false
|
||||
vim.opt_local.number = true
|
||||
vim.opt_local.relativenumber = true
|
||||
|
||||
-- netrw installs its own buffer mappings while building the listing.
|
||||
-- Apply the preview extension after that setup has finished.
|
||||
vim.schedule(function()
|
||||
if is_valid_buffer(buf) and vim.bo[buf].filetype == 'netrw' then
|
||||
netrw_preview.setup(buf)
|
||||
end
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue