#! /bin/zsh # # this file: # https://dataswamp.org/~incal/conf/.zsh/navigate-fs news_path=~/ssd/news news () { cd ${news_path}/ua } swim () { cd ~/ssd/girls/swim } links-to () { local files=($@) for f in $files; do echo "-> $f" find -L ~/ -samefile $f done } path-of () { readlink -f $@ } alias clean=clear home-clear () { cd clear } alias cl=home-clear jump-error () { echo "Unknown destination: $@" >& 2 } jump () { case $1 in (1) cd ~/ppl/1 ;; (b) cd ~/public_html/bad ; clear; ls ;; (j) cd ~/public_html/emacs-init/bad/ ; clear; ls ;; (B) cd ~/public_html/books ;; (d) cd ~/data ;; (E) cd ~/.emacs.d ;; (e) if [[ $# == 1 ]]; then cd ~/.emacs.d/emacs-init else case $2 in (g) cd ~/.emacs.d/emacs-init/gnus ;; esac fi ;; (h) cd ~/public_html ;; (i) cd ~/mm/m/si ;; (M) cd ~/.config/mpv ;; (m) cd ~/ssd/m ;; (n) cd ~/ssd/news/ua ;; (p) cd ~/ppl ;; (s) cd ~/mm/survivor/us/46 ;; (t) cd ~/test ;; (v) cd ~/public_html/about/cv ;; (z) cd ~/.zsh ;; (*) jump-error $@ ;; esac } alias j=jump alias jr="jump r" alias jh="jump h" tilde-path () { if [[ $# == 1 ]]; then local file=$1 if [[ -e $file ]]; then local file_path=$(readlink -f $file) echo "${file_path/$HOME/~}" else no-file-msg $file fi else echo "syntax: $0 FILE" >&2 fi } alias {filepath,file-path}=tilde-path