Show HN: Nav – A terminal navigator for interactive `ls` workflows
github.comHi Everyone,
I built a tool for interactive navigation in the terminal that is intended to replace the all-too-familiar cycle of `ls` to view a directory, followed by `cd`, then `ls`, and repeat.
nav is a terminal filesystem explorer built for interactive `ls` workflows. The key features I wanted to enable are interactivity and search without feeling like I'm using anything other than `ls`. nav supports common `ls` options/flags, as well as tab completion, and might expand its support for less common options in the future. These options exist as both CLI flags and interactive toggles.
nav works as a standalone tool or in a bash/zsh pipe or subshell to e.g., change directories, copy a file name to the clipboard, etc. For example, I use the simple functions from the README in my .zshrc for interactive `cd` and copy-to-clipboard workflows.
nav was inspired by the discussion of the excellent `walk` [0] tool and was written from the ground up to support its `ls`-centric interactive feature set. I hope you might find it useful and I'd love to take any feedback or suggestions that might come to mind!
[0] https://news.ycombinator.com/item?id=37220828 Seems nice :-) For this part specifically: > the all-too-familiar cycle of `ls` to view a directory, followed by `cd`, then `ls`, and repeat I use (oh-my-)zsh for this. Tab would autocomplete (with some basic support for "fuzzy search" - case insensitive, part for the file works). If there are several options it displays them and they can be selected. When completed, another tab press displays the folder content. For some commands, it tries to show only relevant files. For cd, it won't complete with the name of a (non-folder) file. This is very effective. I feel like one of my hands is missing when I don't have this, for instance when I'm using bash. I agree! nav supports this workflow in search mode as well, and I could easily support fuzzy searching rather than exact match if that would be valuable. Decent effort. Have you tried looking at fzf? I managed to combine it with ripgrep to create a similar experience to what you have. Yes, fzf and ripgrep are the best! Together they are the heart of at least half of my .zshrc functions, and it would be fun to see about writing something similar by composing them together in various ways. Great idea! Can you share your full bash or Z fu to merd these creatures? Gratzi, amigo. Looks interesting. Have you thought about implementing marks, so that you can select some files for further operations? I love this idea and will look into implementing it in the next few days! Thanks! Thanks again for the great suggestion. I've implemented this and it is part of the latest release (v1.1.0). Nice! For inspiration, you may want to look at `lf`: https://github.com/gokcehan/lf Also Broot, which is-- like OP's tool-- intended as an ls replacement rather than a full file manager: https://github.com/Canop/broot Broot looks really nice. I love the tree-like output - `tree` is one of my favorite tools. Interactive tree is a great idea, makes me wish I had perhaps started there instead. broot can be used to replace tree (i.e. be non interactive): https://dystroy.org/broot/tricks/#replace-tree This is convenient when you don't want to browse or search, just want what tree does but without scrolling. I love tree, too! Sometimes broot feels a little busy or complex to me, though. I'm interested in your tool's UI as well. Broot is incredible! Oh wow that's nice, exactly what I needed as an external file picker for helix Also `yazi` https://github.com/sxyazi/yazi , which is the closest nnn-replacement on Windows up until now. Thanks! This does look like a similar tool, and as you said, I love seeing what others have done for inspiration for new features to tools I'm working on. Thanks again. There's also ranger and yazi. I’ve used ranger for years, even fixed a bug I found while using it. For my work patterns it’s too feature rich. I only use it for browsing directory structures. Everything else just gets in the way because I haven’t taken the time to learn the other features. Any thoughts on Midnight Commander? I have to admit that I had not come across midnight-commander. It certainly looks interesting and I'll be giving it a spin. Thanks for pointing me in its direction! I do intend to expand nav's feature set to come close to an `ls` replacement, at least for the most common workflows, whereas midnight-commander and other similar tools are perhaps closer to being (or are) file managers. I'm also hopeful that by using the completely awesome Charm [0] libraries that I can make for a pleasing/modern UI. Either way, I had a blast building nav and look forward to continuing on. Thanks again for the comment! Midnight Commander also includes a really decent little text editor (mcedit) with syntax highlighting for a decent range of text file formats. nnn could be another to compare against. How about Norton Commander? Same thing. MC was made to emulate NC. And of course there are actually countless filesystem browsers. Even xtree was probably not the first since that was on ms-dos, and I bet there were some on the 8-bit machines before that. But this one's aim seems to be a bit specific and not simply to be a filesystem browser (file manager) but specifically to try to be an "interactive ls". IE somehow feel like ls. Though I don't know why. It doesn't seem more useful than a normal file manager. I think it's just down to a very fine point of aesthetics, which is fair enough. It can edit zip files and stuff. I actually had no idea it was a Miguel de Icaza project. Quite a prolific fellow. The beauty of that feature is the system to implement it - extfs(EXTernal virtual File System) - is built with simple scripts, so you can add your own little tools to make other things navigable beyond the ~40 that come bundled. There is a simple introduction in /usr/lib/mc/extfs.d/README, or https://github.com/MidnightCommander/mc/blob/master/src/vfs/... . Someone stick this up on search.nixos.org! Love me some good CL tooling