2 Komitmen 7a318c24b5 ... dcf85fc2bb

Pembuat SHA1 Pesan Tanggal
  Aleksei Dorokhov dcf85fc2bb Changed all stdpaths to point to nvim config directory 2 bulan lalu
  Aleksei Dorokhov 7de37f4ff8 Fix nvim-tree config warning 2 bulan lalu
2 mengubah file dengan 30 tambahan dan 1 penghapusan
  1. 3 0
      .gitignore
  2. 27 1
      init.lua

+ 3 - 0
.gitignore

@@ -1,3 +1,6 @@
 lazy-lock.json
 .netrwhist
+cache
+data
+state
 

+ 27 - 1
init.lua

@@ -2,6 +2,30 @@
 vim.g.loaded_netrw = 1
 vim.g.loaded_netrwPlugin = 1
 
+-- override stdpath locations, so that config is fully hermetic
+local orig_stdpath = vim.fn.stdpath
+vim.fn.stdpath = function(value)
+    local config_path = orig_stdpath("config")
+
+    if value == "config" then
+      return config_path
+    end
+
+    if value == "data" then
+        return config_path .. "/data"
+    end
+
+    if value == "cache" then
+      return config_path .. "/cache"
+    end
+
+    if value == "state" then
+      return config_path .. "/state"
+    end
+
+    return orig_stdpath(value)
+end
+
 -- package manager
 local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
 if not (vim.uv or vim.loop).fs_stat(lazypath) then
@@ -186,7 +210,9 @@ require("nvim-tree").setup({
   },
   on_attach = function (bufnr)
     local api = require "nvim-tree.api"
-    api.config.mappings.default_on_attach(bufnr)
+    --api.config.mappings.default_on_attach()
+    api.map.on_attach.default(bufnr)
+
     vim.keymap.set("n", ".", api.tree.change_root_to_node,
                    {noremap=true, silent=true, buffer=bufnr, nowait=true})
   end,