mirror of
https://github.com/owenlejeune/zsh-plugins.git
synced 2025-11-08 08:32:43 -05:00
new plugins
This commit is contained in:
59
bd/bd.plugin.zsh
Executable file
59
bd/bd.plugin.zsh
Executable file
@@ -0,0 +1,59 @@
|
||||
#! /bin/bash
|
||||
alias bd="bdfn -si"
|
||||
|
||||
usage_error () {
|
||||
cat << EOF
|
||||
------------------------------------------------------------------
|
||||
Name: bd
|
||||
Version: 1.02
|
||||
|
||||
------------------------------------------------------------------
|
||||
Description: Go back to a specified directory up in the hierarchy.
|
||||
|
||||
------------------------------------------------------------------
|
||||
How to use:
|
||||
|
||||
Please refer https://github.com/vigneshwaranr/bd
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
newpwd() {
|
||||
oldpwd=$1
|
||||
case "$2" in
|
||||
-s)
|
||||
pattern=$3
|
||||
NEWPWD=$(echo $oldpwd | sed 's|\(.*/'$pattern'[^/]*/\).*|\1|')
|
||||
;;
|
||||
-si)
|
||||
pattern=$3
|
||||
NEWPWD=$(echo $oldpwd | perl -pe 's|(.*/'$pattern'[^/]*/).*|$1|i')
|
||||
;;
|
||||
*)
|
||||
pattern=$2
|
||||
NEWPWD=$(echo $oldpwd | sed 's|\(.*/'$pattern'/\).*|\1|')
|
||||
esac
|
||||
}
|
||||
|
||||
bdfn() {
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
usage_error
|
||||
elif [ "${@: -1}" = -v ]
|
||||
then
|
||||
usage_error
|
||||
else
|
||||
oldpwd=$(pwd)
|
||||
|
||||
newpwd "$oldpwd" "$@"
|
||||
|
||||
if [ "$NEWPWD" = "$oldpwd" ]
|
||||
then
|
||||
echo "No such occurrence."
|
||||
else
|
||||
echo $NEWPWD
|
||||
cd "$NEWPWD"
|
||||
fi
|
||||
unset NEWPWD
|
||||
fi
|
||||
}
|
||||
7
code/code.plugin.zsh
Executable file
7
code/code.plugin.zsh
Executable file
@@ -0,0 +1,7 @@
|
||||
alias vscode="code"
|
||||
alias vs-code="code"
|
||||
alias cdiff="code -d"
|
||||
alias cadd="code -a"
|
||||
alias cnew="code -n"
|
||||
alias code-install="code --install-extension"
|
||||
alias code-uninstall="code --uninstall-extension"
|
||||
3
copy/copy.plugin.zsh
Executable file
3
copy/copy.plugin.zsh
Executable file
@@ -0,0 +1,3 @@
|
||||
xcopy() { $1 | xclip -selection clipboard; }
|
||||
xcopyf() { cat $1 | xclip -selection clipboard; }
|
||||
xpaste() { xclip -selection clipboard -o; }
|
||||
Reference in New Issue
Block a user