1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2025-07-01 04:39:26 +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
4 changed files with 79 additions and 1 deletions

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

@ -28,6 +28,9 @@ elif (( $+commands[chruby-exec] )); then
source "${commands[chruby-exec]:h:h}/share/chruby/chruby.sh"
if zstyle -t ':prezto:module:ruby:chruby' auto-switch; then
source "${commands[chruby-exec]:h:h}/share/chruby/auto.sh"
# If a default Ruby is set, switch to it.
chruby_auto
fi
# Prepend local gems bin directories to PATH.

View File

@ -4,7 +4,8 @@ SSH
Provides for an easier use of [SSH][1] by setting up [ssh-agent][2].
This module is disabled on Mac OS X due to custom Apple SSH support rendering it
unnecessary.
unnecessary. Use `ssh-add -K` to store identities in Keychain; they will be
added to `ssh-agent` automatically and persist between reboots.
Settings
--------