Browse Source

fix(nvimtree): update nvim-tree setup (#2681)

Abouzar Parvan 3 years ago
parent
commit
7c53bd64c5

+ 30 - 30
lua/lvim/core/nvimtree.lua

@@ -2,7 +2,6 @@ local M = {}
 local Log = require "lvim.core.log"
 
 function M.config()
-  local vim_show_icons = lvim.use_icons and 1 or 0
   lvim.builtin.nvimtree = {
     active = true,
     on_config_done = nil,
@@ -76,7 +75,35 @@ function M.config()
         },
         icons = {
           webdev_colors = lvim.use_icons,
+          show = {
+            git = lvim.use_icons,
+            folder = lvim.use_icons,
+            file = lvim.use_icons,
+            folder_arrow = lvim.use_icons,
+          },
+          glyphs = {
+            default = "",
+            symlink = "",
+            git = {
+              unstaged = "",
+              staged = "S",
+              unmerged = "",
+              renamed = "➜",
+              deleted = "",
+              untracked = "U",
+              ignored = "◌",
+            },
+            folder = {
+              default = "",
+              open = "",
+              empty = "",
+              empty_open = "",
+              symlink = "",
+            },
+          },
         },
+        highlight_git = true,
+        root_folder_modifier = ":t",
       },
       filters = {
         dotfiles = false,
@@ -120,34 +147,6 @@ function M.config()
         },
       },
     },
-    show_icons = {
-      git = vim_show_icons,
-      folders = vim_show_icons,
-      files = vim_show_icons,
-      folder_arrows = vim_show_icons,
-    },
-    git_hl = 1,
-    root_folder_modifier = ":t",
-    icons = {
-      default = "",
-      symlink = "",
-      git = {
-        unstaged = "",
-        staged = "S",
-        unmerged = "",
-        renamed = "➜",
-        deleted = "",
-        untracked = "U",
-        ignored = "◌",
-      },
-      folder = {
-        default = "",
-        open = "",
-        empty = "",
-        empty_open = "",
-        symlink = "",
-      },
-    },
   }
   lvim.builtin.which_key.mappings["e"] = { "<cmd>NvimTreeToggle<CR>", "Explorer" }
 end
@@ -165,7 +164,7 @@ function M.setup()
 
   -- Implicitly update nvim-tree when project module is active
   if lvim.builtin.project.active then
-    lvim.builtin.nvimtree.respect_buf_cwd = 1
+    lvim.builtin.nvimtree.setup.respect_buf_cwd = true
     lvim.builtin.nvimtree.setup.update_cwd = true
     lvim.builtin.nvimtree.setup.update_focused_file = { enable = true, update_cwd = true }
   end
@@ -173,6 +172,7 @@ function M.setup()
   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

+ 20 - 20
snapshots/default.json

@@ -1,18 +1,18 @@
 {
   "Comment.nvim": {
-    "commit": "cc87c89"
+    "commit": "bdf9ca6"
   },
   "FixCursorHold.nvim": {
     "commit": "1bfb32e"
   },
   "LuaSnip": {
-    "commit": "08b06c3"
+    "commit": "52f4aed"
   },
   "alpha-nvim": {
     "commit": "4781fcf"
   },
   "bufferline.nvim": {
-    "commit": "82e3598"
+    "commit": "e2b1e99"
   },
   "cmp-buffer": {
     "commit": "12463cf"
@@ -30,52 +30,52 @@
     "commit": "bbda2b0"
   },
   "friendly-snippets": {
-    "commit": "02c92e3"
+    "commit": "974d792"
   },
   "gitsigns.nvim": {
-    "commit": "44372ff"
+    "commit": "27aeb2e"
   },
   "lua-dev.nvim": {
     "commit": "54149d1"
   },
   "lualine.nvim": {
-    "commit": "c12b167"
+    "commit": "3362b28"
   },
   "nlsp-settings.nvim": {
-    "commit": "7136038"
+    "commit": "4690da2"
   },
   "null-ls.nvim": {
-    "commit": "af19226"
+    "commit": "7b8560d"
   },
   "nvim-autopairs": {
-    "commit": "aea9131"
+    "commit": "b9cc0a2"
   },
   "nvim-cmp": {
     "commit": "033a817"
   },
   "nvim-dap": {
-    "commit": "a9c49a5"
+    "commit": "0062c19"
   },
   "nvim-lsp-installer": {
-    "commit": "a655bdd"
+    "commit": "d40cc5c"
   },
   "nvim-lspconfig": {
-    "commit": "b86a37c"
+    "commit": "84252b0"
   },
   "nvim-notify": {
     "commit": "c6ca279"
   },
   "nvim-tree.lua": {
-    "commit": "b2ba6de"
+    "commit": "2002b21"
   },
   "nvim-treesitter": {
-    "commit": "29b0ea8"
+    "commit": "5e24e8d"
   },
   "nvim-ts-context-commentstring": {
     "commit": "8834375"
   },
   "nvim-web-devicons": {
-    "commit": "0c5b6d1"
+    "commit": "8d2c533"
   },
   "onedarker.nvim": {
     "commit": "b00dd21"
@@ -90,22 +90,22 @@
     "commit": "b7404d3"
   },
   "project.nvim": {
-    "commit": "612443b"
+    "commit": "541115e"
   },
   "schemastore.nvim": {
-    "commit": "675ec50"
+    "commit": "af73c24"
   },
   "structlog.nvim": {
-    "commit": "6f1403a"
+    "commit": "232a8e2"
   },
   "telescope-fzf-native.nvim": {
     "commit": "2330a7e"
   },
   "telescope.nvim": {
-    "commit": "1a91238"
+    "commit": "54be102"
   },
   "toggleterm.nvim": {
-    "commit": "c525442"
+    "commit": "93c2f2c"
   },
   "which-key.nvim": {
     "commit": "f03a259"

+ 1 - 1
utils/installer/config.example.lua

@@ -61,7 +61,7 @@ lvim.builtin.alpha.mode = "dashboard"
 lvim.builtin.notify.active = true
 lvim.builtin.terminal.active = true
 lvim.builtin.nvimtree.setup.view.side = "left"
-lvim.builtin.nvimtree.show_icons.git = 0
+lvim.builtin.nvimtree.setup.renderer.icons.show.git = false
 
 -- if you don't want all the parsers change this to a table of the ones you want
 lvim.builtin.treesitter.ensure_installed = {

+ 2 - 2
utils/installer/config_win.example.lua

@@ -85,8 +85,8 @@ lvim.builtin.nvimtree.setup.git.enable = false
 lvim.builtin.nvimtree.setup.update_cwd = false
 lvim.builtin.nvimtree.setup.update_focused_file.update_cwd = false
 lvim.builtin.nvimtree.setup.view.side = "left"
-lvim.builtin.nvimtree.git_hl = false
-lvim.builtin.nvimtree.show_icons.git = 0
+lvim.builtin.nvimtree.setup.renderer.highlight_git = false
+lvim.builtin.nvimtree.setup.renderer.icons.show.git = false
 
 -- if you don't want all the parsers change this to a table of the ones you want
 lvim.builtin.treesitter.ensure_installed = {