nvim/lua/plugins/oil.lua

116 lines
3.6 KiB
Lua

-- Oil.nvim: file manipulation with buffer sync
-- Handles rename/move/delete operations that would break buffer names
-- Use when shell operations would cause buffer issues
return {
'stevearc/oil.nvim',
lazy = false,
keys = {
{ '<leader>fo', '<cmd>Oil<cr>', desc = 'Open Oil file browser' },
{ '<leader>fO', '<cmd>Oil --float<cr>', desc = 'Open Oil in floating window' },
},
opts = {
-- Columns shown in the oil buffer
columns = {
'icon',
-- 'permissions',
-- 'size',
-- 'mtime',
},
-- Buffer-local options to use for oil buffers
buf_options = {
buflisted = false,
bufhidden = 'hide',
},
-- 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',
},
-- Delete to trash instead of permanently deleting
delete_to_trash = false,
-- Skip confirmation for simple operations
skip_confirm_for_simple_edits = false,
-- Prompt before deleting a directory
prompt_save_on_select_new_entry = true,
-- Use default keymaps (see :help oil-actions)
use_default_keymaps = true,
-- Set to false to disable all of the above keymaps
keymaps = {
['g?'] = 'actions.show_help',
['<CR>'] = 'actions.select',
['<C-s>'] = 'actions.select_vsplit',
['<C-h>'] = 'actions.select_split',
['<C-t>'] = 'actions.select_tab',
-- Preview opens to the right via vertical split
['<C-p>'] = {
'actions.preview',
opts = { vertical = true, split = 'belowright' },
},
['<C-c>'] = 'actions.close',
['<C-l>'] = 'actions.refresh',
['-'] = 'actions.parent',
['_'] = 'actions.open_cwd',
['`'] = 'actions.cd',
['~'] = 'actions.tcd',
['gs'] = 'actions.change_sort',
['gx'] = 'actions.open_external',
['g.'] = 'actions.toggle_hidden',
['g\\'] = 'actions.toggle_trash',
},
-- Configuration for the floating window in oil.open_float
float = {
-- Padding around the floating window
padding = 2,
max_width = 0,
max_height = 0,
border = 'rounded',
win_options = {
winblend = 0,
},
-- Preview split direction for floating Oil windows
preview_split = "right",
},
-- Configuration for the actions floating preview window
preview = {
-- Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
max_width = 0.9,
-- min_width = {40, 0.4} means "the greater of 40 columns or 40% of total"
min_width = { 40, 0.4 },
-- optionally define an integer/float for the exact width of the preview window
width = nil,
-- Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
max_height = 0.9,
min_height = { 5, 0.1 },
height = nil,
border = 'rounded',
win_options = {
winblend = 0,
},
},
-- Preview split direction: "auto" (floating), "left", "right", "above", "below"
-- This setting is deprecated; use keymap opts or float.preview_split instead
-- preview_split = "right",
-- Configuration for the floating progress window
progress = {
max_width = 0.9,
min_width = { 40, 0.4 },
width = nil,
max_height = { 10, 0.9 },
min_height = { 5, 0.1 },
height = nil,
border = 'rounded',
minimized_border = 'none',
win_options = {
winblend = 0,
},
},
},
}