Skip to content

Instantly share code, notes, and snippets.

@jemmons
Last active November 5, 2017 21:41
Show Gist options
  • Save jemmons/de2530790c80c32b94f98eeb8124867b to your computer and use it in GitHub Desktop.
Save jemmons/de2530790c80c32b94f98eeb8124867b to your computer and use it in GitHub Desktop.
Dot Files
;; PATH FOR LEININGEN
(add-to-list 'exec-path "/usr/local/bin")
;; FONTS
(add-to-list 'default-frame-alist
'(font . "Source Code Pro-18"))
;; PACKAGE STUFF
(require 'package)
(add-to-list 'package-archives
'("MELPA" . "https://melpa.org/packages/") t)
(package-initialize)
(unless package-archive-contents
(package-refresh-contents))
(unless (package-installed-p 'use-package)
(package-install 'use-package))
(require 'use-package)
(use-package rainbow-delimiters
:ensure t)
(use-package clojure-mode
:ensure t
:config
(add-hook 'clojure-mode-hook #'paredit-mode)
(add-hook 'clojure-mode-hook #'rainbow-delimiters-mode))
(use-package cider
:ensure t
:config
(add-hook 'cider-repl-mode-hook #'paredit-mode)
(add-hook 'cider-repl-mode-hook #'rainbow-delimiters-mode))
(use-package color-theme-sanityinc-solarized
:ensure t
:commands color-theme-sanityinc-solarized-dark
:if (display-graphic-p)
:init
(progn
(setq custom-enabled-themes 'sanityinc-solarized-dark)
(setq custom-safe-themes '("4aee8551b53a43a883cb0b7f3255d6859d766b6c5e14bcb01bed572fcbef4328"))))
;; DISPLAY STUFF
(load-theme 'sanityinc-solarized-dark)
(when (fboundp 'tool-bar-mode)
(tool-bar-mode -1))
(blink-cursor-mode -1)
(global-hl-line-mode +1)
(setq inhibit-startup-screen t)
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
# Path for rbenv and brew:
export PATH=$HOME/.rbenv/bin:/usr/local/bin:$HOME/bin:$PATH
# autocompletion for rbenv...
eval "$(rbenv init -)"
# and homebrew...
source /usr/local/Homebrew/completions/bash/brew
# and leiningen...
#source /usr/local/etc/bash_completion.d/lein-completion.bash
# and git...
source /usr/local/etc/bash_completion.d/git-completion.bash
# Open Xcode from command line:
alias xc='open "$(find . -name "*.xcodeproj" -not -path "./Carthage/*" -print -quit)"'
# quick git aliases...
alias av='git branch -av'
alias gs='git status'
alias gc='git checkout'
# make bash completion aware of git aliases...
__git_complete gc _git_checkout
# pwdf: echoes path of front-most window of Finder
pwdf ()
{
currFolderPath=$( /usr/bin/osascript <<" EOT"
tell application "Finder"
try
set currFolder to (folder of the front window as alias)
on error
set currFolder to (path to desktop folder as alias)
end try
POSIX path of currFolder
end tell
EOT
)
echo "$currFolderPath"
}
alias cdf='cd "`pwdf`"'
# TextMate is the editor of choice...
export EDITOR="~/bin/mate -w"
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"
function parse_git_branch {
git_dir=$(git rev-parse --git-dir 2> /dev/null)
if [ $git_dir ]; then
git_status="$(git status 2> /dev/null)"
branch_pattern="^On branch ([^${IFS}]*)"
ahead_pattern="Your branch is ahead "
behind_pattern="Your branch is behind"
diverge_pattern="Your branch and (.*) have diverged"
if [[ ! ${git_status}} =~ "working tree clean" ]]; then
state="${YELLOW}⚡"
fi
# add an else if or two here if you want to get more specific
if [[ ${git_status} =~ ${ahead_pattern} ]]; then
remote="${YELLOW}↑"
fi
if [[ ${git_status} =~ ${behind_pattern} ]]; then
remote="${YELLOW}↓"
fi
if [[ ${git_status} =~ ${diverge_pattern} ]]; then
remote="${YELLOW}↕"
fi
if [[ ${git_status} =~ ${branch_pattern} ]]; then
branch=${BASH_REMATCH[1]}
echo " ${GREEN}${branch}${remote}${state}"
fi
fi
}
function prompt_func() {
previous_return_value=$?;
prompt="${WHITE}[${COLOR_NONE}\w$(parse_git_branch)${WHITE}]${COLOR_NONE}"
if test $previous_return_value -eq 0
then
PS1="${prompt}➔ "
else
PS1="${prompt}${RED}➔${COLOR_NONE} "
fi
}
PROMPT_COMMAND=prompt_func
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment