diff --git a/nvim/lua/config/nvim-tree.lua b/nvim/lua/config/nvim-tree.lua index 62319a1..2e37b76 100644 --- a/nvim/lua/config/nvim-tree.lua +++ b/nvim/lua/config/nvim-tree.lua @@ -1,5 +1,3 @@ -local map = require('utils').map - local function open_nvim_tree(data) -- buffer is a real file on the disk local real_file = vim.fn.filereadable(data.file) == 1 @@ -44,22 +42,6 @@ vim.api.nvim_create_autocmd("BufEnter", { layout[3] == nil then vim.cmd("confirm quit") end end }) --- --- This function has been generated from your --- view.mappings.list --- view.mappings.custom_only --- remove_keymaps --- --- You should add this function to your configuration and set on_attach = on_attach in the nvim-tree setup call. --- --- Although care was taken to ensure correctness and completeness, your review is required. --- --- Please check for the following issues in auto generated content: --- "Mappings removed" is as you expect --- "Mappings migrated" are correct --- --- Please see https://github.com/nvim-tree/nvim-tree.lua/wiki/Migrating-To-on_attach for assistance in migrating. --- local function on_attach(bufnr) local api = require('nvim-tree.api') @@ -68,13 +50,17 @@ local function on_attach(bufnr) return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } end + api.config.mappings.default_on_attach(bufnr) -- Mappings migrated from view.mappings.list -- You will need to insert "your code goes here" for any mappings with a custom action_cb vim.keymap.set('n', '', api.node.open.vertical, opts('Open: Vertical Split')) vim.keymap.set('n', '', api.node.open.horizontal, opts('Open: Horizontal Split')) vim.keymap.set('n', 'v', api.node.open.vertical, opts('Open: Vertical Split')) vim.keymap.set('n', 's', api.node.open.horizontal, opts('Open: Horizontal Split')) - + vim.keymap.set('n', 'P', function() + local node = api.tree.get_node_under_cursor() + print(node.absolute_path) + end, opts('Print Node Path')) end require('nvim-tree').setup({ diff --git a/nvim/lua/utils.lua b/nvim/lua/utils.lua index b5c5bb0..9e48683 100644 --- a/nvim/lua/utils.lua +++ b/nvim/lua/utils.lua @@ -1,15 +1,9 @@ local cmd = vim.cmd local o_s = vim.o local map_key = vim.api.nvim_set_keymap -local g = vim.g -local api = vim.api -local fn = vim.fn local ncmd = vim.api.nvim_command -local lsp = vim.lsp -local o, wo, bo = vim.o, vim.wo, vim.bo +local o = vim.o -local buffer = { o, bo } -local window = { o, wo } local function opt(o, v, scopes) scopes = scopes or { o_s }