mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-11-20 09:41:12 +00:00
[general] Miscellaneous cleanup and formatting
This commit is contained in:
parent
7b5196ca66
commit
a60499f933
2
init.zsh
2
init.zsh
@ -30,7 +30,7 @@ function zprezto-update {
|
|||||||
printf "to manually pull and possibly merge in changes\n"
|
printf "to manually pull and possibly merge in changes\n"
|
||||||
}
|
}
|
||||||
cd -q -- "${ZPREZTODIR}" || return 7
|
cd -q -- "${ZPREZTODIR}" || return 7
|
||||||
local orig_branch="$(git symbolic-ref HEAD 2>/dev/null | cut -d '/' -f 3)"
|
local orig_branch="$(git symbolic-ref HEAD 2> /dev/null | cut -d '/' -f 3)"
|
||||||
if [[ "$orig_branch" == "master" ]]; then
|
if [[ "$orig_branch" == "master" ]]; then
|
||||||
git fetch || return "$?"
|
git fetch || return "$?"
|
||||||
local UPSTREAM=$(git rev-parse '@{u}')
|
local UPSTREAM=$(git rev-parse '@{u}')
|
||||||
|
@ -107,9 +107,9 @@ zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-va
|
|||||||
zstyle -a ':prezto:module:completion:*:hosts' etc-host-ignores '_etc_host_ignores'
|
zstyle -a ':prezto:module:completion:*:hosts' etc-host-ignores '_etc_host_ignores'
|
||||||
|
|
||||||
zstyle -e ':completion:*:hosts' hosts 'reply=(
|
zstyle -e ':completion:*:hosts' hosts 'reply=(
|
||||||
${=${=${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) 2>/dev/null)"}%%[#| ]*}//\]:[0-9]*/ }//,/ }//\[/ }
|
${=${=${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) 2> /dev/null)"}%%[#| ]*}//\]:[0-9]*/ }//,/ }//\[/ }
|
||||||
${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2>/dev/null))"}%%(\#${_etc_host_ignores:+|${(j:|:)~_etc_host_ignores}})*}
|
${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2> /dev/null))"}%%(\#${_etc_host_ignores:+|${(j:|:)~_etc_host_ignores}})*}
|
||||||
${=${${${${(@M)${(f)"$(cat ~/.ssh/config 2>/dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}}
|
${=${${${${(@M)${(f)"$(cat ~/.ssh/config 2> /dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}}
|
||||||
)'
|
)'
|
||||||
|
|
||||||
# Don't complete uninteresting users...
|
# Don't complete uninteresting users...
|
||||||
|
@ -29,7 +29,7 @@ case "$state" in
|
|||||||
remote="$words[(($CURRENT - 1))]"
|
remote="$words[(($CURRENT - 1))]"
|
||||||
|
|
||||||
branches_or_tags=($(
|
branches_or_tags=($(
|
||||||
git ls-remote --heads --tags "$remote" 2>/dev/null | cut -f2
|
git ls-remote --heads --tags "$remote" 2> /dev/null | cut -f2
|
||||||
))
|
))
|
||||||
|
|
||||||
branches=(HEAD ${${(M)branches_or_tags[@]##refs/heads/?##}##refs/heads/})
|
branches=(HEAD ${${(M)branches_or_tags[@]##refs/heads/?##}##refs/heads/})
|
||||||
@ -39,7 +39,7 @@ case "$state" in
|
|||||||
_describe -t tag 'tags' tags && ret=0
|
_describe -t tag 'tags' tags && ret=0
|
||||||
;;
|
;;
|
||||||
(file)
|
(file)
|
||||||
files=(${(0)"$(_call_program files git ls-files -z --exclude-standard 2>/dev/null)"})
|
files=(${(0)"$(_call_program files git ls-files -z --exclude-standard 2> /dev/null)"})
|
||||||
_wanted file expl 'file' _multi_parts - / files && ret=0
|
_wanted file expl 'file' _multi_parts - / files && ret=0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -39,7 +39,7 @@ if (( $references[(i)$reference] == $#references + 1 )); then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$reference" == 'HEAD' ]]; then
|
if [[ "$reference" == 'HEAD' ]]; then
|
||||||
reference="$(git rev-parse HEAD 2>/dev/null)"
|
reference="$(git rev-parse HEAD 2> /dev/null)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
file="$3"
|
file="$3"
|
||||||
|
@ -11,7 +11,7 @@ if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
|
|||||||
source "$HOME/.nvm/nvm.sh"
|
source "$HOME/.nvm/nvm.sh"
|
||||||
|
|
||||||
# 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"
|
||||||
|
|
||||||
# Load manually installed nodenv into the shell session.
|
# Load manually installed nodenv into the shell session.
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
function mand {
|
function mand {
|
||||||
if (( $# > 0 )); then
|
if (( $# > 0 )); then
|
||||||
zstyle -s ':prezto:module:osx:man' dash-keyword 'dashkw' || dashkw='manpages'
|
zstyle -s ':prezto:module:osx:man' dash-keyword 'dashkw' || dashkw='manpages'
|
||||||
open "dash://$dashkw:$1" 2>/dev/null
|
open "dash://$dashkw:$1" 2> /dev/null
|
||||||
if (( $? != 0 )); then
|
if (( $? != 0 )); then
|
||||||
print "$0: Dash is not installed" >&2
|
print "$0: Dash is not installed" >&2
|
||||||
break
|
break
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
# function pfd {
|
# function pfd {
|
||||||
|
|
||||||
osascript 2>/dev/null <<EOF
|
osascript 2> /dev/null <<EOF
|
||||||
tell application "Finder"
|
tell application "Finder"
|
||||||
return POSIX path of (target of first window as text)
|
return POSIX path of (target of first window as text)
|
||||||
end tell
|
end tell
|
||||||
|
@ -11,7 +11,7 @@ local command="cd \\\"$PWD\\\""
|
|||||||
(( $# > 0 )) && command="${command}; $*"
|
(( $# > 0 )) && command="${command}; $*"
|
||||||
|
|
||||||
the_app=$(
|
the_app=$(
|
||||||
osascript 2>/dev/null <<EOF
|
osascript 2> /dev/null <<EOF
|
||||||
tell application "System Events"
|
tell application "System Events"
|
||||||
name of first item of (every process whose frontmost is true)
|
name of first item of (every process whose frontmost is true)
|
||||||
end tell
|
end tell
|
||||||
@ -19,7 +19,7 @@ EOF
|
|||||||
)
|
)
|
||||||
|
|
||||||
[[ "$the_app" == 'Terminal' ]] && {
|
[[ "$the_app" == 'Terminal' ]] && {
|
||||||
osascript 2>/dev/null <<EOF
|
osascript 2> /dev/null <<EOF
|
||||||
tell application "System Events"
|
tell application "System Events"
|
||||||
tell process "Terminal" to keystroke "t" using command down
|
tell process "Terminal" to keystroke "t" using command down
|
||||||
tell application "Terminal" to do script "${command}" in front window
|
tell application "Terminal" to do script "${command}" in front window
|
||||||
@ -28,7 +28,7 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[ "$the_app" == 'iTerm' ]] && {
|
[[ "$the_app" == 'iTerm' ]] && {
|
||||||
osascript 2>/dev/null <<EOF
|
osascript 2> /dev/null <<EOF
|
||||||
tell application "iTerm"
|
tell application "iTerm"
|
||||||
set current_terminal to current terminal
|
set current_terminal to current terminal
|
||||||
tell current_terminal
|
tell current_terminal
|
||||||
@ -43,7 +43,7 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[ "$the_app" == 'iTerm2' ]] && {
|
[[ "$the_app" == 'iTerm2' ]] && {
|
||||||
osascript 2>/dev/null <<EOF
|
osascript 2> /dev/null <<EOF
|
||||||
tell application "iTerm2"
|
tell application "iTerm2"
|
||||||
tell current window
|
tell current window
|
||||||
create tab with default profile
|
create tab with default profile
|
||||||
|
@ -50,8 +50,7 @@ if [[ "$OSTYPE" == darwin* ]]; then
|
|||||||
source "$cache_file"
|
source "$cache_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset perl_path
|
unset cache_file perl_path
|
||||||
unset cache_file
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -74,7 +74,7 @@ function prompt_sorin_precmd {
|
|||||||
# Handle updating git data. We also clear the git prompt data if we're in a
|
# Handle updating git data. We also clear the git prompt data if we're in a
|
||||||
# different git root now.
|
# different git root now.
|
||||||
if (( $+functions[git-dir] )); then
|
if (( $+functions[git-dir] )); then
|
||||||
local new_git_root="$(git-dir 2>/dev/null)"
|
local new_git_root="$(git-dir 2> /dev/null)"
|
||||||
if [[ $new_git_root != $_sorin_cur_git_root ]]; then
|
if [[ $new_git_root != $_sorin_cur_git_root ]]; then
|
||||||
_prompt_sorin_git=''
|
_prompt_sorin_git=''
|
||||||
_sorin_cur_git_root=$new_git_root
|
_sorin_cur_git_root=$new_git_root
|
||||||
@ -142,7 +142,7 @@ function prompt_sorin_preview {
|
|||||||
local +h RPROMPT=''
|
local +h RPROMPT=''
|
||||||
local +h SPROMPT=''
|
local +h SPROMPT=''
|
||||||
|
|
||||||
editor-info 2>/dev/null
|
editor-info 2> /dev/null
|
||||||
prompt_preview_theme 'sorin'
|
prompt_preview_theme 'sorin'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ function _terminal-set-titles-with-command {
|
|||||||
local -A jobtexts_from_parent_shell
|
local -A jobtexts_from_parent_shell
|
||||||
jobtexts_from_parent_shell=(${(kv)jobtexts})
|
jobtexts_from_parent_shell=(${(kv)jobtexts})
|
||||||
|
|
||||||
jobs "$job_name" 2>/dev/null > >(
|
jobs "$job_name" 2> /dev/null > >(
|
||||||
read index discarded
|
read index discarded
|
||||||
# The index is already surrounded by brackets: [1].
|
# The index is already surrounded by brackets: [1].
|
||||||
_terminal-set-titles-with-command "${(e):-\$jobtexts_from_parent_shell$index}"
|
_terminal-set-titles-with-command "${(e):-\$jobtexts_from_parent_shell$index}"
|
||||||
|
Loading…
Reference in New Issue
Block a user