- Executive Chimp ( @executivechimp@discuss.tchncs.de ) 8•10 months ago
Good article. Rather than aliasing `cd …/…" etc. I’ve got this function in my setup:
up () { local x='' for i in $(seq ${1:-1}) do x="$x../" done cd $x }
This lets me do
up 4
to go up 4 directories.- Astaroth ( @Astaroth@lemm.ee ) 2•10 months ago
I use Fish and have keybinds for previous and next directory, 99% of the time when going up in a directory it’s to (one of) the previous directory/ies I was in
- PlexSheep ( @PlexSheep@feddit.de ) 1•10 months ago
What I use to automatically extend stuff like
ls ....
tols ../../../..
function expand-dots() { local MATCH if [[ $LBUFFER =~ '(^| )\.\.\.+' ]]; then LBUFFER=$LBUFFER:fs%\.\.\.%../..% fi } function expand-dots-then-expand-or-complete() { zle expand-dots zle expand-or-complete } function expand-dots-then-accept-line() { zle expand-dots zle accept-line } zle -N expand-dots zle -N expand-dots-then-expand-or-complete zle -N expand-dots-then-accept-line bindkey '^I' expand-dots-then-expand-or-complete bindkey '^M' expand-dots-then-accept-line
(for zsh)
- Specialpatrol ( @Specialpatrol@feddit.uk ) 1•10 months ago
Holy shit
- beeng ( @beeng@discuss.tchncs.de ) 1•10 months ago
Look into zoxide.
z direc
Will take you to the most used directory starting with “direc” eg “/home/me/random/directory”
- Executive Chimp ( @executivechimp@discuss.tchncs.de ) 2•10 months ago
I’ve tried things like that before but never got on with them. I found when I had many projects with similar directory structures it was easy to end up in the wrong place and took more thought to get to the right place than just cding
- beeng ( @beeng@discuss.tchncs.de ) 1•10 months ago
The dir’s are the same names or similar? A few extra key strokes to get the fullname should be easier than cd’ing back and forth.
There’s also z foo “space” “tab” as per docs to get interactive list for matches.
But, just a suggestion!
- QuazarOmega ( @QuazarOmega@lemy.lol ) 3•10 months ago
Great stuff! Didn’t know about
lf
- hallettj ( @hallettj@beehaw.org ) English2•10 months ago
I use that
r
function regularly to go to the git project root. But I call itgtop
. I mostly use that and zoxide to get around. - Mike Wooskey ( @mike_wooskey@lemmy.d.thewooskeys.com ) English2•10 months ago
Thanks for these tips.