Last active
February 23, 2021 02:38
-
-
Save jemmons/53970 to your computer and use it in GitHub Desktop.
Configuration dotfiles for various command line tools.
This file contains hidden or 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
# Configuration dotfiles for various command line tools. |
This file contains hidden or 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
;; 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) |
This file contains hidden or 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
# 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 | |
# and swiftpm... | |
eval "`swift package completion-tool generate-bash-script`" | |
# 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 |
This file contains hidden or 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
# --HOMEBREW-- | |
# Path and stuff... | |
eval $(/opt/homebrew/bin/brew shellenv) | |
# Add Homebrew completions (and completions for homebrew-installed projects, if linked) an ENV where zsh can find them. | |
if type brew &>/dev/null; then | |
fpath=($(brew --prefix)/share/zsh/site-functions $fpath) | |
fi | |
# --SWIFT-- | |
swift package completion-tool generate-zsh-script > ~/.zsh/_swift | |
# Open Xcode from command line (using first `xcodeproj` found): | |
alias xc='open "$(find . -name "*.xcodeproj" -not -path "./Carthage/*" -not -path "./.build/*" -print -quit)"' | |
# --GIT-- | |
# quick git aliases... | |
alias av='git branch -av' | |
alias gs='git status' | |
alias gc='git checkout' | |
# --FINDER-- | |
# pwdf: echos path of front-most Finder window | |
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`"' | |
# --ENVIRONMENT-- | |
# in theory, this could all live in .zshenv... | |
# Set editor to Nova | |
export EDITOR="/usr/local/bin/nova --wait" | |
# Git prompt support | |
autoload -Uz vcs_info | |
precmd_vcs_info() { vcs_info } | |
precmd_functions+=( precmd_vcs_info ) | |
setopt prompt_subst | |
zstyle ':vcs_info:git:*' formats '%m' | |
zstyle ':vcs_info:*' enable git | |
zstyle ':vcs_info:git*+set-message:*' hooks git-st | |
# Hook for displaying branch, dirty, and ahead/behind info in the "misc" field of vcs_info | |
function +vi-git-st() { | |
local -a gitstatus=(" ") | |
local gs="$(git status 2>/dev/null)" | |
if [[ -n "$gs" ]]; then | |
local -a arr | |
arr=(${(f)gs}) | |
if [[ ! $gs =~ 'nothing to commit' ]]; then | |
gitstatus+=(%F{yellow}%B$hook_com[branch]%b%f) | |
else | |
gitstatus+=(%F{green}%B$hook_com[branch]%b%f) | |
fi | |
if [[ $arr[2] =~ 'Your branch is' ]]; then | |
if [[ $arr[2] =~ 'ahead' ]]; then | |
gitstatus+=(%F{green}↑%f) | |
elif [[ $arr[2] =~ 'behind' ]]; then | |
gitstatus+=(%F{green}↓%f) | |
elif [[ $arr[2] =~ 'diverged' ]]; then | |
gitstatus+=(%F{green}↕%f) | |
fi | |
fi | |
fi | |
hook_com[misc]=${(j::)gitstatus} | |
} | |
# Standard prompt stuff | |
ps_path='%F{white}%2~%f' | |
ps_superuser_success='%B%(!.#.%(?.%F{white}.%F{red})>%f)%b' | |
# The prompt itself: | |
PS1='[${ps_path}${vcs_info_msg_0_}]${ps_superuser_success} ' | |
# --BUILTINS-- | |
# include the user's home in the function searchpath. | |
fpath+=(~/.zsh $fpath) | |
# Turn on autocompletions | |
autoload -Uz compinit | |
compinit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment