
Show HN: Lightning – a tool for rapid filesystem navigation - fouric
https://github.com/fouric/lightning-cd
======
p4bl0
I 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
Well, 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.

------
Mithaldu
This 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
Hey! 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
I'm unlikely to ever use it myself, because i already have a very different
toolset. Just had that thought while watching the gif. :)

------
orbifold
This is really cool, were you inspired by Helm mode for emacs? If not you
might find some useful features to add there.

~~~
fouric
I 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.

------
pjc50
Reminds me of "Midnight Commander" and derivatives. A colleague of mine is a
big user of "Far".

------
betimsl
This kind of behavior is already implemented in oh-my-zsh. It's really cool.

------
fit2rule

        find ~/Documents -exec ls -l {} \; > ~/Documents/filelist.txt && grep "somefileiwant" ~/Documents/filelist.txt
    

Its all I've ever needed.

~~~
brbsix
I 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
I 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.

------
perlancar2
I 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).

------
StavrosK
I 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
"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
Ah, 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".

------
visarga
When developing software I usually switch between 3-4 folders. It would be
nice to have shortcuts to favorite folders.

~~~
listic
FAR 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
I don't think so. But Midnight Commander has directory hotlist (Ctrl-\\). You
can select the hotlist entry using arrow keys up and down.

------
eeZi
CDPATH alone works pretty well already

------
such_a_casual
I would use this once it's stable. I'm too much of a newb to handle alpha.

