diff --git a/lua/custom/plugins/filetree.lua b/lua/custom/plugins/filetree.lua deleted file mode 100644 index 9af950012e5..00000000000 --- a/lua/custom/plugins/filetree.lua +++ /dev/null @@ -1,49 +0,0 @@ --- Unless you are still migrating, remove the deprecated commands from v1.x -vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) - -return { - "nvim-neo-tree/neo-tree.nvim", - branch = "v2.x", - keys = { - { "op", "Neotree toggle", desc = "NeoTree" }, - }, - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - "MunifTanjim/nui.nvim", - }, - config = function() - require("neo-tree").setup({ - close_if_last_window = true, - enable_git_status = true, - follow_current_file = true, - hijack_netrw_behavior = -- "open_default", -- netrw disabled, opening a directory opens neo-tree - -- in whatever position is specified in window.position - -- "open_current", -- netrw disabled, opening a directory opens within the - -- window like netrw would, regardless of window.position - "disabled", -- netrw left alone, neo-tree does not handle opening dirs - use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes - -- instead of relying on nvim autocmd events - open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, - default_component_configs = { - git_status = { - symbols = { - -- Change type - added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name - modified = "", -- or "", but this is redundant info if you use git_status_colors on the name - deleted = "✖",-- this can only be used in the git_status source - renamed = "",-- this can only be used in the git_status source - -- Status type - untracked = "", - ignored = "", - unstaged = "", - staged = "", - conflict = "", - } - } - } - }) - - vim.cmd([[nnoremap \ :Neotree reveal]]) - end, - } diff --git a/lua/reymerk/remap.lua b/lua/reymerk/remap.lua index 8433ca3d32a..b65b9b43187 100644 --- a/lua/reymerk/remap.lua +++ b/lua/reymerk/remap.lua @@ -54,3 +54,21 @@ vim.keymap.set('t', "", ":FloatermHide") vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) +-- Open netrw in current file +vim.keymap.set('n', 'op', function () + local relative_path = vim.fn.expand("%:h") + local startPos, endPos = string.find(relative_path, "/") + if startPos == 1 then + relative_path = "." + end + vim.cmd [[:let @/=expand("%:t")]] + vim.cmd("Explore " .. relative_path) + if startPos > 1 then + while startPos ~= nil do + startPos, endPos = string.find(relative_path, "/", endPos + 1) + vim.cmd("call netrw#Call('NetrwBrowseUpDir', 1)") + end + vim.cmd("call netrw#Call('NetrwBrowseUpDir', 1)") + end + vim.cmd(":normal nzz") +end, { desc = "[O]pen [P]roject dir"}) diff --git a/lua/reymerk/set.lua b/lua/reymerk/set.lua index f5318b5cfcc..f5b4d0b9106 100644 --- a/lua/reymerk/set.lua +++ b/lua/reymerk/set.lua @@ -56,6 +56,8 @@ vim.opt.isfname:append("@-@") -- To setu the height of the suggestions (to not shoot all over the place) vim.opt.pumheight = 8; +-- To choose the best Netrw mode +vim.g.netrw_liststyle=3 -- [[ Basic Keymaps ]] -- Keymaps for better default experience