zsh: autoload custom functions
This commit is contained in:
parent
de3235450c
commit
410ac2d1b2
3 changed files with 17 additions and 13 deletions
|
@ -1,12 +1,18 @@
|
||||||
# Set up zsh for interactive use (options, prompt, aliases, etc.)
|
# Set up zsh for interactive use (options, prompt, aliases, etc.)
|
||||||
source "$ZDOTDIR/aliases.zsh"
|
source "$ZDOTDIR/aliases.zsh"
|
||||||
source "$ZDOTDIR/completion.zsh"
|
source "$ZDOTDIR/completion.zsh"
|
||||||
source "$ZDOTDIR/functions.zsh"
|
|
||||||
source "$ZDOTDIR/history.zsh"
|
source "$ZDOTDIR/history.zsh"
|
||||||
source "$ZDOTDIR/line-editor.zsh"
|
source "$ZDOTDIR/line-editor.zsh"
|
||||||
source "$ZDOTDIR/man-pages.zsh"
|
source "$ZDOTDIR/man-pages.zsh"
|
||||||
source "$ZDOTDIR/prompt.zsh"
|
source "$ZDOTDIR/prompt.zsh"
|
||||||
|
|
||||||
|
# Set up autoload for custom functions.
|
||||||
|
fpath=("$ZDOTDIR/functions" $fpath)
|
||||||
|
for filepath in $ZDOTDIR/functions/*; do
|
||||||
|
autoload "${filepath##*/}"
|
||||||
|
done
|
||||||
|
unset filepath
|
||||||
|
|
||||||
# Prevent ctrl-s from freezing the terminal.
|
# Prevent ctrl-s from freezing the terminal.
|
||||||
stty stop undef
|
stty stop undef
|
||||||
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
# Source: https://unix.stackexchange.com/a/9124
|
|
||||||
mkcd() {
|
|
||||||
case "$1" in
|
|
||||||
*/..|*/../) cd -- "$1" ;;
|
|
||||||
/*/../*) (cd "${1%/../*}/.." && mkdir -vp "./${1##*/../}") && cd -- "$1" ;;
|
|
||||||
/*) mkdir -vp "$1" && cd "$1" ;;
|
|
||||||
*/../*) (cd "./${1%/../*}/.." && mkdir -vp "./${1##*/../}") && cd "./$1";;
|
|
||||||
../*) (cd .. && mkdir -vp "${1#.}") && cd "$1" ;;
|
|
||||||
*) mkdir -vp "./$1" && cd "./$1";;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
10
config/zsh/functions/mkcd
Normal file
10
config/zsh/functions/mkcd
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# Source: https://unix.stackexchange.com/a/9124
|
||||||
|
case "$1" in
|
||||||
|
*/..|*/../) cd -- "$1" ;;
|
||||||
|
/*/../*) (cd "${1%/../*}/.." && mkdir -vp "./${1##*/../}") && cd -- "$1" ;;
|
||||||
|
/*) mkdir -vp "$1" && cd "$1" ;;
|
||||||
|
*/../*) (cd "./${1%/../*}/.." && mkdir -vp "./${1##*/../}") && cd "./$1";;
|
||||||
|
../*) (cd .. && mkdir -vp "${1#.}") && cd "$1" ;;
|
||||||
|
*) mkdir -vp "./$1" && cd "./$1";;
|
||||||
|
esac
|
||||||
|
|
Loading…
Add table
Reference in a new issue