nvim/lua/plugins/oil.lua

69 lines
1.5 KiB
Lua

return {
'stevearc/oil.nvim',
-- lazy = false,
event = 'VeryLazy',
keys = {
{ '<leader>.', '<cmd>Oil<cr>', desc = 'oil' },
},
opts = {
delete_to_trash = true,
columns = {
'mtime',
'size',
'permissions',
'icon',
},
-- Buffer-local options to use for oil buffers
buf_options = {
buflisted = false,
},
-- Window-local options to use for oil buffers
win_options = {
wrap = false,
signcolumn = 'no',
cursorcolumn = false,
foldcolumn = '0',
spell = false,
list = false,
conceallevel = 3,
concealcursor = 'nvic',
},
keymaps = {
['g?'] = 'actions.show_help',
-- ['<CR>'] = 'actions.select',
['<CR>'] = function()
require('oil').select(nil, function(err)
if not err then
local curdir = require('oil').get_current_dir()
if curdir then
vim.cmd.lcd(curdir)
end
end
end)
end,
['<C-s>'] = 'actions.select_vsplit',
['<C-h>'] = 'actions.select_split',
['<C-p>'] = 'actions.preview',
['<TAB>'] = 'actions.preview',
['<C-c>'] = 'actions.close',
['q'] = 'actions.close',
['<C-l>'] = 'actions.refresh',
['-'] = 'actions.parent',
-- ['l'] = 'actions.parent',
['l'] = function()
require('oil.actions').parent.callback()
vim.cmd.lcd(require('oil').get_current_dir())
end,
['_'] = 'actions.open_cwd',
['`'] = 'actions.cd',
['~'] = 'actions.tcd',
['g.'] = 'actions.toggle_hidden',
['gh'] = function()
require('oil').open '~/'
vim.cmd.lcd(require('oil').get_current_dir())
end,
},
},
}