mirror of
https://github.com/dcarrillo/prezto.git
synced 2025-07-01 11:39:26 +00:00
Compare commits
1 Commits
revision/z
...
issue/231-
Author | SHA1 | Date | |
---|---|---|---|
d541eef923 |
19
README.md
19
README.md
@ -16,28 +16,23 @@ non-standard core utilities.
|
||||
|
||||
zsh
|
||||
|
||||
2. Set the path to the Prezto installation directory:
|
||||
2. Clone the repository:
|
||||
|
||||
ZDOTDIR="${ZDOTDIR:-$HOME}"
|
||||
PREZTO="$ZDOTDIR/.zprezto"
|
||||
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
|
||||
|
||||
3. Clone the repository:
|
||||
|
||||
git clone --recursive https://github.com/sorin-ionescu/prezto.git "$PREZTO"
|
||||
|
||||
4. Create a new Zsh configuration by copying the Zsh configuration files
|
||||
3. Create a new Zsh configuration by copying the Zsh configuration files
|
||||
provided:
|
||||
|
||||
setopt EXTENDED_GLOB
|
||||
for rcfile in "$PREZTO/runcoms/^README.md(.N); do
|
||||
ln -s "$rcfile" "${ZDOTDIR}/.${rcfile:t}"
|
||||
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
|
||||
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
|
||||
done
|
||||
|
||||
5. Set Zsh as your default shell:
|
||||
4. Set Zsh as your default shell:
|
||||
|
||||
chsh -s /bin/zsh
|
||||
|
||||
6. Open a new Zsh terminal window or tab.
|
||||
5. Open a new Zsh terminal window or tab.
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
|
18
init.zsh
18
init.zsh
@ -31,7 +31,7 @@ function pmodload {
|
||||
pmodules=("$argv[@]")
|
||||
|
||||
# Add functions to $fpath.
|
||||
fpath=(${pmodules:+$PREZTO/modules/${^pmodules}/functions(/FN)} $fpath)
|
||||
fpath=(${pmodules:+${ZDOTDIR:-$HOME}/.zprezto/modules/${^pmodules}/functions(/FN)} $fpath)
|
||||
|
||||
function {
|
||||
local pfunction
|
||||
@ -40,7 +40,7 @@ function pmodload {
|
||||
setopt LOCAL_OPTIONS EXTENDED_GLOB
|
||||
|
||||
# Load Prezto functions.
|
||||
for pfunction in $PREZTO/modules/${^pmodules}/functions/$~pfunction_glob; do
|
||||
for pfunction in ${ZDOTDIR:-$HOME}/.zprezto/modules/${^pmodules}/functions/$~pfunction_glob; do
|
||||
autoload -Uz "$pfunction"
|
||||
done
|
||||
}
|
||||
@ -49,19 +49,19 @@ function pmodload {
|
||||
for pmodule in "$pmodules[@]"; do
|
||||
if zstyle -t ":prezto:module:$pmodule" loaded 'yes' 'no'; then
|
||||
continue
|
||||
elif [[ ! -d "$PREZTO/modules/$pmodule" ]]; then
|
||||
elif [[ ! -d "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule" ]]; then
|
||||
print "$0: no such module: $pmodule" >&2
|
||||
continue
|
||||
else
|
||||
if [[ -s "$PREZTO/modules/$pmodule/init.zsh" ]]; then
|
||||
source "$PREZTO/modules/$pmodule/init.zsh"
|
||||
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/init.zsh" ]]; then
|
||||
source "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/init.zsh"
|
||||
fi
|
||||
|
||||
if (( $? == 0 )); then
|
||||
zstyle ":prezto:module:$pmodule" loaded 'yes'
|
||||
else
|
||||
# Remove the $fpath entry.
|
||||
fpath[(r)$PREZTO/modules/${pmodule}/functions]=()
|
||||
fpath[(r)${ZDOTDIR:-$HOME}/.zprezto/modules/${pmodule}/functions]=()
|
||||
|
||||
function {
|
||||
local pfunction
|
||||
@ -71,7 +71,7 @@ function pmodload {
|
||||
setopt LOCAL_OPTIONS EXTENDED_GLOB
|
||||
|
||||
# Unload Prezto functions.
|
||||
for pfunction in $PREZTO/modules/$pmodule/functions/$~pfunction_glob; do
|
||||
for pfunction in ${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/functions/$~pfunction_glob; do
|
||||
unfunction "$pfunction"
|
||||
done
|
||||
}
|
||||
@ -87,8 +87,8 @@ function pmodload {
|
||||
#
|
||||
|
||||
# Source the Prezto configuration file.
|
||||
if [[ -s "$ZDOTDIR/.zpreztorc" ]]; then
|
||||
source "$ZDOTDIR/.zpreztorc"
|
||||
if [[ -s "${ZDOTDIR:-$HOME}/.zpreztorc" ]]; then
|
||||
source "${ZDOTDIR:-$HOME}/.zpreztorc"
|
||||
fi
|
||||
|
||||
# Disable color and theme in dumb terminals.
|
||||
|
@ -36,7 +36,7 @@ unsetopt FLOW_CONTROL # Disable start/stop characters in shell editor.
|
||||
|
||||
# Use caching to make completion for cammands such as dpkg and apt usable.
|
||||
zstyle ':completion::complete:*' use-cache on
|
||||
zstyle ':completion::complete:*' cache-path "$ZDOTDIR/.zcompcache"
|
||||
zstyle ':completion::complete:*' cache-path "${ZDOTDIR:-$HOME}/.zcompcache"
|
||||
|
||||
# Case-insensitive (all), partial-word, and then substring completion.
|
||||
if zstyle -t ':prezto:module:completion:*' case-sensitive; then
|
||||
|
@ -10,7 +10,7 @@
|
||||
# Variables
|
||||
#
|
||||
|
||||
HISTFILE="$ZDOTDIR/.zhistory" # The path to the history file.
|
||||
HISTFILE="${ZDOTDIR:-$HOME}/.zhistory" # The path to the history file.
|
||||
HISTSIZE=10000 # The maximum number of events to save in the internal history.
|
||||
SAVEHIST=10000 # The maximum number of events to save in the history file.
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
# Execute code that does not affect the current session in the background.
|
||||
{
|
||||
# Compile the completion dump to increase startup speed.
|
||||
zcompdump="$ZDOTDIR/.zcompdump"
|
||||
zcompdump="${ZDOTDIR:-$HOME}/.zcompdump"
|
||||
if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then
|
||||
zcompile "$zcompdump"
|
||||
fi
|
||||
|
@ -10,10 +10,3 @@ if [[ "$SHLVL" -eq 1 && ! -o LOGIN ]]; then
|
||||
source "${ZDOTDIR:-$HOME}/.zprofile"
|
||||
fi
|
||||
|
||||
#
|
||||
# Zsh
|
||||
#
|
||||
|
||||
ZDOTDIR="${ZDOTDIR:-$HOME}"
|
||||
PREZTO="$ZDOTDIR/.zprezto"
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
#
|
||||
|
||||
# Source Prezto.
|
||||
if [[ -s "$PREZTO/init.zsh" ]]; then
|
||||
source "$PREZTO/init.zsh"
|
||||
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
|
||||
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
|
||||
fi
|
||||
|
||||
# Customize to your needs...
|
||||
|
57
tools/go.sh
Normal file
57
tools/go.sh
Normal file
@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
|
||||
clear
|
||||
echo ""
|
||||
|
||||
hash zsh 2>/dev/null || {
|
||||
echo "\033[0;31mFailed : ZSH is missing\033[0m"
|
||||
echo " ➥ Prezto does not work without ZSH. Install it first."
|
||||
echo ""
|
||||
exit
|
||||
}
|
||||
|
||||
if [ -d ~/.zprezto ]
|
||||
then
|
||||
echo "\033[0;33mYou already have prezto installed.\033[0m Upgrading..."
|
||||
cd ~/.zprezto
|
||||
# git pull && git submodule update --init --recursive
|
||||
/usr/bin/env git add .
|
||||
/usr/bin/env git commit --all --message "Commit changes before upgrade" --quiet
|
||||
/usr/bin/env git pull --recurse-submodules
|
||||
/usr/bin/env git submodule update
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "\033[0;34mCloning prezto...\033[0m"
|
||||
hash git >/dev/null && /usr/bin/env git clone --recursive https://github.com/loranger/prezto.git "${ZDOTDIR:-$HOME}/.zprezto" >/dev/null 2>&1 || {
|
||||
echo "\033[0;31mFailed : Git is not installed\033[0m"
|
||||
os=`uname`
|
||||
if [ "$os" == 'Linux' ]; then
|
||||
url='http://git-scm.com/download/linux'
|
||||
elif [ "$os" == 'Darwin' ]; then
|
||||
url='http://brew.sh/'
|
||||
else
|
||||
url='http://git-scm.com/'
|
||||
fi
|
||||
|
||||
echo " ➥ You should really take a look at $url"
|
||||
exit
|
||||
}
|
||||
|
||||
for file in $HOME/.zprezto/runcoms/z*
|
||||
do
|
||||
rcfile=`basename $file`
|
||||
if [ -f $HOME/.$rcfile ] || [ -h $HOME/.$rcfile ]
|
||||
then
|
||||
echo "\033[0;33mFound ~/.$rcfile file.\033[0m \033[0;32mMoved to ~/.$rcfile.old\033[0m";
|
||||
mv $HOME/.$rcfile $HOME/.$rcfile.old;
|
||||
fi
|
||||
ln -s $file $HOME/.$rcfile
|
||||
done
|
||||
|
||||
echo "\033[0;32mPrezto is ready\033[0m"
|
||||
|
||||
echo "\033[0;34mNow set zsh as your default shell by typing :\033[0m"
|
||||
echo "chsh -s $(which zsh)"
|
||||
echo "\033[0;34mand start a new term.\033[0m"
|
||||
# https://raw2.github.com/loranger/prezto/master/go.sh
|
97
tools/install.zsh
Executable file
97
tools/install.zsh
Executable file
@ -0,0 +1,97 @@
|
||||
#!/bin/zsh
|
||||
|
||||
script_name="${0:t}"
|
||||
script_version='1.0.0'
|
||||
cached_argv="${argv}"
|
||||
backup_dir="$HOME/.prezto-backup/$(date +'%Y-%m-%d-%H-%M-%S')"
|
||||
|
||||
# Writes to standard error.
|
||||
function print-error {
|
||||
print "${script_name}: ${@}" >&2
|
||||
}
|
||||
|
||||
# Writes to standard output.
|
||||
function print-info {
|
||||
print "${@}" >&1
|
||||
}
|
||||
|
||||
# Writes version information to standard errror.
|
||||
function version {
|
||||
print "${script_name} ${script_version}
|
||||
|
||||
Copyright (c) 2013 Sorin Ionescu
|
||||
|
||||
This program is free software. You may modify or distribute it
|
||||
under the terms of the MIT License." >&2
|
||||
}
|
||||
|
||||
# Writes help to standard error.
|
||||
function help {
|
||||
print "Usage: ${script_name} [‐option ...] archive [directory]
|
||||
|
||||
Options:
|
||||
-v, --version Display version and copyright
|
||||
-h, --help Display this help
|
||||
|
||||
Report bugs to <sorin.ionescu@gmail.com>." >&2
|
||||
}
|
||||
|
||||
# Backs up existing files.
|
||||
function backup {
|
||||
local from="$1"
|
||||
local to="$2"
|
||||
|
||||
if [[ ! -e "$from" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
mkdir -p "$to:h"
|
||||
mv "$from" "$to"
|
||||
}
|
||||
|
||||
# Parse switches.
|
||||
while [[ "${1}" == -* ]]; do
|
||||
case "${1}" in
|
||||
( -v | --version )
|
||||
version
|
||||
exit 0
|
||||
;;
|
||||
( -h | --help )
|
||||
help
|
||||
exit 0
|
||||
;;
|
||||
( -- )
|
||||
shift
|
||||
break
|
||||
;;
|
||||
( -* )
|
||||
print-error "invalid option: ${1}"
|
||||
help
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
|
||||
setopt EXTENDED_GLOB
|
||||
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
|
||||
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
|
||||
done
|
||||
chsh -s /bin/zsh
|
||||
|
||||
is-true "$use_color" && printf "$FG[green]"
|
||||
printf '%s' \
|
||||
'________ _____
|
||||
___ __ \___________________ /______
|
||||
__ /_/ /_ ___/ _ \__ /_ __/ __ \
|
||||
_ ____/_ / / __/_ /_/ /_ / /_/ /
|
||||
/_/ /_/ \___/_____/\__/ \____/
|
||||
'
|
||||
is-true "$use_color" && printf "$FG[cyan]"
|
||||
print
|
||||
print 'Prezto has been updated to the latest version.'
|
||||
print 'Follow me on GitHub at https://github.com/sorin-ionescu/prezto.'
|
||||
|
||||
exec zsh
|
||||
|
||||
|
1
tools/uninstall.zsh
Executable file
1
tools/uninstall.zsh
Executable file
@ -0,0 +1 @@
|
||||
#!/bin/zsh
|
Reference in New Issue
Block a user