Skip to content

Commit

Permalink
[zsh] Switches from prezto -> zim
Browse files Browse the repository at this point in the history
Basically because sorin-ionescu/prezto#1239
  • Loading branch information
AndrewSB committed Sep 22, 2017
1 parent 58dac95 commit 6754bb0
Show file tree
Hide file tree
Showing 6 changed files with 164 additions and 225 deletions.
2 changes: 1 addition & 1 deletion ensure-machine-setup.sh
Expand Up @@ -17,7 +17,7 @@ source ./machine-setup-functions.sh
can_i_xcode
can_i_brew
can_i_brew_deps
can_i_prezto
can_i_zim
can_i_ruby
can_i_gem
echo "All done 🎉"
8 changes: 4 additions & 4 deletions machine-setup-functions.sh
Expand Up @@ -34,12 +34,12 @@ function can_i_oh_my_zsh() {
set +e
}

function can_i_prezto() {
function can_i_zim() {
set -e
if ! [ -d "${ZDOTDIR:-$HOME}/.zprezto" ]; then
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
if ! [ -d "${ZDOTDIR:-$HOME}/.zim" ]; then
git clone --recursive https://github.com/Eriner/zim.git ${ZDOTDIR:-${HOME}}/.zim
fi
fire_echo "prezto is installed 🎉"
fire_echo "zim is installed 🎉"
fire_echo "WARNING: make sure you change your shell to zsh (you can chsh -s /bin/zsh)"
set +e
}
Expand Down
93 changes: 93 additions & 0 deletions zimrc
@@ -0,0 +1,93 @@


#################
# CORE SETTINGS #
#################

#
# Zim settings
#

# Select what modules you would like enabled.
# The second line of modules may depend on options set by modules in the first
# line. These dependencies are noted on the respective module's README.md.
zmodules=(directory environment git git-info history input utility meta custom \
syntax-highlighting history-substring-search autosuggestions prompt \
completion)


###################
# MODULE SETTINGS #
###################

#
# Prompt
#

# Set your desired prompt here
zprompt_theme='🔥'

#
# Completion
#

# set an optional host-specific filename for the completion cache file
# if none is provided, the default '.zcompdump' is used.
#zcompdump_file=".zcompdump-${HOST}-${ZSH_VERSION}"

#
# Utility
#

# Uncomment to enable command correction prompts
# See: http://zsh.sourceforge.net/Doc/Release/Options.html#Input_002fOutput
#setopt CORRECT

#
# Environment
#

# Set the string below to the desired terminal title format string.
# The terminal title is redrawn upon directory change, however, variables like
# ${PWD} are only evaluated once. Use prompt expansion strings for dynamic data:
# http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes
# The example below uses the following format: 'username@host:/current/directory'
ztermtitle='%n@%m:%~'

#
# Input
#

# Uncomment to enable double-dot expansion.
# This appends '../' to your input for each '.' you type after an initial '..'
zdouble_dot_expand='true'

#
# Syntax-Highlighting
#

# This determines what highlighters will be used with the syntax-highlighting module.
# Documentation of the highlighters can be found here:
# https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md
# For (u)rxvt, termite and gnome-terminal users,
# removing the 'cursor' highlighter will fix the disappearing cursor problem
zhighlighters=(main brackets cursor)


#
# SSH
#

# Load these ssh identities with the ssh module
zssh_ids=(id_rsa)


#
# Pacman
#

# Set (optional) pacman front-end.
#zpacman_frontend='powerpill'

# Load any helper scripts as defined here
#zpacman_helper=(aur)
65 changes: 56 additions & 9 deletions zlogin
@@ -1,11 +1,58 @@
# Execute code that does not affect the current session in the background.
{
# Compile the completion dump to increase startup speed.
zcompdump="${ZDOTDIR:-$HOME}/.zcompdump"
if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then
zcompile "$zcompdump"
fi
} &!
# Copied from Eriner/zim
#
# startup file read in interactive login shells
#
# The following code helps us by optimizing the existing framework.
# This includes zcompile, zcompdump, etc.
#

(
# Function to determine the need of a zcompile. If the .zwc file
# does not exist, or the base file is newer, we need to compile.
# These jobs are asynchronous, and will not impact the interactive shell
zcompare() {
if [[ -s ${1} && ( ! -s ${1}.zwc || ${1} -nt ${1}.zwc) ]]; then
zcompile ${1}
fi
}

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" || true # Load RVM into a shell session *as a function*
zim_mods=${ZIM_HOME}/modules
setopt EXTENDED_GLOB

# zcompile the completion cache; siginificant speedup.
for file in ${ZDOTDIR:-${HOME}}/.zcomp^(*.zwc)(.); do
zcompare ${file}
done

# zcompile .zshrc
zcompare ${ZDOTDIR:-${HOME}}/.zshrc

# zcompile some light module init scripts
zcompare ${zim_mods}/git/init.zsh
zcompare ${zim_mods}/utility/init.zsh
zcompare ${zim_mods}/pacman/init.zsh
zcompare ${zim_mods}/spectrum/init.zsh
zcompare ${zim_mods}/completion/init.zsh
zcompare ${zim_mods}/fasd/init.zsh

# zcompile all .zsh files in the custom module
for file in ${zim_mods}/custom/**/^(README.md|*.zwc)(.); do
zcompare ${file}
done

# zcompile all autoloaded functions
for file in ${zim_mods}/**/functions/^(*.zwc)(.); do
zcompare ${file}
done

# syntax-highlighting
for file in ${zim_mods}/syntax-highlighting/external/highlighters/**^test-data/*.zsh; do
zcompare ${file}
done
zcompare ${zim_mods}/syntax-highlighting/external/zsh-syntax-highlighting.zsh

# zsh-histery-substring-search
zcompare ${zim_mods}/history-substring-search/external/zsh-history-substring-search.zsh


) &!
206 changes: 0 additions & 206 deletions zpreztorc

This file was deleted.

0 comments on commit 6754bb0

Please sign in to comment.