add oil.nvim

This commit is contained in:
Zoty 2026-04-07 13:42:08 -03:00
parent d65c4083ba
commit 09aa20cf59
Signed by: Zoty
SSH key fingerprint: SHA256:WsGEGivgl37t3Mth6uugXMOgMCTR7QolIepNbC+j/tA
4 changed files with 71 additions and 1 deletions

65
lua/plugins/oil.lua Normal file
View file

@ -0,0 +1,65 @@
return {
'stevearc/oil.nvim',
lazy = false,
dependencies = { 'nvim-tree/nvim-web-devicons' },
---@module 'oil'
---@type oil.SetupOpts
opts = {
-- Substitutes netrw as the default browser
default_file_explorer = true,
-- Visible buffer columns
columns = {
'icon',
-- 'permissions',
-- 'size',
-- 'mtime',
},
-- Oil buffer options
buf_options = {
buflisted = false,
bufhidden = 'hide',
},
-- Floating window
float = {
padding = 2,
max_width = 80,
max_height = 30,
border = 'rounded',
win_options = {
winblend = 0,
},
},
view_options = {
show_hidden = true, -- show hidden files/dirs
is_always_hidden = function(name, _)
-- always hide the .git dir
return name == '.git'
end
},
keymaps = {
['g?'] = 'actions.show_help',
['<CR>'] = 'actions.select',
['<C-v>'] = 'actions.select_vsplit',
['<C-s>'] = 'actions.select_split',
['<C-t>'] = 'actions.select_tab',
['<C-p>'] = 'actions.preview',
['<C-c>'] = 'actions.close',
['<C-r>'] = 'actions.refresh',
['-'] = 'actions.parent',
['_'] = 'actions.open_cwd',
['g.'] = 'actions.toggle_hidden',
},
use_default_keymaps = false,
},
keys = {
{ '-', '<cmd>Oil<cr>', desc = 'Open parent directory' },
{ '<leader>-', function() require('oil').open_float() end, desc = 'Open parent directory (float)' }
}
}