diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2023-04-28 07:34:19 +0700 |
---|---|---|
committer | GitHub <[email protected]> | 2023-04-28 07:34:19 +0700 |
commit | 4cefc8950678e016c26da43ab66d3bd9ca8e62e4 (patch) | |
tree | 0ce03b83c228a8d40bf986c8b2e54eb2a992fb5c | |
parent | eaa3376802cdb7de54a07b84c8ebec3963572cda (diff) |
chore: bump plugins version (#4054)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: CPea <[email protected]>
-rw-r--r-- | lua/lvim/core/nvimtree.lua | 80 | ||||
-rw-r--r-- | snapshots/default.json | 48 |
2 files changed, 65 insertions, 63 deletions
diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua index 67bf803c..9e951303 100644 --- a/lua/lvim/core/nvimtree.lua +++ b/lua/lvim/core/nvimtree.lua @@ -17,7 +17,7 @@ function M.config() sync_root_with_cwd = true, reload_on_bufenter = false, respect_buf_cwd = false, - on_attach = "disable", + on_attach = "default", remove_keymaps = false, select_prompts = false, view = { @@ -30,10 +30,6 @@ function M.config() number = false, relativenumber = false, signcolumn = "yes", - mappings = { - custom_only = false, - list = {}, - }, float = { enable = false, quit_on_focus_loss = true, @@ -226,20 +222,51 @@ function M.config() } end +function M.start_telescope(telescope_mode) + local node = require("nvim-tree.lib").get_node_at_cursor() + local abspath = node.link_to or node.absolute_path + local is_folder = node.open ~= nil + local basedir = is_folder and abspath or vim.fn.fnamemodify(abspath, ":h") + require("telescope.builtin")[telescope_mode] { + cwd = basedir, + } +end + +local function on_attach(bufnr) + local api = require "nvim-tree.api" + + local function telescope_find_files(_) + require("lvim.core.nvimtree").start_telescope "find_files" + end + + local function telescope_live_grep(_) + require("lvim.core.nvimtree").start_telescope "live_grep" + end + + api.config.mappings.default_on_attach(bufnr) + + local useful_keys = { + ["l"] = api.node.open.edit, + ["o"] = api.node.open.edit, + ["<CR>"] = api.node.open.edit, + ["v"] = api.node.open.vertical, + ["h"] = api.node.navigate.parent_close, + ["C"] = api.tree.change_root_to_node, + ["gtg"] = telescope_live_grep, + ["gtf"] = telescope_find_files, + } + + require("lvim.keymappings").load_mode("n", useful_keys) +end + function M.setup() local status_ok, nvim_tree = pcall(require, "nvim-tree") + if not status_ok then Log:error "Failed to load nvim-tree" return end - if lvim.builtin.nvimtree._setup_called then - Log:debug "ignoring repeated setup call for nvim-tree, see kyazdani42/nvim-tree.lua#1308" - return - end - - lvim.builtin.nvimtree._setup_called = true - -- Implicitly update nvim-tree when project module is active if lvim.builtin.project.active then lvim.builtin.nvimtree.setup.respect_buf_cwd = true @@ -248,24 +275,9 @@ function M.setup() lvim.builtin.nvimtree.setup.update_focused_file.update_cwd = true end - local function telescope_find_files(_) - require("lvim.core.nvimtree").start_telescope "find_files" - end - - local function telescope_live_grep(_) - require("lvim.core.nvimtree").start_telescope "live_grep" - end - -- Add useful keymaps - if #lvim.builtin.nvimtree.setup.view.mappings.list == 0 then - lvim.builtin.nvimtree.setup.view.mappings.list = { - { key = { "l", "<CR>", "o" }, action = "edit", mode = "n" }, - { key = "h", action = "close_node" }, - { key = "v", action = "vsplit" }, - { key = "C", action = "cd" }, - { key = "gtf", action = "telescope_find_files", action_cb = telescope_find_files }, - { key = "gtg", action = "telescope_live_grep", action_cb = telescope_live_grep }, - } + if lvim.builtin.nvimtree.setup.on_attach == "default" then + lvim.builtin.nvimtree.setup.on_attach = on_attach end nvim_tree.setup(lvim.builtin.nvimtree.setup) @@ -275,14 +287,4 @@ function M.setup() end end -function M.start_telescope(telescope_mode) - local node = require("nvim-tree.lib").get_node_at_cursor() - local abspath = node.link_to or node.absolute_path - local is_folder = node.open ~= nil - local basedir = is_folder and abspath or vim.fn.fnamemodify(abspath, ":h") - require("telescope.builtin")[telescope_mode] { - cwd = basedir, - } -end - return M diff --git a/snapshots/default.json b/snapshots/default.json index 282fb72d..c50b0f3a 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -3,22 +3,22 @@ "commit": "a89339f" }, "LuaSnip": { - "commit": "a6355b1" + "commit": "e77fa9a" }, "alpha-nvim": { - "commit": "dafa11a" + "commit": "87c2040" }, "bigfile.nvim": { "commit": "c1bad34" }, "bufferline.nvim": { - "commit": "243893b" + "commit": "a4bd445" }, "cmp-buffer": { "commit": "3022dbc" }, "cmp-cmdline": { - "commit": "af88e70" + "commit": "5af1bb7" }, "cmp-nvim-lsp": { "commit": "0e6b2ed" @@ -30,16 +30,16 @@ "commit": "1809552" }, "friendly-snippets": { - "commit": "b1b78a6" + "commit": "631f79e" }, "gitsigns.nvim": { - "commit": "372d5cb" + "commit": "7dfe4be" }, "indent-blankline.nvim": { "commit": "018bd04" }, "lazy.nvim": { - "commit": "eddee83" + "commit": "903f0fe" }, "lir.nvim": { "commit": "1aa871f" @@ -51,46 +51,46 @@ "commit": "08bbc93" }, "mason-lspconfig.nvim": { - "commit": "6c8f7af" + "commit": "7276fff" }, "mason.nvim": { - "commit": "a1e01f3" + "commit": "253961c" }, "neodev.nvim": { - "commit": "ac2747f" + "commit": "fe48362" }, "nlsp-settings.nvim": { - "commit": "41a855c" + "commit": "32aa12d" }, "null-ls.nvim": { - "commit": "f8ffcd7" + "commit": "33b853a" }, "nvim-autopairs": { - "commit": "58985de" + "commit": "7566a86" }, "nvim-cmp": { - "commit": "777450f" + "commit": "11102d3" }, "nvim-dap": { - "commit": "debd7c2" + "commit": "6cedcb5" }, "nvim-dap-ui": { "commit": "286f682" }, "nvim-lspconfig": { - "commit": "eddaef9" + "commit": "427378a" }, "nvim-navic": { - "commit": "226c1c0" + "commit": "83dc174" }, "nvim-tree.lua": { - "commit": "8f392fa" + "commit": "bb375fb" }, "nvim-treesitter": { - "commit": "351e43d" + "commit": "08e8b2c" }, "nvim-ts-context-commentstring": { - "commit": "ada15e9" + "commit": "0bf8fbc" }, "nvim-web-devicons": { "commit": "4ec26d6" @@ -105,7 +105,7 @@ "commit": "8c6bad7" }, "schemastore.nvim": { - "commit": "a592fbe" + "commit": "0b396f5" }, "structlog.nvim": { "commit": "45b26a2" @@ -117,15 +117,15 @@ "commit": "9de317b" }, "toggleterm.nvim": { - "commit": "1c5996e" + "commit": "68fdf85" }, "tokyonight.nvim": { - "commit": "ef8f591" + "commit": "ab0ac67" }, "vim-illuminate": { "commit": "a290727" }, "which-key.nvim": { - "commit": "20fcd7b" + "commit": "4acffc9" } } |