Giter Club home page Giter Club logo

Comments (14)

akinsho avatar akinsho commented on April 28, 2024 2

Ah I actually didn't really mean more than one workspace tbh, although if you mean like vscode that might be cool. I basically just meant when you open Lua Tree in a buffer the root directory should be the one of the current buffer. I tried master but it didn't resolve it unfortunately. I made a PR #13 which works for me locally. Let me know what you think 👍

from nvim-tree.lua.

akinsho avatar akinsho commented on April 28, 2024

If you point me in the right direction I can take a look if that would help? Might take me a bit to figure out how it works first

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 28, 2024

Thanks for making so detailed issues :)
Well i can take a look, the code is a little bit nasty imo so it might be easier for me to fix this !

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 28, 2024

i hate lua regex matching.
If it's not fixed on your end, reopen this

from nvim-tree.lua.

akinsho avatar akinsho commented on April 28, 2024

Thanks for the quick PR @kyazdani42 just tested it locally and seems to still be happening

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 28, 2024

mmh strange i cannot reproduce the issue anymore.
Well if you want to take a look at the find_file function in lua/lib/state.lua, your issue should be located around

if node.relpath and relpath:find(utils.path_to_matching_str(node.relpath)) then

where relpath is the relative path of the node, and path_to_matching_str a function replacing - and . characters with %- and %. for lua to match paths properly in string:find.
The function itself is a bit clunky, but the only part that failed me a few times is this if condition.

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 28, 2024

Are you running macos or linux ?

from nvim-tree.lua.

akinsho avatar akinsho commented on April 28, 2024

Are you running macos or linux ?

I'm on Ubuntu 20.04

It looks like lua tree uses the dir that vim was opened from and sticks with that regardless of what buffer you are in, not sure if that is the intended behaviour?

My assumption was that if I opened vim in say ~/myproject/ it would change the lua tree dir depending on the buffer I was editing. In my case I navigated to ~/.dotfiles/vim/init.vim so I expected the root dir would change to either be ~/.dotfiles since it is a repo but granted doing project dirs is maybe an extra feature, then maybe the root dir would be ~/.dotfiles/vim but the lua tree stays in ~/myproject/.

from nvim-tree.lua.

akinsho avatar akinsho commented on April 28, 2024

Alternatively maybe lua tree should just follow vim's dir and then users can use settings like autochdir or plugins like vim-rooter 🤷

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 28, 2024

So it is a different kind of issue, indeed this plugin uses the default dir where it was opened.
I stick with that because sometimes i'm in a project, and i want to open the tree in a subdirectory (and i dont want the tree to go to the root of the project).
I could add an option for that though, should be simple to fix.

Also multiple projects is a feature i didn't think about, but it would be quite hard to implement in the current state, it would require a different implementation.
I was thinking of doing a big refactoring soon, to make the code better and the plugin more stable, and i'd also like to use vim nightly features (because its much more convenient).
I might add the feature to the refactoring if i find a proper way to implement it.

from nvim-tree.lua.

akinsho avatar akinsho commented on April 28, 2024

One way that I've seen this solved is in defx you can pass an argument to the launch command like LuaTree --path=("user_finds_path") maybe that's a cheaper way to solve the problem or maybe it's just as complex, not sure

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 28, 2024

well i prefer classic g: options, its easier to manage in my opinion

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 28, 2024

oh my bad i just realized i didn't understand your issue at all. I'm gonna fix this asap sorry !

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 28, 2024

it's fixed, i will add support for multiple workspaces one day, thanks for the tip ;)

from nvim-tree.lua.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.