From 0788926c8cc69252670d79a038ca90c3a932bfcd Mon Sep 17 00:00:00 2001 From: druckdev <63563978+druckdev@users.noreply.github.com> Date: Tue, 22 Sep 2020 00:28:28 +0200 Subject: [PATCH] zsh: Autoload big functions --- .config/zsh/.zshrc | 7 +- .config/zsh/autoload/clang-format | 38 +++++++ .config/zsh/autoload/git-submodule-rm | 31 ++++++ .config/zsh/autoload/glog | 81 +++++++++++++++ .config/zsh/plugins/functionsPost.zsh | 141 -------------------------- 5 files changed, 155 insertions(+), 143 deletions(-) create mode 100755 .config/zsh/autoload/clang-format create mode 100755 .config/zsh/autoload/git-submodule-rm create mode 100755 .config/zsh/autoload/glog 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=