diff --git a/.gitmodules b/.gitmodules index becdcb6..1d666a5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,3 +19,9 @@ [submodule "modules/autosuggestions/external"] path = modules/autosuggestions/external url = https://github.com/zsh-users/zsh-autosuggestions.git +[submodule "modules/fzf-zsh"] + path = modules/fzf-zsh + url = https://github.com/Piping/fzf-zsh.git +[submodule "modules/prompt/external-themes/lambda"] + path = modules/prompt/external-themes/lambda + url = https://github.com/subnixr/minimal.git diff --git a/README.md b/README.md index 6eaaa4c..53d0b58 100644 --- a/README.md +++ b/README.md @@ -38,34 +38,28 @@ Zim has many modules! Enable as many or as few as you'd like. Installation ------------ Installing Zim is easy. If you have a different shell framework installed (like oh-my-zsh or prezto), -*uninstall those first to prevent conflicts*. It can be installed manually by following the instructions below: +*uninstall those first to prevent conflicts*. Then put following instructions at the end of your `~/.zshrc`: -1. In a Zsh shell, clone the repository: - ``` - git clone --recursive https://github.com/zimfw/zimfw.git ${ZDOTDIR:-${HOME}}/.zim + ```bash + # Zim initializition + export ZIM_HOME="$HOME/.zsh" + + if [ ! -f "$ZIM_HOME/init.zsh" ]; then + echo "Installing zim" + git clone --recursive https://github.com/zimfw/zimfw.git $ZIM_HOME + git clone https://github.com/Piping/fzf-zsh.git $ZIM_HOME/modules/fzf-zsh + cat $ZIM_HOME/templates/zlogin >> $HOME/.zlogin + source $HOME/.zlogin + fi + + zmodules=(git git-info prompt completion syntax-highlighting autosuggestions fzf-zsh) + zprompt_theme='steeef' + zhighlighters=(main brackets cursor) + + source $ZIM_HOME/init.zsh #make sure init after zmodules lists etcs.. ``` -2. Paste this into your terminal to prepend the initialization templates to your configs: - ``` - setopt EXTENDED_GLOB - for template_file in ${ZDOTDIR:-${HOME}}/.zim/templates/*; do - user_file="${ZDOTDIR:-${HOME}}/.${template_file:t}" - touch ${user_file} - ( print -rn "$(<${template_file})$(<${user_file})" >! ${user_file} ) 2>/dev/null - done - ``` - -3. Set Zsh as the default shell: - ``` - chsh -s =zsh - ``` - -4. Open a new terminal and finish optimization (this is only needed once, hereafter it will happen upon desktop/tty login): - ``` - source ${ZDOTDIR:-${HOME}}/.zlogin - ``` - -5. You're done! Enjoy your Zsh IMproved! Take some time to read about the [available modules][modules] and tweak your `.zshrc` file. +You're done! Enjoy your Zsh IMproved! Take some time to read about the [available modules][modules] and tweak your `.zshrc` file. Updating -------- diff --git a/init.zsh b/init.zsh index 3de17fd..bc33c0e 100755 --- a/init.zsh +++ b/init.zsh @@ -7,19 +7,6 @@ autoload -Uz is-at-least && if ! is-at-least 5.2; then return 1 fi -# Define zim location -(( ! ${+ZIM_HOME} )) && export ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim - -# Source user configuration -[[ -s ${ZDOTDIR:-${HOME}}/.zimrc ]] && source ${ZDOTDIR:-${HOME}}/.zimrc - -# Set input mode before loading modules -if [[ ${zinput_mode} == 'vi' ]]; then - bindkey -v -else - bindkey -e -fi - # Autoload module functions () { local mod_function @@ -82,6 +69,8 @@ Actions: ;; build-cache) source ${ZIM_HOME}/tools/zim_build_cache && print 'Cache rebuilt' ;; + reload) zmanage clean-cache && zmanage build-cache + ;; remove) zsh ${ZIM_HOME}/tools/zim_remove ;; reset) zsh ${ZIM_HOME}/tools/zim_reset diff --git a/login_init.zsh b/login_init.zsh index 0b98bb4..0da8ca6 100755 --- a/login_init.zsh +++ b/login_init.zsh @@ -5,29 +5,34 @@ # This includes zcompile, zcompdump, etc. # +zcompare() { + if [[ -s ${1} && ( ! -s ${1}.zwc || ${1} -nt ${1}.zwc) ]]; then + zcompile ${1} + fi +} + ( - local dir file - setopt LOCAL_OPTIONS EXTENDED_GLOB - autoload -U zrecompile +local dir file +setopt LOCAL_OPTIONS EXTENDED_GLOB +autoload -U zrecompile +# zcompile the completion cache; siginificant speedup +zcompare ${ZDOTDIR:-${HOME}}/${zcompdump_file:-.zcompdump} - # zcompile the completion cache; siginificant speedup - zrecompile -pq ${ZDOTDIR:-${HOME}}/${zcompdump_file:-.zcompdump} +# zcompile .zshrc +zcompare ${ZDOTDIR:-${HOME}}/.zshrc - # zcompile .zshrc - zrecompile -pq ${ZDOTDIR:-${HOME}}/.zshrc - - # zcompile enabled module autoloaded functions - for dir in ${ZIM_HOME}/modules/${^zmodules}/functions(/FN); do +# zcompile enabled module autoloaded functions +for dir in ${ZIM_HOME}/modules/${^zmodules}/functions(/FN); do zrecompile -pq ${dir}.zwc ${dir}/^(_*|prompt_*_setup|*.*)(-.N) - done +done - # zcompile enabled module scripts - for file in ${ZIM_HOME}/modules/${^zmodules}/(^*test*/)#*.zsh{,-theme}(.NLk+1); do - zrecompile -pq ${file} - done +# zcompile enabled module scripts +for file in ${ZIM_HOME}/modules/${^zmodules}/(^*test*/)#*.zsh{,-theme}(.NLk+1); do + zcompare ${file} +done - # zcompile all prompt setup scripts - for file in ${ZIM_HOME}/modules/prompt/functions/prompt_*_setup; do - zrecompile -pq ${file} - done +# zcompile all prompt setup scripts +for file in ${ZIM_HOME}/modules/prompt/functions/prompt_*_setup; do + zcompare ${file} +done ) &! diff --git a/modules/fzf-zsh b/modules/fzf-zsh new file mode 160000 index 0000000..9b237ef --- /dev/null +++ b/modules/fzf-zsh @@ -0,0 +1 @@ +Subproject commit 9b237ef4d03bfb275dc31722b93efa0d53c2ade5 diff --git a/modules/prompt/external-themes/lambda b/modules/prompt/external-themes/lambda new file mode 160000 index 0000000..9dd104f --- /dev/null +++ b/modules/prompt/external-themes/lambda @@ -0,0 +1 @@ +Subproject commit 9dd104f1bddbf742ced6e1e31b14e2b394a47690 diff --git a/modules/prompt/functions/prompt_lambda_setup b/modules/prompt/functions/prompt_lambda_setup new file mode 120000 index 0000000..eaff786 --- /dev/null +++ b/modules/prompt/functions/prompt_lambda_setup @@ -0,0 +1 @@ +../external-themes/lambda/minimal.zsh \ No newline at end of file