Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Fix netrw and explorer features #380

Merged
merged 3 commits into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions lua/doom/core/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ g.loaded_matchparen = 1
g.loaded_logiPat = 1
g.loaded_rrhelper = 1

g.loaded_netrw = 1
g.loaded_netrwPlugin = 1
g.loaded_netrwSettings = 1
g.loaded_netrwFileHandlers = 1

-- Sets the `doom` global object
require("doom.core.doom_global")

Expand All @@ -38,6 +33,12 @@ local utils = require("doom.utils")
-- Boostraps the doom-nvim framework, runs the user's `config.lua` file.
local config = utils.safe_require("doom.core.config")
config.load()
if not utils.is_module_enabled("features", "netrw") then
g.loaded_netrw = 1
g.loaded_netrwPlugin = 1
g.loaded_netrwSettings = 1
g.loaded_netrwFileHandlers = 1
end

-- Load the colourscheme
utils.safe_require("doom.core.ui")
Expand Down
12 changes: 11 additions & 1 deletion lua/doom/modules/features/explorer/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ explorer.settings = {
view = {
width = 35,
side = "left",
auto_resize = true,
mappings = {
custom_only = false,
},
Expand Down Expand Up @@ -72,6 +71,7 @@ explorer.settings = {
},
actions = {
open_file = {
resize_window = true, -- previously view.auto_resize
window_picker = {
exclude = {
filetype = {
Expand All @@ -95,6 +95,7 @@ explorer.packages = {
["nvim-tree.lua"] = {
"kyazdani42/nvim-tree.lua",
commit = "7fcb48c852b9d58709169a4dc1ec634fa9ea56f9",
module = 'nvim-tree.api',
cmd = {
"NvimTreeClipboard",
"NvimTreeClose",
Expand Down Expand Up @@ -184,4 +185,13 @@ explorer.binds = {
},
}

explorer.autocmds = {
{"BufEnter", "*", function()
local name = vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf())
if vim.fn.isdirectory(name) == 1 then
require("nvim-tree.api").tree.change_root(name)
end
end}
}

return explorer