diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 458013c..04809b4 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -117,9 +117,12 @@ comp-source "$ZSH_CONF/fzf-tab/fzf-tab.plugin.zsh" ## Load external config files and modules autoload edit-command-line; zle -N edit-command-line -autoload zmv ! alias run-help >/dev/null 2>&1 || unalias run-help -autoload run-help +autoload run-help run-help-git zmv +if [ -d "$ZDOTDIR/autoload" ]; then + fpath=("$ZDOTDIR/autoload" $fpath) + autoload -Uz -- "" "${fpath[1]}"/*(.xN:t) +fi ! command -v direnv >/dev/null 2>&1 || eval "$(direnv hook zsh)" # stderred if [ -e "$ZSH_CONF/stderred/build/libstderred.so" ]; then diff --git a/.config/zsh/autoload/clang-format b/.config/zsh/autoload/clang-format new file mode 100755 index 0000000..9a3fdb6 --- /dev/null +++ b/.config/zsh/autoload/clang-format @@ -0,0 +1,38 @@ +## Author: druckdev +## Created: 2019-11-28 +## +## A clang-format wrapper that can take a path to a format file (everywhere on +## the system) with the -style flag + +local idx=${@[(I)-style*]} +if (( ! idx )); then + # No style flag given + command clang-format "$@" + return +fi + +local style="${@[$idx]#-style}" prefix="" +if [ -n "$style" ]; then + # Flag was given in form -style=