mirror of
https://github.com/sebaschi/dotfiles.git
synced 2025-11-08 18:04:28 +01:00
Add bash util functions for finding files in directories and cd'ing into the PARENT directory containing that file.
This commit is contained in:
parent
67db32961d
commit
3181a6105e
@ -50,6 +50,8 @@ function ensure {
|
||||
fi
|
||||
}
|
||||
|
||||
# Functions for quick base conversion in the terminal
|
||||
|
||||
function htd {
|
||||
echo "$((0x$1))"
|
||||
}
|
||||
@ -77,3 +79,25 @@ function d2h {
|
||||
function d2b {
|
||||
echo "obase=2; ibase=10; $1" | bc
|
||||
}
|
||||
|
||||
#The following functions provide utility for finding a file in a certain directory tree, and then cd'ing to the parent directory containing that file
|
||||
|
||||
# File $(search begins in users home directory
|
||||
gotoh() {
|
||||
cd -- "$(dirname "$(fd $1 $HOME | fzy)")"
|
||||
}
|
||||
|
||||
# Search begins in /etc
|
||||
gotoe() {
|
||||
|
||||
cd -- "$(dirname "$(fd $1 /etc | fzy)")"
|
||||
|
||||
}
|
||||
|
||||
# global search, but not in runtime and root dirs
|
||||
#
|
||||
goto() {
|
||||
|
||||
cd -- "$(dirname "$(fd $1 $HOME /bin /usr/local /usr /etc | fzy)")"
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user