7 ms·
Show HN: Lightning – a tool for rapid filesystem navigation
- Mithaldu 11y agoThis could be made a little more useful by making the cursor select mode preview contents on the side for any item the cursor is on.
- fouric 11y agoHey! That's a clever idea - and it would probably be very easy to implement, too. I'll put it in TODO, but if you wish, you can always add the feature and merge it yourself - the (Python) codebase shouldn't be very difficult to get acquainted with, and I try to be open to others' changes.
- Mithaldu 11y agoI'm unlikely to ever use it myself, because i already have a very different toolset. Just had that thought while watching the gif. :)
- visarga 11y agoWhen developing software I usually switch between 3-4 folders. It would be nice to have shortcuts to favorite folders.
- listic 11y agoFAR Manager on Windows has these in the form of Ctrl+1 ... Ctrl+0 shortcuts (set with Shift+Ctrl+1 ... Shift+Ctrl+0). Does Midnight Commander? It's one of the features I have been missing on Linux.
- perlancar2 11y agoI don't think so. But Midnight Commander has directory hotlist (Ctrl-\). You can select the hotlist entry using arrow keys up and down.
- notfoss 11y agoFor favourite folders, you can simply use aliases.
- asb 11y agoI highly recommend z for switching between frequently used folders. Sure you could set up aliases, but then you need to keep them up to date when your work patterns change. https://github.com/rupa/z https://github.com/rupa/z
- eeZi 11y agoCDPATH alone works pretty well already
- fit2rule 11y agofind ~/Documents -exec ls -l {} \; > ~/Documents/filelist.txt && grep "somefileiwant" ~/Documents/filelist.txt Its all I've ever needed.
- nurb 11y agols -lh $(find ~/Documents | grep "somefileiwant") It's all you should ever need.
- qwertyboy 11y agoYou guys do realize that most `find` implementations support both the `-ls` and the `-name` flags, right? find ~/Documents -name somefile -ls
- brbsix 11y agoI don't really understand this. Why use grep? You can just use `find ~/Documents -name somefileiwant -ls`. You can use -regex or -path if you need to use regular expressions to describe a filename or path, respectively. Alternatively, if you really wanted to use find and grep together, there is no need for any file I/O. You can just use `find ~/Documents -exec ls -l {} + | grep somefileiwant`.
- fit2rule 11y agoI use grep so I can just come back later and do more grep'ing if needed or even do more complicated grips. ;) Just have to remember to update the filelist.txt file every week or so .. anyway its ghetto and I like it.
- aw3c2 11y agoYou might like mlocate.
- fouric 11y agoThat's OK, this tool isn't for everyone :) Lightning was built because I was tired of both the "cd x; ls; cd x; ls; cd x" and "cd x<tab>x<tab>/xx<tab>x<tab>" patterns and wanted something faster where all I had to do was hit the right keys and I would automagically get to my destination. It's less about finding files than it is about getting to them; in fact, I can imagine myself opening files found with the above method much faster with Lightning than I would using standard shell tools. But that might just be me.
- orbifold 11y agoThis is really cool, were you inspired by Helm mode for emacs? If not you might find some useful features to add there.
- fouric 11y agoI haven't even seen Helm mode before. I am a hybrid Vim/Emacs user, though, so I am definitely going to try this out and perhaps "borrow" a feature or two.
- p4bl0 11y agoI don't understand how this helps. From what I've seen, it shows a list of files and directories and you "build" a path by selecting/opening them, navigating using some keys to go up/down in the list. How is that more efficient than "tabtabbing" (hitting tab two times) to see possible completions? To me it seems less efficient to use up/down than hitting the few necessary keys to get the autocomplete you need.
- fouric 11y agoWell, the idea is that you're supposed to stay in search mode as long as possible, thereby avoiding the need to go into normal mode and select files mc-style. If you do that, then Lightning should be more efficient than tabtabbing because (1) you don't have to press tab to filter files and (2) after you have enough characters to uniquely identify your file/directory, instead of having to press <tab><enter>, you're actually already there. That said, this is not for everyone; I anticipate it being useful for about 20% of *nix programmers in 90% of their file-opening cases. I just submitted it because (1) I thought that the style of the tool might be interesting to some and (2) that 20% might really enjoy and benefit from having this.
- betimsl 11y agoThis kind of behavior is already implemented in oh-my-zsh. It's really cool.
- pjc50 11y agoReminds me of "Midnight Commander" and derivatives. A colleague of mine is a big user of "Far".
- alex95 11y agoYou guys ever heard of a thing called Explorer/Finder?
- StavrosK 11y agoI don't like the selecting up and down, it's much faster to just type a few characters. I wonder if it can use peco to select a directory by fuzzy search.
- fouric 11y ago"Search mode" is the default because, 80% of the time, you're right, it is faster to just type a few characters. However, in about another 10% of cases (in my experience, and up until this point I've been the sole user of this thing), there are filenames that differ by a few characters at the end (lightning-cd.lisp vs lightning-cd.py is a good example), and it would take much longer to type out the entire unique portion of the filename than it would to hit two characters, switch modes, and then select downward once or twice. I am considering adding in a fuzzy searching engine. However, because Lightning's primary mode (search mode) works by selecting on uniquely identifying substrings of filenames (the ones at the beginning in particular), a fuzzy search might make it more difficult to get a particular file because the algorithm would grab other filenames that you didn't want. I'll give it a try and see how it works.
- StavrosK 11y agoAh, if it supports both, then great. You can try a fuzzy search and give it less weight, so it would prefer to match the beginnings of strings first. The good thing about fuzzy search is that "ligy" would match "lightning-cd.py", and "ligs" would match "lightning-cd.lisp".
- such_a_casual 11y agoI would use this once it's stable. I'm too much of a newb to handle alpha.
- perlancar2 11y agoI think I'd much rather use something like Midnight Commander. You can move using arrow keys (right arrow to cd to a dir, left to cd back, up and down to select file/dir), as well as use the traditional 'cd' command, as well as move through history using M-y and M-u, as well as incremental search, as well as using bookmarks/directory hotlist. Plus, you don't have to clutter your bash history with loads of 'i' commands (I know about HISTCONTROL=ignorespace and HISTIGNORE, but still).