Skip to content

Instantly share code, notes, and snippets.

@robey
Last active August 29, 2015 14:01
Show Gist options
  • Save robey/3bf25726317e67abaf01 to your computer and use it in GitHub Desktop.
Save robey/3bf25726317e67abaf01 to your computer and use it in GitHub Desktop.
my basic fish config
#
# fish config file
#
function fish_greeting
echo (set_color 0b0)f(set_color 0b2)i(set_color 0a4)s(set_color 0a8)h(set_color 0aa) \>(set_color 08c)\<(set_color 09f)\>(set_color normal)
end
function fish_title
echo (basename $PWD)/
end
# path
set -x PATH /usr/bin /bin /usr/sbin /sbin /usr/local/bin
for path in /usr/local/sbin /usr/local/git/bin $HOME/bin $HOME/scripts
if [ -x $path ]
set -x PATH $path $PATH
end
end
# random env vars
ulimit -n 8192
set -x LESS "-M"
set -x LANG "en_US.UTF-8"
set -x GIT_PAGER "less -R"
alias ls 'ls -Fh'
alias df 'df -h'
alias wget 'curl -O'
alias reset 'tset'
# prompt
function assign_colors
set -g color_cwd (set_color "070")
set -g color_off (set_color normal)
set -g color_login (set_color "dd0")
set -g color_prompt (set_color "06f")
end
function fish_prompt --description 'Write out the prompt'
# Just calculate these once, to save a few cycles when displaying the prompt
if not set -q color_off
assign_colors
end
if not set -q __fish_prompt_hostname
set -g __fish_prompt_hostname (hostname | cut -d . -f 1)
end
set -l pwd (echo $PWD | sed -e "s|^$HOME|~|")
echo -n -s $color_login $USER @ $__fish_prompt_hostname $color_off
echo -n -s $color_prompt :
echo -n -s $color_cwd $pwd $color_off (git_prompt)
echo -n -s $color_prompt " "\u276f" " $color_off
end
function tableflip
echo -s (set_color "ff3") "(╯" (set_color "f55") " °□°" (set_color "ff3") ")╯" (set_color "555") " ︵" (set_color "550") " ┻━┻" (set_color normal)
end
# ----- git_prompt.fish:
# git helpers
alias pull 'git checkout master; and git pull --prune'
alias update 'pull; git checkout $argv; git merge --no-ff master'
# prompt
function git_colors
set -g color_git_branch (set_color "050")
set -g color_git_ahead (set_color "b2b")
set -g color_git_dirty (set_color "b22")
set -g color_git_off (set_color normal)
end
function git_count_dirty
math (git diff $argv --name-status | awk '{ print $1 }' | grep -v U | wc -l) + 0
end
function git_count_ahead
math (git rev-list --left-right $argv[1]...HEAD ^/dev/null | grep -E "^>" | wc -l) + 0
end
function git_branch
if git rev-parse --git-dir >/dev/null ^/dev/null
git symbolic-ref HEAD ^/dev/null | awk -F/ '{ print $3 }'
else
echo ""
end
end
function git_prompt
if not set -q color_git_off
git_colors
end
set name (git_branch)
if [ ! -z $name ]
echo -n -s $color_git_branch " (" $name
set count (git_count_ahead origin/$name)
if [ $count -gt 0 ]
echo -n -s $color_git_ahead " ↑" $count $color_git_branch
end
set count (git_count_dirty)
if [ $count -gt 0 ]
echo -n -s $color_git_dirty " +" $count $color_git_branch
else
set count (git_count_dirty --staged)
if [ $count -gt 0 ]
echo -n -s $color_git_dirty " ●" $count $color_git_branch
end
end
echo -n -s ")" $color_git_off
else
echo ""
end
end
@mrjoelkemp
Copy link

# Prints the release notes between two given tags
# Assumes you have a remote called upstream
function notes
  git fetch upstream; and git log $argv[1]'..'$argv[2] --merges --pretty=%s%n%b%n
end

Use like:

notes 2.27.26 2.27.27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment