1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2025-07-01 19:49:25 +00:00

Compare commits

..

4 Commits

Author SHA1 Message Date
9ab6ab0d66 Added alias expansion and fixed README 2014-11-11 22:43:15 -05:00
0a3d29ce5e Added explainshell module 2014-11-11 22:43:15 -05:00
366cadecf0 If a default Ruby is set, switch to it
Set PATH variables to allow gems such as Bundler to be found and for the
`ruby-info` function to properly work.

A default Ruby must be set in ~/.ruby-version; for more information, see
https://github.com/postmodern/chruby#default-ruby.

Signed-off-by: Sorin Ionescu <sorin.ionescu@gmail.com>
2014-11-11 22:38:24 -05:00
3debe8bdf6 Inform on how to add SSH identities to Keychain
Signed-off-by: Sorin Ionescu <sorin.ionescu@gmail.com>
2014-11-11 21:18:59 -05:00
31 changed files with 153 additions and 235 deletions

View File

@ -86,8 +86,7 @@ License
(The MIT License) (The MIT License)
Copyright (c) 2009-2011 Robby Russell and contributors. Copyright (c) 2009-2011 Robby Russell and contributors.
Copyright (c) 2011-2014 Sorin Ionescu and contributors.
Copyright (c) 2011-2015 Sorin Ionescu and contributors.
Permission is hereby granted, free of charge, to any person obtaining a copy of Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in this software and associated documentation files (the "Software"), to deal in
@ -108,7 +107,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
[1]: http://www.zsh.org [1]: http://www.zsh.org
[2]: http://i.imgur.com/nrGV6pg.png "sorin theme" [2]: http://i.imgur.com/AzjmpwM.png "sorin theme"
[3]: http://git-scm.com [3]: http://git-scm.com
[4]: https://github.com [4]: https://github.com
[5]: http://gitimmersion.com [5]: http://gitimmersion.com

View File

@ -26,11 +26,6 @@ Directory
Sets directory options and defines directory aliases. Sets directory options and defines directory aliases.
DNF
---
Defines dnf aliases.
Dpkg Dpkg
---- ----
@ -97,7 +92,7 @@ Homebrew
Defines Homebrew aliases. Defines Homebrew aliases.
MacPorts Macports
-------- --------
Defines MacPorts aliases and adds MacPorts directories to path variables. Defines MacPorts aliases and adds MacPorts directories to path variables.

View File

@ -24,7 +24,7 @@ autoload -Uz compinit && compinit -i
setopt COMPLETE_IN_WORD # Complete from both ends of a word. setopt COMPLETE_IN_WORD # Complete from both ends of a word.
setopt ALWAYS_TO_END # Move cursor to the end of a completed word. setopt ALWAYS_TO_END # Move cursor to the end of a completed word.
setopt PATH_DIRS # Perform path search even on command names with slashes. setopt PATH_DIRS # Perform path search even on command names with slashes.
setopt AUTO_MENU # Show completion menu on a successive tab press. setopt AUTO_MENU # Show completion menu on a succesive tab press.
setopt AUTO_LIST # Automatically list choices on ambiguous completion. setopt AUTO_LIST # Automatically list choices on ambiguous completion.
setopt AUTO_PARAM_SLASH # If completed parameter is a directory, add a trailing slash. setopt AUTO_PARAM_SLASH # If completed parameter is a directory, add a trailing slash.
unsetopt MENU_COMPLETE # Do not autoselect the first completion entry. unsetopt MENU_COMPLETE # Do not autoselect the first completion entry.
@ -34,7 +34,7 @@ unsetopt FLOW_CONTROL # Disable start/stop characters in shell editor.
# Styles # Styles
# #
# Use caching to make completion for commands such as dpkg and apt usable. # Use caching to make completion for cammands such as dpkg and apt usable.
zstyle ':completion::complete:*' use-cache on zstyle ':completion::complete:*' use-cache on
zstyle ':completion::complete:*' cache-path "${ZDOTDIR:-$HOME}/.zcompcache" zstyle ':completion::complete:*' cache-path "${ZDOTDIR:-$HOME}/.zcompcache"
@ -116,7 +116,7 @@ zstyle ':completion:*:(rm|kill|diff):*' ignore-line other
zstyle ':completion:*:rm:*' file-patterns '*:all-files' zstyle ':completion:*:rm:*' file-patterns '*:all-files'
# Kill # Kill
zstyle ':completion:*:*:*:*:processes' command 'ps -u $LOGNAME -o pid,user,command -w' zstyle ':completion:*:*:*:*:processes' command 'ps -u $USER -o pid,user,command -w'
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;36=0=01' zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;36=0=01'
zstyle ':completion:*:*:kill:*' menu yes select zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:*:kill:*' force-list always zstyle ':completion:*:*:kill:*' force-list always

