Skip to content

Commit

Permalink
Fresh fish
Browse files Browse the repository at this point in the history
The fish shell requires less configuration and fiddling than zsh, so
let's give it a try, POSIX-be-damned.

Signed-off-by: Stephen Celis <stephen@stephencelis.com>
  • Loading branch information
stephencelis committed Apr 6, 2015
0 parents commit 9783dcb
Show file tree
Hide file tree
Showing 21 changed files with 439 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
config/fish/fishd.*
config/fish/fish_history
config/fish/fish_read_history
config/fish/generated_completions

config/hub

vim/.netrwhist
vim/plugged
vim/tmp/*
!vim/tmp/.gitkeep
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "vim-plug"]
path = vim-plug
url = https://github.com/junegunn/vim-plug
88 changes: 88 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
symlinks = \
config \
gitconfig \
gitignore \
lldbinit \
local \
ruby-version \
vim \
vimrc \

formulas = \
chisel \
elasticsearch \
elixir \
fish \
fry \
ghc \
go \
hub \
lua \
mercurial \
mysql \
node \
postgres \
redis \
ruby-install \
rust \
the_silver_searcher \
tree \

update: install
brew update
brew upgrade
brew cleanup

install: brew ln ruby

# brew

homebrew_root = /usr/local
cellar = $(homebrew_root)/Cellar
taps = $(homebrew_root)/Library/Taps
ruby_version := $(shell cat $(PWD)/ruby-version)

prefixed_formulas = $(addprefix $(cellar)/,$(formulas))
brew: $(prefixed_formulas) $(macvim)

homebrew = $(homebrew_root)/bin/brew
$(homebrew):
@ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

$(prefixed_formulas): $(homebrew)
brew install $(notdir $@)
@touch $@

macvim = $(cellar)/macvim
$(macvim): $(homebrew)
brew install macvim \
--override-system-vim \
--with-lua \
@touch $(macvim)

homebrew_fry = $(taps)/igas/homebrew-fry
$(homebrew_fry):
brew tap igas/fry
@touch $(homebrew_fry)

$(cellar)/fry: $(homebrew_fry)

# ln

prefixed_symlinks = $(addprefix $(HOME)/.,$(symlinks))
ln: $(prefixed_symlinks)

$(prefixed_symlinks):
@ln -Fsv $(PWD)/$(patsubst .%,%,$(notdir $@)) $@

# ruby

ruby = $(HOME)/.rubies/ruby-$(ruby_version)
ruby: $(ruby)

$(ruby): $(HOME)/.ruby-version $(cellar)/ruby-install
ruby-install ruby $(ruby_version)

# make

.PHONY: update
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# dotfiles

I `make` do.

- Provides configuration for [the friendly interactive shell][fish].
- Installs [Homebrew][brew] and various formulas.
- Installs [vim-plug][] to manage Vim.
- Symlinks dotfiles and dotdirectories.
- Keeps the above up-to-date.


[fish]: http://fishshell.com
[brew]: http://brew.sh
[vim-plug]: https://github.com/junegunn/vim-plug
17 changes: 17 additions & 0 deletions config/fish/completions/d.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function __d_complete_directory
set -g dev_dir $DEVELOPER
set dev_dirs (echo (commandline) | tr ' ' \n)
set -e dev_dirs[1]

for dir in $dev_dirs
set -g dev_dir "$dev_dir/$dir"
end

if test -d $dev_dir
command ls -d $dev_dir/*/ | xargs -n1 basename
else
command ls -d $dev_dir*/ | xargs -n1 basename
end
end

complete -xc d -a "(__d_complete_directory)"
20 changes: 20 additions & 0 deletions config/fish/config.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# we're already acquainted, thanks
set -e fish_greeting

# universal
set -x PATH $HOME/.local/bin $PATH
set -x EDITOR vim
set -x VISUAL $EDITOR

set -x __fish_git_prompt_show_informative_status 1

# local
set -x DEVELOPER ~/Developer

# aliases
alias ag 'ag --smart-case'

# ruby
if test -f /usr/local/share/fry/fry.fish
source /usr/local/share/fry/fry.fish
end
6 changes: 6 additions & 0 deletions config/fish/functions/d.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function d --description 'Like z, but d'
cd $DEVELOPER
for dir in $argv
cd $dir*/
end
end
24 changes: 24 additions & 0 deletions config/fish/functions/fish_prompt.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function fish_prompt --description 'Write out the prompt'

