From 0427180a606285b2853d84eae92fb13e9548f5f7 Mon Sep 17 00:00:00 2001 From: Marcus Mu Date: Wed, 12 Jun 2019 11:12:24 +0800 Subject: [PATCH] Move initialisation of version managers to zprofile I noticed a considerable delay in skhd, similar to what was reported by someone else. The sourcing in zshenv is making the shell slow, so we need to offload it to zprofile. This file is only sourced for login shells. https://github.com/koekeishiya/skhd/issues/42 https://unix.stackexchange.com/a/487889 --- install.conf.yaml | 1 + vimrc | 4 +++- zprofile | 12 ++++++++++++ zshenv | 23 ----------------------- zshrc | 4 ++-- 5 files changed, 18 insertions(+), 26 deletions(-) create mode 100644 zprofile diff --git a/install.conf.yaml b/install.conf.yaml index 2a9627b..0548460 100644 --- a/install.conf.yaml +++ b/install.conf.yaml @@ -24,6 +24,7 @@ ~/.vim: ~/.vimrc: ~/.weechat: + ~/.zprofile: ~/.zsh: ~/.zshenv: ~/.zshrc: diff --git a/vimrc b/vimrc index ea8d9fd..09a69cf 100644 --- a/vimrc +++ b/vimrc @@ -158,6 +158,7 @@ set updatetime=250 set signcolumn=yes set synmaxcol=1000 set regexpengine=1 +set shellcmdflag=-l\ -c if executable('par') set formatprg=par endif @@ -721,8 +722,9 @@ highlight! link MatchParen ToolbarLine augroup vimrc - " Use JavaScript filetype for jsx files + " Set or overrule filetypes autocmd BufNewFile,BufRead *.jsx set filetype=javascript + autocmd BufNewFile,BufRead .zprofile,zprofile set filetype=zsh " Easier to quit help, quickfix and location window autocmd FileType help,qf noremap q :q diff --git a/zprofile b/zprofile new file mode 100644 index 0000000..d3201db --- /dev/null +++ b/zprofile @@ -0,0 +1,12 @@ +# Pyenv +export CFLAGS=-I/usr/local/opt/openssl/include +export LDFLAGS=-L/usr/local/opt/openssl/lib +export PYENV_VIRTUALENV_DISABLE_PROMPT=1 +source $HOME/.zsh/zsh-pyenv-lazy/pyenv-lazy.plugin.zsh + +# Rbenv +source $HOME/.zsh/zsh-rbenv-lazy/rbenv-lazy.plugin.zsh + +# Nvm +export NVM_LAZY_LOAD=true +source $HOME/.zsh/zsh-nvm/zsh-nvm.plugin.zsh diff --git a/zshenv b/zshenv index 0d2b912..b1c4fe9 100644 --- a/zshenv +++ b/zshenv @@ -38,29 +38,6 @@ export RIPGREP_CONFIG_PATH=$HOME/.ripgreprc # Less export LESS=-x4icWRM -# ============================================================================= -# PLUGINS -# ============================================================================= - -# ----------------------------------------------------------------------------- -# Pyenv -# ----------------------------------------------------------------------------- -export CFLAGS=-I/usr/local/opt/openssl/include -export LDFLAGS=-L/usr/local/opt/openssl/lib -export PYENV_VIRTUALENV_DISABLE_PROMPT=1 -source $HOME/.zsh/zsh-pyenv-lazy/pyenv-lazy.plugin.zsh - -# ----------------------------------------------------------------------------- -# Rbenv -# ----------------------------------------------------------------------------- -source $HOME/.zsh/zsh-rbenv-lazy/rbenv-lazy.plugin.zsh - -# ----------------------------------------------------------------------------- -# Nvm -# ----------------------------------------------------------------------------- -export NVM_LAZY_LOAD=true -source $HOME/.zsh/zsh-nvm/zsh-nvm.plugin.zsh - # ============================================================================= # PATH # https://superuser.com/a/598924 diff --git a/zshrc b/zshrc index e5c3a27..7e32c3e 100644 --- a/zshrc +++ b/zshrc @@ -233,10 +233,10 @@ function gate() { fi } -# Execute shell configuration +# Execute new shell function refresh() { echo "Refreshing shell..." - exec zsh + exec "$SHELL" -l } # Perform operations on Wi-Fi