View File

@ -1,29 +0,0 @@
DNF
===
Defines [dnf][1] aliases.
Aliases
-------
- `dnfc` removes package(s) and leaves.
- `dnfi` installs package(s).
- `dnfh` displays history.
- `dnfl` lists packages.
- `dnfL` lists installed packages.
- `dnfq` displays package information.
- `dnfr` removes package(s).
- `dnfs` searches for a package.
- `dnfu` updates packages.
- `dnfU` upgrates packages.
Authors
-------
*The authors of this module should be contacted via the [issue tracker][2].*
- [Sorin Ionescu](https://github.com/sorin-ionescu)
[1]: https://fedoraproject.org/wiki/Features/DNF
[2]: https://github.com/sorin-ionescu/prezto/issues

View File

@ -1,28 +0,0 @@
#
# Defines dnf aliases.
#
# Authors:
# FireWave <firewave@free.fr>
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Return if requirements are not found.
if (( ! $+commands[dnf] )); then
return 1
fi
#
# Aliases
#
alias dnfc='sudo dnf clean all' # Cleans the cache.
alias dnfh='dnf history' # Displays history.
alias dnfi='sudo dnf install' # Installs package(s).
alias dnfl='dnf list' # Lists packages.
alias dnfL='dnf list installed' # Lists installed packages.
alias dnfq='dnf info' # Displays package information.
alias dnfr='sudo dnf remove' # Removes package(s).
alias dnfs='dnf search' # Searches for a package.
alias dnfu='sudo dnf update' # Updates packages.
alias dnfU='sudo dnf upgrade' # Upgrades packages.

View File

@ -33,6 +33,15 @@ unsetopt BG_NICE # Don't run all background jobs at a lower priority.
unsetopt HUP # Don't kill jobs on shell exit. unsetopt HUP # Don't kill jobs on shell exit.
unsetopt CHECK_JOBS # Don't report on jobs when shell exit. unsetopt CHECK_JOBS # Don't report on jobs when shell exit.
#
# Grep
#
if zstyle -t ':prezto:environment:grep' color; then
export GREP_COLOR='37;45'
export GREP_OPTIONS='--color=auto'
fi
# #
# Termcap # Termcap
# #

View File

@ -0,0 +1,11 @@
#Explainshell
Adds a keybinding and a function to open
[explainshell.com](http://www.explainshell.com) with the content of the command
line.
##Settings
###Key-Binding
The keybinding to open [explainshell.com](http://www.explainshell.com)
`zstyle ':prezto:module:explainshell' key-binding '^K'`

View File

@ -0,0 +1,63 @@
#
# Adds a explain function and explainshell widget
#
# Authors
# C Lentfort
#
function _expand_alias_recursive {
local _alias
for word in "$@"; do
# Check if word is aliased
_alias=$aliases[$word]
if [ -n "$_alias" ]; then
# Check if found alias and given command are identical
if [[ "$_alias" != "${(j: :)@}" ]]; then
_expand_alias_recursive "${(z)_alias}"
else
_explainshell_expanded_buffer+=$1
fi
else
_explainshell_expanded_buffer+=$word
fi
done
}
function explain {
local url
# We don't explain empty buffers
if (( $# == 0 )); then
return 1;
fi
# Replace aliases with their actual expansions
_explainshell_expanded_buffer=()
_expand_alias_recursive $@
_explainshell_expanded_buffer=(${(u)_explainshell_expanded_buffer})
# base url with first command already injected
# $ explain tar
# => http://explainshel.com/explain/tar?args=
url="http://explainshell.com/explain?cmd="
# iterates over remaining args and adds builds the rest of the url
for i in "$_explainshell_expanded_buffer"; do
url=$url"$i""+"
done
unset _explainshell_expanded_buffer
# opens url in browser
$BROWSER -t $url &> /dev/null
}
function explainshell {
explain ${(z)BUFFER}
}
zle -N explainshell
zstyle -s ':prezto:module:explainshell' key-binding 'key_binding'
if [[ -n "$key_binding" ]]; then
bindkey "$key_binding" explainshell
fi
unset key_binding

View File

@ -11,16 +11,16 @@ if (( ! $+commands[gpg-agent] )); then
fi fi
# Set the default paths to gpg-agent files. # Set the default paths to gpg-agent files.
_gpg_agent_conf="${GNUPGHOME:-$HOME/.gnupg}/gpg-agent.conf" _gpg_agent_conf="$HOME/.gnupg/gpg-agent.conf"
_gpg_agent_env="${TMPDIR:-/tmp}/gpg-agent.env" _gpg_agent_env="${TMPDIR:-/tmp}/gpg-agent.env"
# Start gpg-agent if not started. # Start gpg-agent if not started.
if [[ -z "$GPG_AGENT_INFO" && ! -S "${GNUPGHOME:-$HOME/.gnupg}/S.gpg-agent" ]]; then if [[ -z "$GPG_AGENT_INFO" ]]; then
# Export environment variables. # Export environment variables.
source "$_gpg_agent_env" 2> /dev/null source "$_gpg_agent_env" 2> /dev/null
# Start gpg-agent if not started. # Start gpg-agent if not started.
if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${${${(s.:.)GPG_AGENT_INFO}[2]}:--1} gpg-agent"; then if ! ps -U "$USER" -o pid,ucomm | grep -q -- "${${${(s.:.)GPG_AGENT_INFO}[2]}:--1} gpg-agent"; then
eval "$(gpg-agent --daemon | tee "$_gpg_agent_env")" eval "$(gpg-agent --daemon | tee "$_gpg_agent_env")"
fi fi
fi fi
@ -35,12 +35,6 @@ if grep 'enable-ssh-support' "$_gpg_agent_conf" &> /dev/null; then
# Load the SSH module for additional processing. # Load the SSH module for additional processing.
pmodload 'ssh' pmodload 'ssh'
# Updates the GPG-Agent TTY before every command since SSH does not set it.
function _gpg-agent-update-tty {
gpg-connect-agent UPDATESTARTUPTTY /bye >/dev/null
}
add-zsh-hook preexec _gpg-agent-update-tty
fi fi
# Clean up. # Clean up.

View File

@ -13,7 +13,8 @@ Aliases
- `brewi` installs a formula. - `brewi` installs a formula.
- `brewl` lists installed formulae. - `brewl` lists installed formulae.
- `brews` searches for a formula. - `brews` searches for a formula.
- `brewu` updates Homebrew and formulae. - `brewU` upgrades Homebrew and outdated brews.
- `brewu` upgrades Homebrew.
- `brewx` uninstalls a formula. - `brewx` uninstalls a formula.
### Homebrew Cask ### Homebrew Cask

View File

@ -6,7 +6,7 @@
# #
# Return if requirements are not found. # Return if requirements are not found.
if [[ "$OSTYPE" != (darwin|linux)* ]]; then if [[ "$OSTYPE" != darwin* ]]; then
return 1 return 1
fi fi
@ -20,7 +20,8 @@ alias brewC='brew cleanup --force'
alias brewi='brew install' alias brewi='brew install'
alias brewl='brew list' alias brewl='brew list'
alias brews='brew search' alias brews='brew search'
alias brewu='brew update && brew upgrade --all' alias brewu='brew upgrade'
alias brewU='brew update && brew upgrade'
alias brewx='brew remove' alias brewx='brew remove'
# Homebrew Cask # Homebrew Cask

View File

@ -1,4 +1,4 @@
MacPorts Macports
======== ========
Defines MacPorts aliases and adds MacPorts directories to path variables. Defines MacPorts aliases and adds MacPorts directories to path variables.

View File

@ -13,9 +13,10 @@ if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
# Load package manager installed NVM into the shell session. # Load package manager installed NVM into the shell session.
elif (( $+commands[brew] )) && [[ -d "$(brew --prefix nvm 2>/dev/null)" ]]; then elif (( $+commands[brew] )) && [[ -d "$(brew --prefix nvm 2>/dev/null)" ]]; then
source $(brew --prefix nvm)/nvm.sh source $(brew --prefix nvm)/nvm.sh
fi
# Return if requirements are not found. # Return if requirements are not found.
elif (( ! $+commands[node] )); then if (( ! $+commands[node] )); then
return 1 return 1
fi fi

View File

@ -46,7 +46,7 @@ The most basic example of this function can be seen below.
If the `prompt_name_setup` function is customizable via parameters, a help If the `prompt_name_setup` function is customizable via parameters, a help
function **should** be defined. The user will access it via `prompt -h name`. function **should** be defined. The user will access it via `prompt -h name`.
The most basic example of this function can be seen below. The most basic example of this function can be seen bellow.
function prompt_name_help { function prompt_name_help {
cat <<EOH cat <<EOH
@ -63,7 +63,7 @@ The most basic example of this function can be seen below.
If the `prompt_name_setup` function is customizable via parameters, a preview If the `prompt_name_setup` function is customizable via parameters, a preview
function **should** be defined. The user will access it via `prompt -p name`. function **should** be defined. The user will access it via `prompt -p name`.
The most basic example of this function can be seen below. The most basic example of this function can be seen bellow.
function prompt_name_preview { function prompt_name_preview {
if (( $# > 0 )); then if (( $# > 0 )); then
@ -91,7 +91,7 @@ a function before you calling it.
**Do not register hook functions. They will be registered by the `prompt` function.** **Do not register hook functions. They will be registered by the `prompt` function.**
The most basic example of this function can be seen below. The most basic example of this function can be seen bellow.
function prompt_name_precmd { function prompt_name_precmd {
if (( $+functions[git-info] )); then if (( $+functions[git-info] )); then

View File

@ -1 +0,0 @@
../external/pure/async.zsh

View File

@ -114,7 +114,7 @@ function prompt_cloud_setup {
'rprompt' '' 'rprompt' ''
# Define prompts. # Define prompts.
PROMPT='%B%F{$primary_color}${prefix}%f%b %B%F{$secondary_color}%c%f%b ${git_info:+${(e)git_info[prompt]}} ' PROMPT='%B%F{$primary_color}${prefix}%f%b %B%F{$secondary_color}%c%f%b $git_info[prompt] '
RPROMPT='' RPROMPT=''
} }

View File

@ -58,7 +58,7 @@ function prompt_kylewest_setup {
zstyle ':prezto:module:ruby:info:version' format '%F{blue}[%v]%f' zstyle ':prezto:module:ruby:info:version' format '%F{blue}[%v]%f'
# Define prompts. # Define prompts.
PROMPT='%F{cyan}%c%f ${git_info:+${(e)git_info[prompt]}}${editor_info[keymap]} ' PROMPT='%F{cyan}%c%f ${git_info[prompt]}${editor_info[keymap]} '
RPROMPT='${ruby_info[version]}' RPROMPT='${ruby_info[version]}'
} }

View File

@ -18,7 +18,7 @@ pmodload 'helper'
# Define variables. # Define variables.
_prompt_paradox_current_bg='NONE' _prompt_paradox_current_bg='NONE'
_prompt_paradox_segment_separator='' _prompt_paradox_segment_separator=''
_prompt_paradox_start_time=$SECONDS _prompt_paradox_start_time=$SECONDS
function prompt_paradox_start_segment { function prompt_paradox_start_segment {
@ -129,7 +129,7 @@ function prompt_paradox_setup {
zstyle ':prezto:module:git:info:added' format ' ✚' zstyle ':prezto:module:git:info:added' format ' ✚'
zstyle ':prezto:module:git:info:ahead' format ' ⬆' zstyle ':prezto:module:git:info:ahead' format ' ⬆'
zstyle ':prezto:module:git:info:behind' format ' ⬇' zstyle ':prezto:module:git:info:behind' format ' ⬇'
zstyle ':prezto:module:git:info:branch' format ' %b' zstyle ':prezto:module:git:info:branch' format ' %b'
zstyle ':prezto:module:git:info:commit' format '➦ %.7c' zstyle ':prezto:module:git:info:commit' format '➦ %.7c'
zstyle ':prezto:module:git:info:deleted' format ' ✖' zstyle ':prezto:module:git:info:deleted' format ' ✖'
zstyle ':prezto:module:git:info:dirty' format ' ⁝' zstyle ':prezto:module:git:info:dirty' format ' ⁝'

View File

@ -68,7 +68,7 @@ function prompt_skwp_setup {
zstyle ':prezto:module:ruby:info:version' format '[%v]' zstyle ':prezto:module:ruby:info:version' format '[%v]'
# Define prompts. # Define prompts.
PROMPT="${_prompt_skwp_colors[3]}%n%f@${_prompt_skwp_colors[2]}%m%f ${_prompt_skwp_colors[5]}%~%f "'${git_info:+${(e)git_info[prompt]}}'"$ " PROMPT="${_prompt_skwp_colors[3]}%n%f@${_prompt_skwp_colors[2]}%m%f ${_prompt_skwp_colors[5]}%~%f "'$git_info[prompt]'"$ "
RPROMPT='%F{blue}${ruby_info[version]}' RPROMPT='%F{blue}${ruby_info[version]}'
} }

View File

@ -57,7 +57,7 @@ function prompt_smiley_setup {
zstyle ':prezto:module:git:info:keys' format 'prompt' '(%b%D)' zstyle ':prezto:module:git:info:keys' format 'prompt' '(%b%D)'
# Define prompts. # Define prompts.
PROMPT='$python_info[virtualenv]$ruby_info[version]${git_info:+${(e)git_info[prompt]}} %B%c%b %(?:%F{green}ツ%f:%F{red}✖%f) ' PROMPT='$python_info[virtualenv]$ruby_info[version]${git_info[prompt]} %B%c%b %(?:%F{green}ツ%f:%F{red}✖%f) '
RPROMPT='${editor_info[overwrite]}${VIM:+" %B%F{green}V%f%b"}' RPROMPT='${editor_info[overwrite]}${VIM:+" %B%F{green}V%f%b"}'
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
} }

View File

@ -5,28 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
# Screenshots: # Screenshots:
# http://i.imgur.com/nrGV6pg.png # http://i.imgur.com/AzjmpwM.png
#
#
# 16 Terminal Colors
# -- ---------------
# 0 black
# 1 red
# 2 green
# 3 yellow
# 4 blue
# 5 magenta
# 6 cyan
# 7 white
# 8 bright black
# 9 bright red
# 10 bright green
# 11 bright yellow
# 12 bright blue
# 13 bright magenta
# 14 bright cyan
# 15 bright white
# #
# Load dependencies. # Load dependencies.
@ -43,35 +22,6 @@ function prompt_sorin_pwd {
fi fi
} }
function prompt_sorin_git_info {
if (( _prompt_sorin_precmd_async_pid > 0 )); then
# Append Git status.
if [[ -s "$_prompt_sorin_precmd_async_data" ]]; then
alias typeset='typeset -g'
source "$_prompt_sorin_precmd_async_data"
RPROMPT+='${git_info:+${(e)git_info[status]}}'
unalias typeset
fi
# Reset PID.
_prompt_sorin_precmd_async_pid=0
# Redisplay prompt.
zle && zle reset-prompt
fi
}
function prompt_sorin_precmd_async {
# Get Git repository information.
if (( $+functions[git-info] )); then
git-info
typeset -p git_info >! "$_prompt_sorin_precmd_async_data"
fi
# Signal completion to parent process.
kill -WINCH $$
}
function prompt_sorin_precmd { function prompt_sorin_precmd {
setopt LOCAL_OPTIONS setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS unsetopt XTRACE KSH_ARRAYS
@ -79,26 +29,16 @@ function prompt_sorin_precmd {
# Format PWD. # Format PWD.
prompt_sorin_pwd prompt_sorin_pwd
# Define prompts. # Get Git repository information.
RPROMPT='${editor_info[overwrite]}%(?:: %F{1}⏎%f)${VIM:+" %B%F{6}V%f%b"}' if (( $+functions[git-info] )); then
git-info
# Kill the old process of slow commands if it is still running.
if (( _prompt_sorin_precmd_async_pid > 0 )); then
kill -KILL "$_prompt_sorin_precmd_async_pid" &>/dev/null
fi fi
# Compute slow commands in the background.
trap prompt_sorin_git_info WINCH
prompt_sorin_precmd_async &!
_prompt_sorin_precmd_async_pid=$!
} }
function prompt_sorin_setup { function prompt_sorin_setup {
setopt LOCAL_OPTIONS setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst) prompt_opts=(cr percent subst)
_prompt_sorin_precmd_async_pid=0
_prompt_sorin_precmd_async_data="${TMPPREFIX}-prompt_sorin_data"
# Load required functions. # Load required functions.
autoload -Uz add-zsh-hook autoload -Uz add-zsh-hook
@ -107,42 +47,34 @@ function prompt_sorin_setup {
add-zsh-hook precmd prompt_sorin_precmd add-zsh-hook precmd prompt_sorin_precmd
# Set editor-info parameters. # Set editor-info parameters.
zstyle ':prezto:module:editor:info:completing' format '%B%F{7}...%f%b' zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b'
zstyle ':prezto:module:editor:info:keymap:primary' format ' %B%F{1}%F{3}%F{2}%f%b' zstyle ':prezto:module:editor:info:keymap:primary' format ' %B%F{red}%F{yellow}%F{green}%f%b'
zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format ' %F{3}♺%f' zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format ' %F{red}♺%f'
zstyle ':prezto:module:editor:info:keymap:alternate' format ' %B%F{2}%F{3}%F{1}%f%b' zstyle ':prezto:module:editor:info:keymap:alternate' format ' %B%F{green}%F{yellow}%F{red}%f%b'
# Set git-info parameters. # Set git-info parameters.
zstyle ':prezto:module:git:info' verbose 'yes' zstyle ':prezto:module:git:info' verbose 'yes'
zstyle ':prezto:module:git:info:action' format '%F{7}:%f%%B%F{9}%s%f%%b' zstyle ':prezto:module:git:info:action' format ':%%B%F{yellow}%s%f%%b'
zstyle ':prezto:module:git:info:added' format ' %%B%F{2}✚%f%%b' zstyle ':prezto:module:git:info:added' format ' %%B%F{green}✚%f%%b'
zstyle ':prezto:module:git:info:ahead' format ' %%B%F{13}⬆%f%%b' zstyle ':prezto:module:git:info:ahead' format ' %%B%F{yellow}⬆%f%%b'
zstyle ':prezto:module:git:info:behind' format ' %%B%F{13}⬇%f%%b' zstyle ':prezto:module:git:info:behind' format ' %%B%F{yellow}⬇%f%%b'
zstyle ':prezto:module:git:info:branch' format ' %%B%F{2}%b%f%%b' zstyle ':prezto:module:git:info:branch' format ':%F{green}%b%f'
zstyle ':prezto:module:git:info:commit' format ' %%B%F{3}%.7c%f%%b' zstyle ':prezto:module:git:info:commit' format ':%F{green}%.7c%f'
zstyle ':prezto:module:git:info:deleted' format ' %%B%F{1}✖%f%%b' zstyle ':prezto:module:git:info:deleted' format ' %%B%F{red}✖%f%%b'
zstyle ':prezto:module:git:info:modified' format ' %%B%F{4}✱%f%%b' zstyle ':prezto:module:git:info:modified' format ' %%B%F{blue}✱%f%%b'
zstyle ':prezto:module:git:info:position' format ' %%B%F{13}%p%f%%b' zstyle ':prezto:module:git:info:position' format ':%F{red}%p%f'
zstyle ':prezto:module:git:info:renamed' format ' %%B%F{5}➜%f%%b' zstyle ':prezto:module:git:info:renamed' format ' %%B%F{magenta}➜%f%%b'
zstyle ':prezto:module:git:info:stashed' format ' %%B%F{6}✭%f%%b' zstyle ':prezto:module:git:info:stashed' format ' %%B%F{cyan}✭%f%%b'
zstyle ':prezto:module:git:info:unmerged' format ' %%B%F{3}═%f%%b' zstyle ':prezto:module:git:info:unmerged' format ' %%B%F{yellow}═%f%%b'
zstyle ':prezto:module:git:info:untracked' format ' %%B%F{7}◼%f%%b' zstyle ':prezto:module:git:info:untracked' format ' %%B%F{white}◼%f%%b'
zstyle ':prezto:module:git:info:keys' format \ zstyle ':prezto:module:git:info:keys' format \
'status' '$(coalesce "%b" "%p" "%c")%s%A%B%S%a%d%m%r%U%u' 'prompt' ' %F{blue}git%f$(coalesce "%b" "%p" "%c")%s' \
'rprompt' '%A%B%S%a%d%m%r%U%u'
# Define prompts. # Define prompts.
PROMPT='${SSH_TTY:+"%F{9}%n%f%F{7}@%f%F{3}%m%f "}%F{4}${_prompt_sorin_pwd}%(!. %B%F{1}#%f%b.)${editor_info[keymap]} ' PROMPT='${SSH_TTY:+"%F{red}%n%f@%F{yellow}%m%f "}%F{cyan}${_prompt_sorin_pwd}%f${git_info:+${(e)git_info[prompt]}}%(!. %B%F{red}#%f%b.)${editor_info[keymap]} '
RPROMPT='' RPROMPT='${editor_info[overwrite]}%(?:: %F{red}⏎%f)${VIM:+" %B%F{green}V%f%b"}${INSIDE_EMACS:+" %B%F{green}E%f%b"}${git_info[rprompt]}'
SPROMPT='zsh: correct %F{1}%R%f to %F{2}%r%f [nyae]? ' SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
}
function prompt_sorin_preview {
local +h PROMPT=''
local +h RPROMPT=''
local +h SPROMPT=''
editor-info 2>/dev/null
prompt_preview_theme 'sorin'
} }
prompt_sorin_setup "$@" prompt_sorin_setup "$@"

View File

@ -25,7 +25,7 @@ if [[ ! -S "$SSH_AUTH_SOCK" ]]; then
source "$_ssh_agent_env" 2> /dev/null source "$_ssh_agent_env" 2> /dev/null
# Start ssh-agent if not started. # Start ssh-agent if not started.
if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then if ! ps -U "$USER" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then
eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")" eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")"
fi fi
fi fi

View File

@ -6,7 +6,7 @@
# #
# Return if requirements are not found. # Return if requirements are not found.
if [[ "$TERM" == (dumb|linux|*bsd*|eterm*) ]]; then if [[ "$TERM" == (dumb|linux|*bsd*) ]]; then
return 1 return 1
fi fi

View File

@ -30,15 +30,6 @@ in *tmux.conf*:
set-option -g destroy-unattached [on | off] set-option -g destroy-unattached [on | off]
#### iTerm2 Integration
[iTerm2][6] offers significant integration with tmux. This can be enabled by
adding the following line to *zpreztorc*:
zstyle ':prezto:module:tmux:iterm' integrate 'yes'
Read [iTerm2 and tmux Integration][7] for more information.
Aliases Aliases
------- -------
@ -73,5 +64,3 @@ Authors
[3]: https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard [3]: https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
[4]: https://github.com/mxcl/homebrew [4]: https://github.com/mxcl/homebrew
[5]: https://github.com/sorin-ionescu/prezto/issues [5]: https://github.com/sorin-ionescu/prezto/issues
[6]: http://iterm2.com
[7]: https://gitlab.com/gnachman/iterm2/wikis/TmuxIntegration

View File

@ -17,12 +17,6 @@ fi
# Auto Start # Auto Start
# #
if ([[ "$TERM_PROGRAM" = 'iTerm.app' ]] && \
zstyle -t ':prezto:module:tmux:iterm' integrate \
); then
_tmux_iterm_integration='-CC'
fi
if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" ]] && ( \ if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" ]] && ( \
( [[ -n "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' remote ) || ( [[ -n "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' remote ) ||
( [[ -z "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' local ) \ ( [[ -z "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' local ) \
@ -38,12 +32,12 @@ if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" ]] && ( \
fi fi
# Attach to the 'prezto' session or to the last session used. # Attach to the 'prezto' session or to the last session used.
exec tmux $_tmux_iterm_integration attach-session exec tmux attach-session
fi fi
# #
# Aliases # Aliases
# #
alias tmuxa="tmux $_tmux_iterm_integration new-session -A" alias tmuxa='tmux attach-session'
alias tmuxl='tmux list-sessions' alias tmuxl='tmux list-sessions'

View File

@ -71,9 +71,9 @@ if is-callable 'dircolors'; then
eval "$(dircolors --sh)" eval "$(dircolors --sh)"
fi fi
alias ls="${aliases[ls]:-ls} --color=auto" alias ls="$aliases[ls] --color=auto"
else else
alias ls="${aliases[ls]:-ls} -F" alias ls="$aliases[ls] -F"
fi fi
else else
# BSD Core Utilities # BSD Core Utilities
@ -84,9 +84,9 @@ else
# Define colors for the completion system. # Define colors for the completion system.
export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=36;01:cd=33;01:su=31;40;07:sg=36;40;07:tw=32;40;07:ow=33;40;07:' export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=36;01:cd=33;01:su=31;40;07:sg=36;40;07:tw=32;40;07:ow=33;40;07:'
alias ls="${aliases[ls]:-ls} -G" alias ls='ls -G'
else else
alias ls="${aliases[ls]:-ls} -F" alias ls='ls -F'
fi fi
fi fi
@ -102,14 +102,6 @@ alias lc='lt -c' # Lists sorted by date, most recent last, shows change
alias lu='lt -u' # Lists sorted by date, most recent last, shows access time. alias lu='lt -u' # Lists sorted by date, most recent last, shows access time.
alias sl='ls' # I often screw this up. alias sl='ls' # I often screw this up.
# Grep
if zstyle -t ':prezto:module:utility:grep' color; then
export GREP_COLOR='37;45' # BSD.
export GREP_COLORS="mt=$GREP_COLOR" # GNU.
alias grep="${aliases[grep]:-grep} --color=auto"
fi
# Mac OS X Everywhere # Mac OS X Everywhere
if [[ "$OSTYPE" == darwin* ]]; then if [[ "$OSTYPE" == darwin* ]]; then
alias o='open' alias o='open'
@ -146,13 +138,8 @@ alias du='du -kh'
if (( $+commands[htop] )); then if (( $+commands[htop] )); then
alias top=htop alias top=htop
else else
if [[ "$OSTYPE" == (darwin*|*bsd*) ]]; then alias topc='top -o cpu'
alias topc='top -o cpu' alias topm='top -o vsize'
alias topm='top -o vsize'
else
alias topc='top -o %CPU'
alias topm='top -o %MEM'
fi
fi fi
# Miscellaneous # Miscellaneous
@ -196,5 +183,5 @@ function find-exec {
# Displays user owned processes status. # Displays user owned processes status.
function psu { function psu {
ps -U "${1:-$LOGNAME}" -o 'pid,%cpu,%mem,command' "${(@)argv[2,-1]}" ps -U "${1:-$USER}" -o 'pid,%cpu,%mem,command' "${(@)argv[2,-1]}"
} }

View File

@ -152,6 +152,3 @@ zstyle ':prezto:module:prompt' theme 'sorin'
# Auto start a session when Zsh is launched in a SSH connection. # Auto start a session when Zsh is launched in a SSH connection.
# zstyle ':prezto:module:tmux:auto-start' remote 'yes' # zstyle ':prezto:module:tmux:auto-start' remote 'yes'
# Integrate with iTerm2.
# zstyle ':prezto:module:tmux:iterm' integrate 'yes'

View File

@ -67,8 +67,11 @@ fi
# #
if [[ ! -d "$TMPDIR" ]]; then if [[ ! -d "$TMPDIR" ]]; then
export TMPDIR="/tmp/$LOGNAME" export TMPDIR="/tmp/$USER"
mkdir -p -m 700 "$TMPDIR" mkdir -p -m 700 "$TMPDIR"
fi fi
TMPPREFIX="${TMPDIR%/}/zsh" TMPPREFIX="${TMPDIR%/}/zsh"
if [[ ! -d "$TMPPREFIX" ]]; then
mkdir -p "$TMPPREFIX"
fi