From 7b1312002fccf4053adc5e7c8b53693f72c5f2f3 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sat, 13 Nov 2010 10:21:59 -0600 Subject: [PATCH 01/12] Changed 'cd's to 'builtin cd's, because I have a modified cd command (cd then ls) and it can get annoying when using the Jekyll aliases. --- aliases/jekyll.aliases.bash | 16 ++++++++-------- plugins/jekyll.plugins.bash | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/aliases/jekyll.aliases.bash b/aliases/jekyll.aliases.bash index a5078e32..11922d6c 100644 --- a/aliases/jekyll.aliases.bash +++ b/aliases/jekyll.aliases.bash @@ -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" ]] -then alias newentry="cd $JEKYLL_LOCAL_ROOT && $EDITOR ." -else alias newentry="cd $JEKYLL_LOCAL_ROOT" +then alias newentry="builtin cd $JEKYLL_LOCAL_ROOT && $EDITOR ." +else alias newentry="builtin cd $JEKYLL_LOCAL_ROOT" fi # 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" ] # then -# alias newpost="cd $jekyll_local_root/_posts && $editor ." +# alias newpost="builtin cd $jekyll_local_root/_posts && $editor ." # else -# alias newpost="cd $jekyll_local_root" +# alias newpost="builtin cd $jekyll_local_root" # fi # 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 -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 -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" diff --git a/plugins/jekyll.plugins.bash b/plugins/jekyll.plugins.bash index 1933f074..00ac7b0f 100644 --- a/plugins/jekyll.plugins.bash +++ b/plugins/jekyll.plugins.bash @@ -1,8 +1,8 @@ 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 From c8f94b08926181e190d6986d795ef1933e024b33 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Mon, 15 Nov 2010 20:03:35 -0600 Subject: [PATCH 02/12] Added shebang --- plugins/jekyll.plugins.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/jekyll.plugins.bash b/plugins/jekyll.plugins.bash index 00ac7b0f..9a044a99 100644 --- a/plugins/jekyll.plugins.bash +++ b/plugins/jekyll.plugins.bash @@ -1,3 +1,5 @@ +#!/bin/bash + newpost() { # 'builtin cd' into the local jekyll root From 12d8abda060e06a1704b26ea8411fde7b0089b60 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Mon, 15 Nov 2010 20:29:36 -0600 Subject: [PATCH 03/12] Added ability to choose post type with newpost() function. --- plugins/jekyll.plugins.bash | 67 +++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/plugins/jekyll.plugins.bash b/plugins/jekyll.plugins.bash index 9a044a99..adb39fcc 100644 --- a/plugins/jekyll.plugins.bash +++ b/plugins/jekyll.plugins.bash @@ -10,6 +10,44 @@ newpost() { 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. + # TODO: Add support for Textile formatting too. + + OPTIONS="Text Quote Image Audio Video" + + 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 + # Get the title for the new post read -p "Enter title of the new post: " POST_TITLE @@ -52,6 +90,35 @@ newpost() { echo "---" >> $FNAME echo >> $FNAME + # Generate template text based on the post type + + 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 "![Alternate Text](/path/to/image/or/url)" >> $FNAME + fi + + if [[ $POST_TYPE = "Audio" ]] + then + echo "" >> $FNAME + fi + + if [[ $POST_TYPE = "Video" ]] + then + echo "" >> $FNAME + fi + # Open the file in your favorite editor $EDITOR $FNAME From 14c78bff05efa06b98bfe875281f9866ecca949b Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Mon, 15 Nov 2010 20:31:38 -0600 Subject: [PATCH 04/12] Added check to make sure the user is using Markdown formatting with newpost() --- plugins/jekyll.plugins.bash | 106 +++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 50 deletions(-) diff --git a/plugins/jekyll.plugins.bash b/plugins/jekyll.plugins.bash index adb39fcc..ef8888c6 100644 --- a/plugins/jekyll.plugins.bash +++ b/plugins/jekyll.plugins.bash @@ -14,39 +14,42 @@ newpost() { # TODO: Add support for Textile formatting too. OPTIONS="Text Quote Image Audio Video" - - 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 [[ $JEKYLL_FORMATTING = "markdown" ]] + then + select OPTION in $OPTIONS + do + if [[ $OPTION = "Text" ]] + then + POST_TYPE="Text" + break + fi - if [[ $OPTION = "Audio" ]] - then - POST_TYPE="Audio" - break - fi + if [[ $OPTION = "Quote" ]] + then + POST_TYPE="Quote" + break + fi + + if [[ $OPTION = "Image" ]] + then + POST_TYPE="Image" + break + fi - if [[ $OPTION = "Video" ]] - then - POST_TYPE="Video" - break - fi - done + 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 @@ -92,31 +95,34 @@ newpost() { # Generate template text based on the post type - if [[ $POST_TYPE = "Text" ]] + if [[ $JEKYLL_FORMATTING = "markdown" ]] then - true - fi + if [[ $POST_TYPE = "Text" ]] + then + true + fi - if [[ $POST_TYPE = "Quote" ]] - then - echo "> Quote" >> $FNAME - echo >> $FNAME - echo "— Author" >> $FNAME - fi + if [[ $POST_TYPE = "Quote" ]] + then + echo "> Quote" >> $FNAME + echo >> $FNAME + echo "— Author" >> $FNAME + fi - if [[ $POST_TYPE = "Image" ]] - then - echo "![Alternate Text](/path/to/image/or/url)" >> $FNAME - fi + if [[ $POST_TYPE = "Image" ]] + then + echo "![Alternate Text](/path/to/image/or/url)" >> $FNAME + fi - if [[ $POST_TYPE = "Audio" ]] - then - echo "" >> $FNAME - fi + if [[ $POST_TYPE = "Audio" ]] + then + echo "" >> $FNAME + fi - if [[ $POST_TYPE = "Video" ]] - then - echo "" >> $FNAME + if [[ $POST_TYPE = "Video" ]] + then + echo "" >> $FNAME + fi fi # Open the file in your favorite editor From 415d8b7458f6d77c072fc1cecdd7761008666b18 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Mon, 15 Nov 2010 20:42:36 -0600 Subject: [PATCH 05/12] Added support for Textile formatting in newpost() --- plugins/jekyll.plugins.bash | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/plugins/jekyll.plugins.bash b/plugins/jekyll.plugins.bash index ef8888c6..9b0d5c1e 100644 --- a/plugins/jekyll.plugins.bash +++ b/plugins/jekyll.plugins.bash @@ -11,11 +11,10 @@ newpost() { 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. - # TODO: Add support for Textile formatting too. OPTIONS="Text Quote Image Audio Video" - if [[ $JEKYLL_FORMATTING = "markdown" ]] + if [ $JEKYLL_FORMATTING = "markdown" -o $JEKYLL_FORMATTING = "textile" ] then select OPTION in $OPTIONS do @@ -116,12 +115,42 @@ newpost() { if [[ $POST_TYPE = "Audio" ]] then - echo "" >> $FNAME + echo "" >> $FNAME fi if [[ $POST_TYPE = "Video" ]] then - echo "" >> $FNAME + echo "" >> $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 "" >> $FNAME + fi + + if [[ $POST_TYPE = "Video" ]] + then + echo "" >> $FNAME fi fi From cb681121e42572f312edc463d6b9e9e98087026d Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Wed, 17 Nov 2010 17:09:16 -0600 Subject: [PATCH 06/12] Added custom PS3 (prompt used with "select", for instance with the new, newpost comman) for minimal theme --- themes/minimal/minimal.theme.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/themes/minimal/minimal.theme.bash b/themes/minimal/minimal.theme.bash index e70165d2..2f9b926e 100644 --- a/themes/minimal/minimal.theme.bash +++ b/themes/minimal/minimal.theme.bash @@ -7,3 +7,5 @@ prompt_setter() { } PROMPT_COMMAND=prompt_setter + +export PS3=">> " From 4350c3f13fbe2f615012d1e9bf147d578d77c31f Mon Sep 17 00:00:00 2001 From: Fedyashev Nikita Date: Thu, 18 Nov 2010 23:42:30 -0500 Subject: [PATCH 07/12] Vagrant autocompletion: base working version --- plugins/vagrant.plugins.bash | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 plugins/vagrant.plugins.bash diff --git a/plugins/vagrant.plugins.bash b/plugins/vagrant.plugins.bash new file mode 100644 index 00000000..3d05f7ec --- /dev/null +++ b/plugins/vagrant.plugins.bash @@ -0,0 +1,34 @@ +#!/bin/bash +_vagrant() +{ + local cur prev commands + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + # The commands we will complete + commands="box destroy halt help init package provision reload resume ssh ssh_config status suspend up version" + + case "${prev}" in + "remove"|"repackage") + #local vagrantlist=$(gem list -l|grep '([0-9].*)'|awk 'BEGIN {ORS=" "} { print $1}'|sort) + #local vagrantlist=$(command ls --color=none -l $HOME/.vagrant/boxes 2>/dev/null | sed -e 's/ /\\ /g' | awk 'BEGIN {ORS=" "} {print $2}' ) + local vagrantlist=$(find $HOME/.vagrant/boxes/* -maxdepth 0 -type d -printf '%f ') + COMPREPLY=($(compgen -W "${vagrantlist}" -- ${cur})) + return 0 + ;; + "box") + commands="add help list remove repackage" + COMPREPLY=($(compgen -W "${commands}" -- ${cur})) + return 0 + ;; + *) + ;; + esac + + COMPREPLY=($(compgen -W "${commands}" -- ${cur})) + return 0 +} +complete -F _vagrant vagrant +complete -F _vagrant vagrant-e + From 5f6125e480267a2bcd52827f4430b7cec2ab35df Mon Sep 17 00:00:00 2001 From: Fedyashev Nikita Date: Fri, 19 Nov 2010 00:22:13 -0500 Subject: [PATCH 08/12] refactored version; valid workflow --- plugins/vagrant.plugins.bash | 56 +++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/plugins/vagrant.plugins.bash b/plugins/vagrant.plugins.bash index 3d05f7ec..27b3761f 100644 --- a/plugins/vagrant.plugins.bash +++ b/plugins/vagrant.plugins.bash @@ -1,34 +1,44 @@ #!/bin/bash _vagrant() { - local cur prev commands - COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" - # The commands we will complete - commands="box destroy halt help init package provision reload resume ssh ssh_config status suspend up version" - case "${prev}" in - "remove"|"repackage") - #local vagrantlist=$(gem list -l|grep '([0-9].*)'|awk 'BEGIN {ORS=" "} { print $1}'|sort) - #local vagrantlist=$(command ls --color=none -l $HOME/.vagrant/boxes 2>/dev/null | sed -e 's/ /\\ /g' | awk 'BEGIN {ORS=" "} {print $2}' ) - local vagrantlist=$(find $HOME/.vagrant/boxes/* -maxdepth 0 -type d -printf '%f ') - COMPREPLY=($(compgen -W "${vagrantlist}" -- ${cur})) - return 0 - ;; - "box") - commands="add help list remove repackage" - COMPREPLY=($(compgen -W "${commands}" -- ${cur})) - return 0 - ;; - *) - ;; - esac + if [ $COMP_CWORD == 1 ] + then + commands="box destroy halt help init package provision reload resume ssh ssh_config status suspend up version" + COMPREPLY=($(compgen -W "${commands}" -- ${cur})) + return 0 + fi + + if [ $COMP_CWORD == 2 ] + then + if [ $prev == 'box' ] + then + commands="add help list remove repackage" + COMPREPLY=($(compgen -W "${commands}" -- ${cur})) + return 0 + fi + fi + + if [ $COMP_CWORD == 3 ] + then + action="${COMP_WORDS[COMP_CWORD-2]}" + if [ $action == 'box' ] + then + case "$prev" in + "remove"|"repackage") + local vagrantlist=$(find $HOME/.vagrant/boxes/* -maxdepth 0 -type d -printf '%f ') + COMPREPLY=($(compgen -W "${vagrantlist}" -- ${cur})) + return 0 + ;; + *) + ;; + esac + fi + fi - COMPREPLY=($(compgen -W "${commands}" -- ${cur})) - return 0 } complete -F _vagrant vagrant -complete -F _vagrant vagrant-e From 7f721fe5e7bc9d845d177beb044c096d95b155b8 Mon Sep 17 00:00:00 2001 From: Fedyashev Nikita Date: Fri, 19 Nov 2010 00:27:14 -0500 Subject: [PATCH 09/12] completion to help command added --- plugins/vagrant.plugins.bash | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/plugins/vagrant.plugins.bash b/plugins/vagrant.plugins.bash index 27b3761f..17aff4ea 100644 --- a/plugins/vagrant.plugins.bash +++ b/plugins/vagrant.plugins.bash @@ -3,23 +3,29 @@ _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 - commands="box destroy halt help init package provision reload resume ssh ssh_config status suspend up version" COMPREPLY=($(compgen -W "${commands}" -- ${cur})) return 0 fi if [ $COMP_CWORD == 2 ] then - if [ $prev == 'box' ] - then - commands="add help list remove repackage" - COMPREPLY=($(compgen -W "${commands}" -- ${cur})) - return 0 - fi + 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 ] @@ -29,8 +35,8 @@ _vagrant() then case "$prev" in "remove"|"repackage") - local vagrantlist=$(find $HOME/.vagrant/boxes/* -maxdepth 0 -type d -printf '%f ') - COMPREPLY=($(compgen -W "${vagrantlist}" -- ${cur})) + local box_list=$(find $HOME/.vagrant/boxes/* -maxdepth 0 -type d -printf '%f ') + COMPREPLY=($(compgen -W "${box_list}" -- ${cur})) return 0 ;; *) From 62295973ca3bce1990a859b1f085b62cf9fd4d55 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sat, 20 Nov 2010 16:27:47 -0600 Subject: [PATCH 10/12] Added quiet function to run command in background. --- plugins/base.plugin.bash | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/base.plugin.bash b/plugins/base.plugin.bash index 9eceaf94..9c8cb922 100644 --- a/plugins/base.plugin.bash +++ b/plugins/base.plugin.bash @@ -30,6 +30,10 @@ pri() { ri -T "${1}" | open -f -a $PREVIEW } +quiet() { + $* &> /dev/null & +} + banish-cookies() { rm -r ~/.macromedia ~/.adobe ln -s /dev/null ~/.adobe From 8c6197717a9ed9e318951bcae37cfe522491c3db Mon Sep 17 00:00:00 2001 From: Florian Baumann Date: Mon, 22 Nov 2010 11:44:28 +0100 Subject: [PATCH 11/12] fixed debian dirty prompt bug --- themes/base.theme.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 9ae5d0e8..e77d1d23 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -50,7 +50,7 @@ function prompt_char { } 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} else state=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} @@ -81,4 +81,4 @@ function rvm_version_prompt { rvm=$(rvm tools identifier) || return echo -e "$RVM_THEME_PROMPT_PREFIX$rvm$RVM_THEME_PROMPT_SUFFIX" fi -} \ No newline at end of file +} From aaa107161bd7dd12517c30aa3f59b07878090e7f Mon Sep 17 00:00:00 2001 From: Florian Baumann Date: Mon, 22 Nov 2010 13:07:08 +0100 Subject: [PATCH 12/12] added git_info function to git plugin --- plugins/git.plugins.bash | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/plugins/git.plugins.bash b/plugins/git.plugins.bash index ad21591d..5f4cc51e 100644 --- a/plugins/git.plugins.bash +++ b/plugins/git.plugins.bash @@ -17,4 +17,40 @@ function git_remove_missing_files() { # Adds files to git's exclude file (same as .gitignore) function local-ignore() { echo "$1" >> .git/info/exclude -} \ No newline at end of file +} + +# 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 +} +