5 ms·
The main thing I use Exa for is as a better "tree": et() { exa -alT --git -I'.git|node_modules|.mypy_cache|.pytest_cache|.venv' --color=always "$@" | less
by kbd 5y ago
The main thing I use Exa for is as a better "tree":
et() { exa -alT --git -I'.git|node_modules|.mypy_cache|.pytest_cache|.venv' --color=always "$@" | less -R; }
alias et1='et -L1'
alias et2='et -L2'
alias et3='et -L3'
Exa is great for this because it shows file details along with the tree hierarchy.
(I have to manually specify a bunch of git-ignores because Exa's git ignore support doesn't work properly.)
- zamadatix 5y agoTree does have some options for file details as well, -p is the same as ls -l or and/or you can use options like -hug individually. -hugDC for dates and some coloring too. Maybe not as great as exa but not bad for the classic option.
- baumy 5y agoLove this! Stole it and added a bit of bash-fu to it to avoid needing to define the extra aliases: et() { exa -alT --git -I'.git|node_modules|.mypy_cache|.pytest_cache|.venv' --color=always "-L${1:-1}" | less -R } commands would now be, e.g. "et 2" instead of "et2", but will work with any number. defaults to 1 if just "et" is run with no argument.
- kbd 5y agoWanted to add: I realized that my function above doesn't fully show how I use it. I recommend setting your $LESS to include -F so that by default it doesn't leave pages of output in your scrollback. That way you can get a quick tree, scrollable/searchable in your pager, and then don't lose your shell context. FWIW, my $LESS is: export LESS='-iMFx4 --mouse' # smart-case, status bar, quit 1 screen, 4sp tabs Also should mention https://github.com/Canop/broot https://github.com/Canop/broot as a good directory explorer tool.
- hiyer 5y agoThanks for the "less -F" tip! I didn't know we could do that, and I'll definitely find it useful.
- aisamu 5y agoCombine it with fzf and you can choose the depth level dynamically: tree: aliased to echo '2\n3\n4\n5' | fzf --preview='exa -l -T -L {} --git-ignore' --reverse --preview-window down:99% --bind 'j:down,k:up,q:cancel,enter:cancel'