Merge remote branch 'upstream/master'
commit
61cb7a71dd
|
|
@ -1,27 +1,27 @@
|
||||||
# Open the root of your site in your vim or cd to it
|
# Open the root of your site in your vim or builtin cd to it
|
||||||
|
|
||||||
if [[ $EDITOR = "vim" ]]
|
if [[ $EDITOR = "vim" ]]
|
||||||
then alias newentry="cd $JEKYLL_LOCAL_ROOT && $EDITOR ."
|
then alias newentry="builtin cd $JEKYLL_LOCAL_ROOT && $EDITOR ."
|
||||||
else alias newentry="cd $JEKYLL_LOCAL_ROOT"
|
else alias newentry="builtin cd $JEKYLL_LOCAL_ROOT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Open the _posts/ directory for making a new blog post (seperate from above alias because not everyone uses jekyll for a blog)
|
# Open the _posts/ directory for making a new blog post (seperate from above alias because not everyone uses jekyll for a blog)
|
||||||
|
|
||||||
# if [ $editor = "vim" ]
|
# if [ $editor = "vim" ]
|
||||||
# then
|
# then
|
||||||
# alias newpost="cd $jekyll_local_root/_posts && $editor ."
|
# alias newpost="builtin cd $jekyll_local_root/_posts && $editor ."
|
||||||
# else
|
# else
|
||||||
# alias newpost="cd $jekyll_local_root"
|
# alias newpost="builtin cd $jekyll_local_root"
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
# Build and locally serve the site
|
# Build and locally serve the site
|
||||||
|
|
||||||
alias testsite="cd $JEKYLL_LOCAL_ROOT && jekyll --server --auto"
|
alias testsite="builtin cd $JEKYLL_LOCAL_ROOT && jekyll --server --auto"
|
||||||
|
|
||||||
# Build but don't locally serve the site
|
# Build but don't locally serve the site
|
||||||
|
|
||||||
alias buildsite="cd $JEKYLL_LOCAL_ROOT && rm -rf _site/ && jekyll"
|
alias buildsite="builtin cd $JEKYLL_LOCAL_ROOT && rm -rf _site/ && jekyll"
|
||||||
|
|
||||||
# Rsync the site to the remote server
|
# Rsync the site to the remote server
|
||||||
|
|
||||||
alias deploysite="cd $JEKYLL_LOCAL_ROOT && rsync -rz _site/ $JEKYLL_REMOTE_ROOT"
|
alias deploysite="builtin cd $JEKYLL_LOCAL_ROOT && rsync -rz _site/ $JEKYLL_REMOTE_ROOT"
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,10 @@ pri() {
|
||||||
ri -T "${1}" | open -f -a $PREVIEW
|
ri -T "${1}" | open -f -a $PREVIEW
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quiet() {
|
||||||
|
$* &> /dev/null &
|
||||||
|
}
|
||||||
|
|
||||||
banish-cookies() {
|
banish-cookies() {
|
||||||
rm -r ~/.macromedia ~/.adobe
|
rm -r ~/.macromedia ~/.adobe
|
||||||
ln -s /dev/null ~/.adobe
|
ln -s /dev/null ~/.adobe
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,40 @@ function git_remove_missing_files() {
|
||||||
# Adds files to git's exclude file (same as .gitignore)
|
# Adds files to git's exclude file (same as .gitignore)
|
||||||
function local-ignore() {
|
function local-ignore() {
|
||||||
echo "$1" >> .git/info/exclude
|
echo "$1" >> .git/info/exclude
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# get a quick overview for your git repo
|
||||||
|
function git_info() {
|
||||||
|
if [ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]; then
|
||||||
|
# print informations
|
||||||
|
echo "git repo overview"
|
||||||
|
echo "-----------------"
|
||||||
|
echo
|
||||||
|
|
||||||
|
# print all remotes and thier details
|
||||||
|
for remote in $(git remote show); do
|
||||||
|
echo $remote:
|
||||||
|
git remote show $remote
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
|
||||||
|
# print status of working repo
|
||||||
|
echo "status:"
|
||||||
|
if [ -n "$(git status -s 2> /dev/null)" ]; then
|
||||||
|
git status -s
|
||||||
|
else
|
||||||
|
echo "working directory is clean"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# print at least 5 last log entries
|
||||||
|
echo
|
||||||
|
echo "log:"
|
||||||
|
git log -5 --oneline
|
||||||
|
echo
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "you're currently not in a git repository"
|
||||||
|
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,55 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
newpost() {
|
newpost() {
|
||||||
|
|
||||||
# 'cd' into the local jekyll root
|
# 'builtin cd' into the local jekyll root
|
||||||
|
|
||||||
cd "$JEKYLL_LOCAL_ROOT/_posts"
|
builtin cd "$JEKYLL_LOCAL_ROOT/_posts"
|
||||||
|
|
||||||
# Get the date for the new post's filename
|
# Get the date for the new post's filename
|
||||||
|
|
||||||
FNAME_DATE=$(date "+%Y-%m-%d")
|
FNAME_DATE=$(date "+%Y-%m-%d")
|
||||||
|
|
||||||
|
# If the user is using markdown formatting, let them choose what type of post they want. Sort of like Tumblr.
|
||||||
|
|
||||||
|
OPTIONS="Text Quote Image Audio Video"
|
||||||
|
|
||||||
|
if [ $JEKYLL_FORMATTING = "markdown" -o $JEKYLL_FORMATTING = "textile" ]
|
||||||
|
then
|
||||||
|
select OPTION in $OPTIONS
|
||||||
|
do
|
||||||
|
if [[ $OPTION = "Text" ]]
|
||||||
|
then
|
||||||
|
POST_TYPE="Text"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $OPTION = "Quote" ]]
|
||||||
|
then
|
||||||
|
POST_TYPE="Quote"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $OPTION = "Image" ]]
|
||||||
|
then
|
||||||
|
POST_TYPE="Image"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $OPTION = "Audio" ]]
|
||||||
|
then
|
||||||
|
POST_TYPE="Audio"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $OPTION = "Video" ]]
|
||||||
|
then
|
||||||
|
POST_TYPE="Video"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Get the title for the new post
|
# Get the title for the new post
|
||||||
|
|
||||||
read -p "Enter title of the new post: " POST_TITLE
|
read -p "Enter title of the new post: " POST_TITLE
|
||||||
|
|
@ -50,6 +92,68 @@ newpost() {
|
||||||
echo "---" >> $FNAME
|
echo "---" >> $FNAME
|
||||||
echo >> $FNAME
|
echo >> $FNAME
|
||||||
|
|
||||||
|
# Generate template text based on the post type
|
||||||
|
|
||||||
|
if [[ $JEKYLL_FORMATTING = "markdown" ]]
|
||||||
|
then
|
||||||
|
if [[ $POST_TYPE = "Text" ]]
|
||||||
|
then
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $POST_TYPE = "Quote" ]]
|
||||||
|
then
|
||||||
|
echo "> Quote" >> $FNAME
|
||||||
|
echo >> $FNAME
|
||||||
|
echo "— Author" >> $FNAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $POST_TYPE = "Image" ]]
|
||||||
|
then
|
||||||
|
echo "" >> $FNAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $POST_TYPE = "Audio" ]]
|
||||||
|
then
|
||||||
|
echo "<html><audio src=\"/path/to/audio/file\" controls=\"controls\"></audio></html>" >> $FNAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $POST_TYPE = "Video" ]]
|
||||||
|
then
|
||||||
|
echo "<html><video src=\"/path/to/video\" controls=\"controls\"></video></html>" >> $FNAME
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $JEKYLL_FORMATTING = "textile" ]]
|
||||||
|
then
|
||||||
|
if [[ $POST_TYPE = "Text" ]]
|
||||||
|
then
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $POST_TYPE = "Quote" ]]
|
||||||
|
then
|
||||||
|
echo "bq. Quote" >> $FNAME
|
||||||
|
echo >> $FNAME
|
||||||
|
echo "— Author" >> $FNAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $POST_TYPE = "Image" ]]
|
||||||
|
then
|
||||||
|
echo "!url(alt text)" >> $FNAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $POST_TYPE = "Audio" ]]
|
||||||
|
then
|
||||||
|
echo "<html><audio src=\"/path/to/audio/file\" controls=\"controls\"></audio></html>" >> $FNAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $POST_TYPE = "Video" ]]
|
||||||
|
then
|
||||||
|
echo "<html><video src=\"/path/to/video\" controls=\"controls\"></video></html>" >> $FNAME
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Open the file in your favorite editor
|
# Open the file in your favorite editor
|
||||||
|
|
||||||
$EDITOR $FNAME
|
$EDITOR $FNAME
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
#!/bin/bash
|
||||||
|
_vagrant()
|
||||||
|
{
|
||||||
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
|
commands="box destroy halt help init package provision reload resume ssh ssh_config status suspend up version"
|
||||||
|
|
||||||
|
if [ $COMP_CWORD == 1 ]
|
||||||
|
then
|
||||||
|
COMPREPLY=($(compgen -W "${commands}" -- ${cur}))
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $COMP_CWORD == 2 ]
|
||||||
|
then
|
||||||
|
case "$prev" in
|
||||||
|
"box")
|
||||||
|
box_commands="add help list remove repackage"
|
||||||
|
COMPREPLY=($(compgen -W "${box_commands}" -- ${cur}))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
"help")
|
||||||
|
COMPREPLY=($(compgen -W "${commands}" -- ${cur}))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $COMP_CWORD == 3 ]
|
||||||
|
then
|
||||||
|
action="${COMP_WORDS[COMP_CWORD-2]}"
|
||||||
|
if [ $action == 'box' ]
|
||||||
|
then
|
||||||
|
case "$prev" in
|
||||||
|
"remove"|"repackage")
|
||||||
|
local box_list=$(find $HOME/.vagrant/boxes/* -maxdepth 0 -type d -printf '%f ')
|
||||||
|
COMPREPLY=($(compgen -W "${box_list}" -- ${cur}))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
complete -F _vagrant vagrant
|
||||||
|
|
||||||
|
|
@ -50,7 +50,7 @@ function prompt_char {
|
||||||
}
|
}
|
||||||
|
|
||||||
function git_prompt_info {
|
function git_prompt_info {
|
||||||
if [[ -n $(git status -s 2> /dev/null) ]]; then
|
if [[ -n $(git status -s 2> /dev/null |grep -v ^# |grep -v "working directory clean") ]]; then
|
||||||
state=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY}
|
state=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY}
|
||||||
else
|
else
|
||||||
state=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN}
|
state=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN}
|
||||||
|
|
@ -81,4 +81,4 @@ function rvm_version_prompt {
|
||||||
rvm=$(rvm tools identifier) || return
|
rvm=$(rvm tools identifier) || return
|
||||||
echo -e "$RVM_THEME_PROMPT_PREFIX$rvm$RVM_THEME_PROMPT_SUFFIX"
|
echo -e "$RVM_THEME_PROMPT_PREFIX$rvm$RVM_THEME_PROMPT_SUFFIX"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,5 @@ prompt_setter() {
|
||||||
}
|
}
|
||||||
|
|
||||||
PROMPT_COMMAND=prompt_setter
|
PROMPT_COMMAND=prompt_setter
|
||||||
|
|
||||||
|
export PS3=">> "
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue