Navigating around in your shell

https://programming.dev/post/6321543

Navigating around in your shell - programming.dev

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.

What I use to automatically extend stuff like ls … to ls …/…/…/…

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)