pref(zsh): improve start up time of zsh

Remove unused plugins and override composer plugin there was only one bit that
was really slow when evaluating the bin directory
This commit is contained in:
Ade Attwood 2020-12-28 09:19:32 +00:00
parent 766e50106e
commit 578d0b5f8b
2 changed files with 53 additions and 5 deletions

View file

@ -0,0 +1,52 @@
# ------------------------------------------------------------------------------
# FILE: composer.plugin.zsh
# DESCRIPTION: oh-my-zsh composer plugin file.
# AUTHOR: Daniel Gomes (me@danielcsgomes.com)
# VERSION: 1.0.0
# ------------------------------------------------------------------------------
# Composer basic command completion
_composer_get_command_list () {
$_comp_command1 --no-ansi 2>/dev/null | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }'
}
_composer_get_required_list () {
$_comp_command1 show -s --no-ansi 2>/dev/null | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
}
_composer () {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments \
'1: :->command'\
'*: :->args'
case $state in
command)
compadd $(_composer_get_command_list)
;;
*)
compadd $(_composer_get_required_list)
;;
esac
}
compdef _composer composer
compdef _composer composer.phar
# Aliases
alias c='composer'
alias csu='composer self-update'
alias cu='composer update'
alias cr='composer require'
alias crm='composer remove'
alias ci='composer install'
alias ccp='composer create-project'
alias cdu='composer dump-autoload'
alias cdo='composer dump-autoload --optimize-autoloader'
alias cgu='composer global update'
alias cgr='composer global require'
alias cgrm='composer global remove'
# install composer in the current directory
alias cget='curl -s https://getcomposer.org/installer | php'

View file

@ -27,7 +27,7 @@ COMPLETION_WAITING_DOTS="true"
# More plug-ins are loaded in ~/.oh-my-zsh/custom/lib/misc.zsh file so we dint
# have to define all of the custom installed plug ins here.
#
plugins=(git golang composer npm tmux debian vagrant docker-compose extract emacs nvm)
plugins=(git emacs nvim extract)
#
# map ecs to caps lock
@ -43,7 +43,6 @@ xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'
#
printf '\033[5 q'
#
# Configure base16 shell for colors if the terminal is not running inside of
# emacs
@ -108,9 +107,6 @@ if [ -d "${PHPENV_ROOT}" ]; then
eval "$(phpenv init -)"
fi
# conventional-tools autocomplete setup
CONVENTIONAL_TOOLS_AC_ZSH_SETUP_PATH=/home/ade/.cache/@baln/conventional-tools/autocomplete/zsh_setup && test -f $CONVENTIONAL_TOOLS_AC_ZSH_SETUP_PATH && source $CONVENTIONAL_TOOLS_AC_ZSH_SETUP_PATH;
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools