nvim-config/lua/custom/plugins/oil.lua

32 lines
693 B
Lua
Raw Normal View History

-- Fix oil absolute path to relative path conversion
vim.api.nvim_create_augroup('OilRelPathFix', {})
vim.api.nvim_create_autocmd('BufLeave', {
group = 'OilRelPathFix',
pattern = 'oil:///*',
callback = function()
vim.cmd 'cd .'
end,
})
2024-05-20 14:30:34 +00:00
return {
'stevearc/oil.nvim',
-- Optional dependencies
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function()
2024-08-01 08:58:47 +00:00
local oil = require 'oil'
oil.setup {
view_options = {
2024-08-01 08:58:47 +00:00
show_hidden = true,
},
}
vim.keymap.set('n', '<leader>fe', function()
if vim.bo.filetype == 'oil' then
oil.close()
else
oil.open()
end
end, { desc = '[F]ile [E]xplorer' })
2024-05-20 14:30:34 +00:00
end,
}