From 1a267ecef21782eac6751669627e06957521a2d3 Mon Sep 17 00:00:00 2001 From: Ivar Fatland Date: Tue, 6 May 2025 12:07:27 +0200 Subject: [PATCH] switched back to oil --- init.lua | 184 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 136 insertions(+), 48 deletions(-) diff --git a/init.lua b/init.lua index 356e61c..eb9c7e8 100644 --- a/init.lua +++ b/init.lua @@ -1,7 +1,5 @@ ---@diagnostic disable: missing-fields -- vim:foldmethod=marker -vim.g.loaded_netrw = 1 -vim.g.loaded_netrwPlugin = 1 local function get_python_venv_path() --{{{1 return vim.fn.stdpath('config') .. '/.venv/bin/python' @@ -113,6 +111,142 @@ end vim.opt.rtp:prepend(lazypath) require'lazy'.setup{ --{{{1 + { 'stevearc/oil.nvim', --{{{2 + ---@module 'oil' + ---@type oil.SetupOpts + opts = {}, + dependencies = { { "echasnovski/mini.icons", 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 = false, + keymaps = { + ["g?"] = { "actions.show_help", mode = "n" }, + [""] = "actions.select", + [""] = { "actions.select", opts = { vertical = true } }, + [""] = { "actions.select", opts = { horizontal = true } }, + [""] = { "actions.select", opts = { tab = true } }, + [""] = "actions.preview", + [""] = { "actions.close", mode = "n" }, + [""] = "actions.refresh", + ["-"] = { "actions.parent", mode = "n" }, + ["_"] = { "actions.open_cwd", mode = "n" }, + ["`"] = { "actions.cd", mode = "n" }, + ["~"] = { "actions.cd", opts = { scope = "tab" }, mode = "n" }, + ["gs"] = { "actions.change_sort", mode = "n" }, + ["gx"] = "actions.open_external", + ["g."] = { "actions.toggle_hidden", mode = "n" }, + ["g\\"] = { "actions.toggle_trash", mode = "n" }, + }, + use_default_keymaps = true, + view_options = { + show_hidden = true, + is_hidden_file = function(name, bufnr) + local m = name:match("^%.") + return m ~= nil + end, + is_always_hidden = function(name, bufnr) + return false + end, + natural_order = "fast", + case_insensitive = false, + sort = { + { "type", "asc" }, + { "name", "asc" }, + }, + highlight_filename = function(entry, is_hidden, is_link_target, is_link_orphan) + 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(filename) + 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", + }, + }) + vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory" }) + end + }, { 'github/copilot.vim', --{{{2 config = function() -- q for qomplete ;) @@ -174,52 +308,6 @@ require'lazy'.setup{ --{{{1 require'mini.align'.setup() end, }, - { 'nvim-tree/nvim-tree.lua', --{{{2 - dependencies = {"nvim-tree/nvim-web-devicons"}, - config = function () - local function my_on_attach(bufnr) - local api = require("nvim-tree.api") - api.config.mappings.default_on_attach(bufnr) - vim.keymap.set( - 'n', '-', api.tree.close, - { - desc = "nvim-tree: Toggle", - buffer = bufnr, - noremap = true, - silent = true, - nowait = true, - } - ) - if not api.tree.is_tree_buf(bufnr) then return end - vim.keymap.set( "n", '', api.node.open.no_window_picker, { desc = "nvim-tree: Open", buffer = bufnr, noremap = true, silent = true, nowait = true, }) - vim.keymap.set( "n", '', api.node.open.no_window_picker, { desc = "nvim-tree: Open", buffer = bufnr, noremap = true, silent = true, nowait = true, }) - end - - require'nvim-tree'.setup{ - on_attach = my_on_attach, - update_focused_file = { enable = true, }, - view = { - float = { - enable = true, - open_win_config = { - relative = "win", - border = "rounded", - }, - } - }, - } - local api = require("nvim-tree.api") - vim.keymap.set( - 'n', '-', api.tree.open, - { - desc = "nvim-tree: Toggle", - noremap = true, - silent = true, - nowait = true, - } - ) - end - }, { 'sainnhe/everforest', --{{{2 lazy = false, priority = 1000,