Skip to content
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

Not disable netrw #47

Closed
stsewd opened this issue Jun 21, 2020 · 9 comments
Closed

Not disable netrw #47

stsewd opened this issue Jun 21, 2020 · 9 comments

Comments

@stsewd
Copy link
Contributor

stsewd commented Jun 21, 2020

Is there a reason why netrw is being disabled? gx doesn't work without it in other buffers.

https://github.com/kyazdani42/nvim-tree.lua/blob/3bcfc70ea6759f40cc12e31e20f8b6c36f9ed2ac/plugin/tree.vim#L6-L7

@kyazdani42
Copy link
Member

well netrw opens automatically and it can conflict with other trees. I'll try and see if i can come up with a solution.

@kyazdani42
Copy link
Member

Well i'm sorry but i cannot enable the netrw, i don't really use the gx option, if you really want to use it in other buffers, feel free to implement it :) I have to disable netrw because i really have no use for it and its conflicting a lot with my workflow

@stsewd
Copy link
Contributor Author

stsewd commented Jun 21, 2020

Can we at least have an option for it? And btw, I'm writing a plugin to replace gx https://github.com/stsewd/gx-extended.vim if someone hits this, you can just install that plugin and gx should work just as the original gx in most cases.

@kyazdani42
Copy link
Member

if you do not disable netrw then it will open every time you do vim $DIR which will not be convenient at all. What would be your use cases to keep netrw ?

@stsewd
Copy link
Contributor Author

stsewd commented Jun 21, 2020

Mainly just to keep the original gx working. I don't use vim $DIR, so I'm fine if that doesn't work when enabling netrw.

@kyazdani42
Copy link
Member

well you can patch it locally if you want, but it seems weird to me that a tree viewer provides that kind of feature anyway. You could provide a global mapper with your gx plugin and not depend on the gx behaviour of netrw which would seem more adapted imo.

@stsewd
Copy link
Contributor Author

stsewd commented Jun 21, 2020

My plugin already maps gx globally, so I shouldn't need the original gx in most cases. But I think this should be mentioned in the docs at least, so users don't get a surprise when trying to use gx outside the tree.

@kyazdani42
Copy link
Member

i'll add that then :)

@kristijanhusak
Copy link
Contributor

Here's a mapping that will load netrw only on demand when using gx:

nnoremap gx :call <sid>open_url()<CR>

function! s:open_url() abort
  unlet! g:loaded_netrw
  unlet! g:loaded_netrwPlugin
  runtime! plugin/netrwPlugin.vim
  return netrw#BrowseX(expand('<cfile>'), netrw#CheckIfRemote())
endfunction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants