diff --git a/ensure-machine-setup.sh b/ensure-machine-setup.sh index b46bbe4..4f69743 100755 --- a/ensure-machine-setup.sh +++ b/ensure-machine-setup.sh @@ -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 🎉" diff --git a/machine-setup-functions.sh b/machine-setup-functions.sh index cab7203..ba2b7a7 100644 --- a/machine-setup-functions.sh +++ b/machine-setup-functions.sh @@ -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 } diff --git a/zimrc b/zimrc new file mode 100644 index 0000000..e15ed9e --- /dev/null +++ b/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) diff --git a/zlogin b/zlogin index 98cbaec..7cdda7c 100644 --- a/zlogin +++ b/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 + + +) &! diff --git a/zpreztorc b/zpreztorc deleted file mode 100644 index 6b33a74..0000000 --- a/zpreztorc +++ /dev/null @@ -1,206 +0,0 @@ -# -# Sets Prezto options. -# -# Authors: -# Sorin Ionescu -# - -# -# General -# - -# Set case-sensitivity for completion, history lookup, etc. -# zstyle ':prezto:*:*' case-sensitive 'yes' - -# Color output (auto set to 'no' on dumb terminals). -zstyle ':prezto:*:*' color 'yes' - -# Set the Zsh modules to load (man zshmodules). -# zstyle ':prezto:load' zmodule 'attr' 'stat' - -# Set the Zsh functions to load (man zshcontrib). -# zstyle ':prezto:load' zfunction 'zargs' 'zmv' - -# Set the Prezto modules to load (browse modules). -# The order matters. -zstyle ':prezto:load' pmodule \ - 'environment' \ - 'terminal' \ - 'prompt' \ - 'editor' \ - 'history' \ - 'directory' \ - 'completion' \ - 'syntax-highlighting' \ - 'autosuggestions' - -# -# Autosuggestions -# - -# Set the query found color. -# zstyle ':prezto:module:autosuggestions:color' found '' - -# -# Editor -# - -# Set the key mapping style to 'emacs' or 'vi'. -# zstyle ':prezto:module:editor' key-bindings 'vi' - -# Auto convert .... to ../.. -zstyle ':prezto:module:editor' dot-expansion 'yes' - -# Allow the zsh prompt context to be shown. -# zstyle ':prezto:module:editor' ps-context 'yes' - -# -# Git -# - -# Ignore submodules when they are 'dirty', 'untracked', 'all', or 'none'. -# zstyle ':prezto:module:git:status:ignore' submodules 'all' - -# -# GNU Utility -# - -# Set the command prefix on non-GNU systems. -# zstyle ':prezto:module:gnu-utility' prefix 'g' - -# -# History Substring Search -# - -# Set the query found color. -zstyle ':prezto:module:history-substring-search:color' found '' - -# Set the query not found color. -zstyle ':prezto:module:history-substring-search:color' not-found '' - -# Set the search globbing flags. -zstyle ':prezto:module:history-substring-search' globbing-flags '' - -# -# OS X -# - -# Set the keyword used by `mand` to open man pages in Dash.app -# zstyle ':prezto:module:osx:man' dash-keyword 'manpages' - -# -# Pacman -# - -# Set the Pacman frontend. -# zstyle ':prezto:module:pacman' frontend 'yaourt' - -# -# Prompt -# - -# Set the prompt theme to load. -# Setting it to 'random' loads a random theme. -# Auto set to 'off' on dumb terminals. -# zstyle ':prezto:module:prompt' theme 'pure' - -# Set the working directory prompt display length. -# By default, it is set to 'short'. Set it to 'long' (without '~' expansion) -# for longer or 'full' (with '~' expansion) for even longer prompt display. -zstyle ':prezto:module:prompt' pwd-length 'short' - -# -# Ruby -# - -# Auto switch the Ruby version on directory change. -# zstyle ':prezto:module:ruby:chruby' auto-switch 'yes' - -# -# Python -# - -# Auto switch the Python virtualenv on directory change. -# zstyle ':prezto:module:python:virtualenv' auto-switch 'yes' - -# -# Screen -# - -# Auto start a session when Zsh is launched in a local terminal. -# zstyle ':prezto:module:screen:auto-start' local 'yes' - -# Auto start a session when Zsh is launched in a SSH connection. -# zstyle ':prezto:module:screen:auto-start' remote 'yes' - -# -# SSH -# - -# Set the SSH identities to load into the agent. -# zstyle ':prezto:module:ssh:load' identities 'id_rsa' 'id_rsa2' 'id_github' - -# -# Syntax Highlighting -# - -# Set syntax highlighters. -# By default, only the main highlighter is enabled. -zstyle ':prezto:module:syntax-highlighting' highlighters \ - 'main' \ - 'brackets' \ - 'pattern' \ - 'line' \ - 'cursor' \ - 'root' - -# Set syntax highlighting styles. -zstyle ':prezto:module:syntax-highlighting' styles \ - 'builtin' 'fg=green' \ - 'command' 'fg=green' \ - 'function' 'fg=green' - -# Set syntax pattern styles. -zstyle ':prezto:module:syntax-highlighting' pattern \ - 'rm*-rf*' 'fg=white,bold,bg=red' - - -# Terminal -# - -# Auto set the tab and window titles. -# zstyle ':prezto:module:terminal' auto-title 'yes' - -# Set the window title format. -# zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s' - -# Set the tab title format. -# zstyle ':prezto:module:terminal:tab-title' format '%m: %s' - -# Set the terminal multiplexer title format. -# zstyle ':prezto:module:terminal:multiplexer-title' format '%s' - -# -# Tmux -# - -# Auto start a session when Zsh is launched in a local terminal. -# zstyle ':prezto:module:tmux:auto-start' local 'yes' - -# Auto start a session when Zsh is launched in a SSH connection. -# zstyle ':prezto:module:tmux:auto-start' remote 'yes' - -# Integrate with iTerm2. -# zstyle ':prezto:module:tmux:iterm' integrate 'yes' - -# Set the default session name: -# zstyle ':prezto:module:tmux:session' name 'YOUR DEFAULT SESSION NAME' - -# -# Utility -# - -# Enabled safe options. This aliases cp, ln, mv and rm so that they prompt -# before deleting or overwriting files. Set to 'no' to disable this safer -# behavior. -# zstyle ':prezto:module:utility' safe-ops 'yes' diff --git a/zshrc b/zshrc index b6e0f87..de3c517 100644 --- a/zshrc +++ b/zshrc @@ -1,6 +1,13 @@ -# Source Prezto. -if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then - source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" +# +# Zim +# + +# Change default zim location +export ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim + +# Source zim +if [[ -s ${ZIM_HOME}/init.zsh ]]; then + source ${ZIM_HOME}/init.zsh fi # @@ -96,5 +103,3 @@ if [[ "${terminfo[kcud1]}" != "" ]]; then zle -N down-line-or-beginning-search bindkey "${terminfo[kcud1]}" down-line-or-beginning-search fi - -prompt 🔥