This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# [ ~/develop/dir ] master $ # clean working directory | |
# [ ~/develop/dir ] master* $ # dirty working directory | |
# [ ~/some_dir ] $ # not a git repo | |
source ~/bin/.git-completion.sh # Copied the contrib/completion/git-completion.bash file in the git distribution | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
PS1='\e[0m[ \e[32m\w\e[0m ]$(__git_ps1 " \e[33m%s\e[31m$(parse_git_dirty)\e[0m") $ ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source ~/bin/.git-completion.sh # Copied from the contrib/completion/git-completion.bash file in the git distribution (Also here: http://gist.github.com/91932) | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo '*' | |
} | |
PS1='\[\e[0m\][ \[\e[32m\]\w \[\e[0m\]]$(__git_ps1 " \[\e[33m\]%s$(parse_git_dirty)") \[\e[0m\]$ \[\e[0m\]' | |
alias bash_profile='vi ~/.bash_profile && source ~/.bash_profile' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bash snippet to open new shells in most recently visited dir. | |
# Useful if you want to open a new terminal tab at the present | |
# tab's location. | |
# | |
# Put this in your .bashrc or whatever. | |
pathed_cd () { | |
if [ "$1" == "" ]; then | |
cd | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Print out what changed in a nice format. | |
git log @{1}.. --pretty=format:"%Cblue%an%Creset %ar: %Cred\"%s%b\"%Creset (%h)" --reverse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Learned about this feature in the rails.vim plugin: | |
:R/:A jump to next/previous timestamped migration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In visual mode, press o to move the cursor to the other end of the selected region. | |
This allows you to easily adjust the selected region from either side. | |
Pressing O while in visual block mode moves the cursor to the other corner. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Webrat | |
module SaveAndOpenPage | |
def save_and_open_page | |
return unless File.exist?(Webrat.configuration.saved_pages_dir) | |
filename = "#{Webrat.configuration.saved_pages_dir}/webrat-#{Time.now.to_i}.html" | |
File.open(filename, "w") do |f| | |
f.write prettified(response_body) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias gl='git log -n1000 --no-merges --pretty=format:"* %s (%cn) %b"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:.Rake | |
When you're in a controller. This will do a | |
routes CONTROLLER=... | |
so you can see the routes specific to that controller. Brilliant! | |
This ability comes from the Rails.vim plugin. | |
I've got this in my .vimrc: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
^x^l In insert mode, complete a line | |
When there's more than one choice use the following to easily select the right one: | |
^n Get next choice | |
^p Get previous choice |
OlderNewer