set -l last_status $status

if not set -q __fish_prompt_normal
set -g __fish_prompt_normal (set_color normal)
end

# PWD
set_color $fish_color_cwd
echo -n (prompt_pwd)
set_color normal

printf '%s ' (__fish_git_prompt ' %s')

if not test $last_status -eq 0
set_color $fish_color_error
end

echo -n '$ '

set_color normal

end
8 changes: 8 additions & 0 deletions config/fish/functions/fish_right_prompt.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function fish_right_prompt --description 'Write out the right-hand prompt'
if contains fry (functions)
set -l color (set_color 111)
set -l normal (set_color normal)

echo $color(fry current)$normal
end
end
3 changes: 3 additions & 0 deletions config/fish/functions/fish_title.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function fish_title --description 'Write out a proper window title'
printf '\a\e]7;file:///%s' (echo -n $PWD | sed 's/ /%20/g')
end
11 changes: 11 additions & 0 deletions config/fish/functions/xcopen.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function xcopen --description 'Open the nearest Xcode workspace or project'
pushd *.{xcworkspace,xcodeproj}
and open .
and popd
or \
if test $PWD != /
pushd ..
xcopen
popd
end
end
45 changes: 45 additions & 0 deletions gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[user]
name = Stephen Celis
email = stephen@stephencelis.com
[alias]
br = branch
ci = commit -s -v
co = checkout
di = diff
st = status -s
[branch]
autosetuprebase = always
[color]
ui = auto
[core]
excludesfile = ~/.gitignore
[credential]
helper = osxkeychain
[diff]
renames = copies
[log]
decorate = auto
[merge]
conflictstyle = diff3
tool = vimdiff
[pager]
blame = less -S
diff = /usr/local/share/git-core/contrib/diff-highlight/diff-highlight | less
log = /usr/local/share/git-core/contrib/diff-highlight/diff-highlight | less
show = /usr/local/share/git-core/contrib/diff-highlight/diff-highlight | less
[push]
default = current
[pull]
rebase = true
[rebase]
autosquash = true
autostash = true
[rerere]
autoupdate = true
enabled = true
[github]
user = stephencelis
[filter "hawser"]
clean = git hawser clean %f
required = true
smudge = git hawser smudge %f
7 changes: 7 additions & 0 deletions gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*~
*.bak
*.log
*.pid
*.swp
.DS_Store
tmp/**/*
1 change: 1 addition & 0 deletions lldbinit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
command script import /usr/local/opt/chisel/libexec/fblldb.py
28 changes: 28 additions & 0 deletions local/bin/git-l
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh
#
# Original by Gary Bernhardt:
#
# https://raw.github.com/garybernhardt/dotfiles/master/.githelpers
#
# Log output:
#
# 51c333e 2012-07-12 Gary Bernhardt add vim-eunuch
#
# The log format uses } characters between each field, and `column` is later
# used to split on them. A } in the commit subject or any other field will
# break this.

HASH="%C(yellow)%h%Creset"
DATE="%C(green)%ad%Creset"
AUTHOR="%C(bold blue)%an%Creset"
REFS="%C(red)%d%Creset"
SUBJECT="%s"

FORMAT="$HASH}$DATE}$AUTHOR}$REFS $SUBJECT"

git log --pretty="tformat:${FORMAT}" --date=short $* |
# Line columns up based on } delimiter
column -s '}' -t |
# Page only if we need to
less -FXRS

18 changes: 18 additions & 0 deletions local/bin/git-prune-merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

prune_merged_local() {
git branch --list --merged |
grep --invert-match --extended-regexp '\*|master' |
xargs -n 1 git branch --delete
}

prune_merged_remotes() {
git fetch origin
git remote prune origin
git branch --list --remote --merged $1 |
grep --invert-match --extended-regexp "HEAD|master|$1" |
sed 's/ *origin\///' |
xargs -p -I branch git push origin :branch
}

test -n "$1" && prune_merged_remotes $@ || prune_merged_local
1 change: 1 addition & 0 deletions ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.2.1
1 change: 1 addition & 0 deletions vim-plug
Submodule vim-plug added at 650927
1 change: 1 addition & 0 deletions vim/autoload/plug.vim
Empty file added vim/tmp/.gitkeep
Empty file.
Loading

0 comments on commit 9783dcb

Please sign in to comment.