-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
delete netrw FileExplorer function instead of fully disabling #18
Comments
I found the code responsible for disabling netrw. When commenting it out it seems fine ( |
I believe the most optimal solution would be to hijack netrw FileExplorer instead of fully disabling it. You may find useful this reddit thread. I am not a lua or vimscript dev, so sorry I can't even make that work because its in vimscript. |
I tried to convert some of that code into lua and I got the functionality I expect. vim.api.nvim_create_autocmd("VimEnter", {
pattern = { "*" },
command = "silent! autocmd! FileExplorer",
}) Essentially while The only thing is that idk how to convert autocmd deletion to lua. I am also not sure if it works in all the cases? |
diff --git a/lua/ranger-nvim.lua b/lua/ranger-nvim.lua
index 3b18880..2e3bdb1 100644
--- a/lua/ranger-nvim.lua
+++ b/lua/ranger-nvim.lua
@@ -213,11 +213,12 @@ end
---Disable and replace netrw with ranger.
local function replace_netrw()
- vim.g.loaded_netrw = 1
- vim.g.loaded_netrwPlugin = 1
vim.api.nvim_create_autocmd("VimEnter", {
pattern = "*",
callback = function()
+ if vim.fn.exists("#FileExplorer") then
+ vim.api.nvim_create_augroup("FileExplorer", { clear = true })
+ end
if vim.fn.isdirectory(vim.fn.argv(0)) == 1 then
M.open(false)
end There you go. Got from stevearc/oil.nvim#182 (comment) |
I recently was trying to figure out why I am not able to use open URL under cursor default neovim functionality. At some point I realized that I have set the option
replace_netrw = true
. When setting back to false thegx
mapping functionality is as expected.Does ranger.nvim fully disable netrw when set to replace it? Does it replace all netrw functionality? It doesn't seem so,
gx
mapping doesn't error, it just does nothing.Maybe it would be possible for ranger.nvim to also replace this functionality of netrw (also hook up rifle for opening files)? Or maybe not disable netrw? It should be possible because plugins like neo-tree.nvim replace netrw directory browsing functionality without disabling it.
I actually really like this replace_netrw option, so I would not prefer to set it to false, but I still want
gx
mapping functionality.The text was updated successfully, but these errors were encountered: