From ac83f1d580e40fa1cdcb76b3684b456a6c24f0d3 Mon Sep 17 00:00:00 2001
From: siduck76 <siduckk76@protonmail.com>
Date: Mon, 23 Aug 2021 16:44:52 +0530
Subject: [PATCH] add mapping to focus nvimtree (349)

---
 lua/core/mappings.lua  | 1 +
 lua/default_config.lua | 6 ++++--
 lua/plugins/init.lua   | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua
index 9722b4e..358c843 100644
--- a/lua/core/mappings.lua
+++ b/lua/core/mappings.lua
@@ -158,6 +158,7 @@ end
 
 M.nvimtree = function()
    map("n", plugin_maps.nvimtree.toggle, ":NvimTreeToggle <CR>", opt)
+   map("n", plugin_maps.nvimtree.focus,  ":NvimTreeFocus <CR>", opt)
 end
 
 M.neoformat = function()
diff --git a/lua/default_config.lua b/lua/default_config.lua
index 1f5df32..afa0370 100644
--- a/lua/default_config.lua
+++ b/lua/default_config.lua
@@ -157,14 +157,16 @@ M.mappings.plugin = {
       new_file = "<leader>fn", -- basically create a new buffer
       open = "<leader>db", -- open dashboard
       session_load = "<leader>l", -- load a saved session
-      session_save = "<leader>s", -- save a session
+      session_save = "<leader>s",
    },
    -- note: this is an edditional mapping to escape, escape key will still work
    better_escape = {
       esc_insertmode = { "jk" }, -- multiple mappings allowed
    },
    nvimtree = {
-      toggle = "<C-n>", -- file manager
+      -- file tree
+      toggle = "<C-n>",
+      focus = "<C-h>",
    },
    neoformat = {
       format = "<leader>fm",
diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua
index e652089..3ecf339 100644
--- a/lua/plugins/init.lua
+++ b/lua/plugins/init.lua
@@ -247,7 +247,7 @@ return packer.startup(function()
    -- file managing , picker etc
    use {
       "kyazdani42/nvim-tree.lua",
-      cmd = "NvimTreeToggle",
+      cmd = {"NvimTreeToggle", "NvimTreeFocus"},
       config = function()
          require "plugins.configs.nvimtree"
       end,