mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
Merge remote branch 'origin/master' into restructure_plugins
This commit is contained in:
commit
d340bfab33
18 changed files with 119 additions and 5 deletions
39
plugins/dirpersist/dirpersist.plugin.zsh
Normal file
39
plugins/dirpersist/dirpersist.plugin.zsh
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/zsh
|
||||
#
|
||||
# Make the dirstack more persistant
|
||||
#
|
||||
# Add dirpersist to $plugins in ~/.zshrc to load
|
||||
#
|
||||
|
||||
# $zdirstore is the file used to persist the stack
|
||||
zdirstore=~/.zdirstore
|
||||
|
||||
dirpersistinstall () {
|
||||
if grep 'dirpersiststore' ~/.zlogout > /dev/null; then
|
||||
else
|
||||
if read -q \?"Would you like to set up your .zlogout file for use with dirspersist? (y/n) "; then
|
||||
echo "# Store dirs stack\n# See ~/.oh-my-zsh/plugins/dirspersist.plugin.zsh\ndirpersiststore" >> ~/.zlogout
|
||||
else
|
||||
echo "If you don't want this message to appear, remove dirspersist from \$plugins"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
dirpersiststore () {
|
||||
dirs -p | perl -e 'foreach (reverse <STDIN>) {chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"}' > $zdirstore
|
||||
}
|
||||
|
||||
dirpersistrestore () {
|
||||
if [ -f $zdirstore ]; then
|
||||
source $zdirstore
|
||||
fi
|
||||
}
|
||||
|
||||
DIRSTACKSIZE=10
|
||||
setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups
|
||||
|
||||
dirpersistinstall
|
||||
dirpersistrestore
|
||||
|
||||
# Make popd changes permanent without having to wait for logout
|
||||
alias popd="popd;dirpersiststore"
|
||||
7
plugins/macports/macports.plugin.zsh
Normal file
7
plugins/macports/macports.plugin.zsh
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#Aliases
|
||||
alias pc="sudo port clean --all installed"
|
||||
alias pi="sudo port install $1"
|
||||
alias psu="sudo port selfupdate"
|
||||
alias puni="sudo port uninstall inactive"
|
||||
alias puo="sudo port upgrade outdated"
|
||||
alias pup="psu && puo"
|
||||
23
plugins/ssh-agent/ssh-agent.plugin.zsh
Normal file
23
plugins/ssh-agent/ssh-agent.plugin.zsh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Based on code from Joseph M. Reagle
|
||||
# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
|
||||
|
||||
local SSH_ENV=$HOME/.ssh/environment
|
||||
|
||||
function start_agent {
|
||||
/usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
|
||||
chmod 600 ${SSH_ENV}
|
||||
. ${SSH_ENV} > /dev/null
|
||||
/usr/bin/ssh-add;
|
||||
}
|
||||
|
||||
# Source SSH settings, if applicable
|
||||
|
||||
if [ -f "${SSH_ENV}" ]; then
|
||||
. ${SSH_ENV} > /dev/null
|
||||
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
|
||||
start_agent;
|
||||
}
|
||||
else
|
||||
start_agent;
|
||||
fi
|
||||
|
||||
22
plugins/vi-mode/vi-mode.plugin.zsh
Normal file
22
plugins/vi-mode/vi-mode.plugin.zsh
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
function zle-line-init zle-keymap-select {
|
||||
zle reset-prompt
|
||||
}
|
||||
|
||||
zle -N zle-line-init
|
||||
zle -N zle-keymap-select
|
||||
|
||||
bindkey -v
|
||||
|
||||
# if mode indicator wasn't setup by theme, define default
|
||||
if [[ "$MODE_INDICATOR" == "" ]]; then
|
||||
MODE_INDICATOR="%{$fg_bold[red]%}<%{$fg[red]%}<<%{$reset_color%}"
|
||||
fi
|
||||
|
||||
function vi_mode_prompt_info() {
|
||||
echo "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}"
|
||||
}
|
||||
|
||||
# define right prompt, if it wasn't defined by a theme
|
||||
if [[ "$RPS1" == "" && "$RPROMPT" == "" ]]; then
|
||||
RPS1='$(vi_mode_prompt_info)'
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue