diff options
author | A Farzat <a@farzat.xyz> | 2024-11-05 07:42:55 +0900 |
---|---|---|
committer | A Farzat <a@farzat.xyz> | 2024-11-13 07:42:55 +0900 |
commit | cb5affa0e11c200f175e26ced4f2866aa916d2c9 (patch) | |
tree | 157d2d413b3e1090fecb9aeb06cd51b49040a2c9 /.config/zsh/halfway/functions.zsh | |
parent | 6afb1f1eec5a8254635773f952fb6494f35a1933 (diff) | |
download | dotfiles-cb5affa0e11c200f175e26ced4f2866aa916d2c9.tar.gz dotfiles-cb5affa0e11c200f175e26ced4f2866aa916d2c9.zip |
Remove zsh submodule
Zsh config will be included as bare files instead of a submodule. The
zsh config repo will still exist, but the content will be used by yadm
without the repo itself.
Diffstat (limited to '.config/zsh/halfway/functions.zsh')
-rw-r--r-- | .config/zsh/halfway/functions.zsh | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/.config/zsh/halfway/functions.zsh b/.config/zsh/halfway/functions.zsh new file mode 100644 index 0000000..9bc295c --- /dev/null +++ b/.config/zsh/halfway/functions.zsh @@ -0,0 +1,53 @@ +# Creates the given directories and then moves to the first one. +mkcd() { + mkdir -p "$@"; + cd "$1"; +} + +# Create python directories with __init__.py. +mkdirpython() { + mkdir -p "$@"; + local directory + for directory in "$@"; + do touch "$directory/__init__.py"; + done; +} + +# Switch from the current directory to the equivalent directory on another drive. +sd() { + local wd="$(pwd)"; + wd="${wd/"$1"/"$2"}"; + printf %s\\n "$wd"; + cd "$wd"; +} + +# Copy the current directory to the clipboard. +pcopy() { + printf %s "$(pwd)" | cclip + pwd +} + +vinfo() { + INFOPATH="$XDG_DATA_HOME/info:$INFOPATH" ${EDITOR:-nvim} -R -M -c "Info $@" +only +} + +vn3() { + if [ "$#" -gt 0 ]; then + local direc="$(printf %q "$1")" + shift + ${EDITOR:-nvim} -c "NnnExplorer $direc" "$@" + else + ${EDITOR:-nvim} -c NnnExplorer + fi +} + +# https://github.com/ohmyzsh/ohmyzsh/blob/8487a55/lib/cli.zsh#L625 +src () { + # Delete current completion cache + command rm -f $_comp_dumpfile $ZSH_COMPDUMP + + # Old zsh versions don't have ZSH_ARGZERO + local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}" + # Check whether to run a login shell + [[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh" +} |