From b54fcf6cb6f2e6b0258c33db494c2ae9d037e597 Mon Sep 17 00:00:00 2001 From: Ivar Fatland Date: Sat, 14 Jun 2025 13:10:43 +0200 Subject: [PATCH] switch back to nvim-tree --- init.lua | 158 ++++++++----------------------------------------------- 1 file changed, 21 insertions(+), 137 deletions(-) diff --git a/init.lua b/init.lua index 5fbf710..d132c66 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,9 @@ ---@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' end @@ -102,143 +105,24 @@ 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, _) - 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", - }, - }) - 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 + { 'nvim-tree/nvim-tree.lua', --{{{2 + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + config = function() + local api = require "nvim-tree.api" + local function my_on_attach(bufnr) + local function opts(desc) return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } end + api.config.mappings.default_on_attach(bufnr) + vim.keymap.set('n', '-', api.tree.toggle, opts('Up')) + end + local function opts(desc) return { desc = "nvim-tree: " .. desc, noremap = true, silent = true, nowait = true } end + vim.keymap.set('n', '-', api.tree.toggle, opts('Up')) + + require("nvim-tree").setup { + on_attach = my_on_attach, + } + end, }, { 'github/copilot.vim', --{{{2 config = function()