Giter Club home page Giter Club logo

Comments (2)

gokcehan avatar gokcehan commented on August 16, 2024

Thanks for bringing this up and asking it first @KenjiTakahashi .

This has been somewhat bugging me as well, having to remember calling Stat for symlinks. In addition to the two places you mention we are also doing this in completion if I remember correctly. I thought about cleaning things when I was working on #2 but then I got distracted to something else. I remember it was not very straightforward though.

Now you mention a few different issues. I think we both agree that symlinks should not be treated identical to the files they link to. Currently symlinks pointing to directories are not grouped within other directories. This is different than ranger but is similar to ls with --group-directories-first option on my machine (probably GNU coreutils). Same thing for the file permissions as well. When I'm in doubt I usually try to follow ls behavior rather than ranger. I don't feel very strong about this though so I guess you can change it or just create an option for it if you like.

Second issue you mention is the redundant sort inside ioutil.ReadDir. This should probably be done with os.Readdir or os.Readdirnames to avoid that extra sort with sort by methods different than name. It could also be nice to add a sort by none option in the mean time.

from lf.

KenjiTakahashi avatar KenjiTakahashi commented on August 16, 2024

Not identical, but kinda almost ;-). I'd like to know that it is a symlink and commands should get the symlink location as well (e.g. rename or sth should not rename [or sth] the destination). But when I want to cd or open, I expect it to do so on destination, it doesn't make sense to edit a symlink in vim :-).
Personally, I like links pointing at dirs listed among other dirs, but maybe I'm just used to it. BSD ls does not have the option you mentioned, unfortunately.

To use os.Readdirnames is exactly what I planned to do. I wasn't really pointing at it as issue, only suggesting that we'll be able to "amortise" additional .Stat call by avoiding the sort.

I will try to come up with some code over the weekend, let's see how it turns out.

from lf.

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.