diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index 0d5db2d..ce1fb31 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -8,11 +8,6 @@ vim.g.python3_host_prog = get_python_venv_path() -- GENERAL SETTINGS {{{1 vim.cmd [=[ - - let g:netrw_banner = 0 - nnoremap - :E - nnoremap _ :execute 'Explore ' . fnameescape(getcwd()) - colorscheme quiet set autowriteall set exrc @@ -359,6 +354,148 @@ end vim.opt.rtp:prepend(lazypath) require'lazy'.setup{ --{{{1 + { 'stevearc/oil.nvim', --{{{2 + ---@module 'oil' + ---@type oil.SetupOpts + opts = {}, + lazy = false, + config = function () + require('oil').setup({ + default_file_explorer = true, + columns = { + 'icon', + 'permissions', + 'size', + 'mtime', + }, + buf_options = { + buflisted = false, + bufhidden = 'hide', + }, + win_options = { + wrap = false, + signcolumn = 'no', + cursorcolumn = false, + foldcolumn = '0', + spell = false, + list = false, + conceallevel = 3, + concealcursor = 'nvic', + }, + delete_to_trash = false, + skip_confirm_for_simple_edits = false, + prompt_save_on_select_new_entry = true, + cleanup_delay_ms = 2000, + lsp_file_methods = { + enabled = true, + timeout_ms = 1000, + autosave_changes = false, + }, + constrain_cursor = 'editable', + watch_for_changes = true, + keymaps = { + ['g?'] = { 'actions.show_help', mode = 'n' }, + [''] = { 'actions.yank_entry', opts = { modify=":." }, mode = 'n' }, -- :. makes it a relative path + [''] = false, [''] = false, [''] = false, [''] = false, -- I use those keys for navigation + [''] = 'actions.select', + ['-'] = { 'actions.parent', mode = 'n' }, + ['_'] = { 'actions.open_cwd', mode = 'n' }, + [',cd'] = { 'actions.cd', mode = 'n' }, + [',CD'] = { 'actions.cd', opts = { scope = 'tab' }, mode = 'n' }, + ['gx'] = 'actions.open_external', + ['g.'] = { 'actions.toggle_hidden', mode = 'n' }, + }, + use_default_keymaps = true, + view_options = { + show_hidden = true, + is_hidden_file = function(name, _) + local m = name:match('^%.') + return m ~= nil + end, + is_always_hidden = function(_, _) + return false + end, + natural_order = 'fast', + case_insensitive = false, + sort = { + { 'type', 'asc' }, + { 'name', 'asc' }, + }, + highlight_filename = function(_, _, _, _) + return nil + end, + }, + extra_scp_args = {}, + float = { + padding = 2, + max_width = 0, + max_height = 0, + border = 'rounded', + win_options = { + winblend = 0, + }, + get_win_title = nil, + preview_split = 'auto', + override = function(conf) + return conf + end, + }, + preview_win = { + update_on_cursor_moved = true, + preview_method = 'fast_scratch', + disable_preview = function(_) + return false + end, + win_options = {}, + }, + confirmation = { + max_width = 0.9, + min_width = { 40, 0.4 }, + width = nil, + max_height = 0.9, + min_height = { 5, 0.1 }, + height = nil, + border = 'rounded', + win_options = { + winblend = 0, + }, + }, + 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, + }, + }, + ssh = { + border = 'rounded', + }, + keymaps_help = { + border = 'rounded', + }, + }) + + -- oil fix relative path + vim.api.nvim_create_augroup('OilRelPathFix', {}) + vim.api.nvim_create_autocmd('BufLeave', { + group = 'OilRelPathFix', + pattern = 'oil:///*', + callback = function () + vim.cmd('cd .') + end + }) + + local actions = require('oil.actions') + vim.keymap.set('n', '-', actions.parent.callback, { desc = actions.parent.desc }) + vim.keymap.set('n', '_', actions.open_cwd.callback, { desc = actions.open_cwd.desc }) + end + }, { 'f-person/git-blame.nvim', --{{{2 keys = {',g'}, config = function ()