big tweaks over the last few months

osx
Adam Veldhousen 8 years ago
parent 4048cea85f
commit 21295368d4
Signed by: adam
GPG Key ID: 6DB29003C6DD1E4B

@ -3,7 +3,6 @@
alias cdp="cd -"
alias ..='cd ..'
alias pd="pushd $1"
alias fuck='$(thefuck $(fc -ln -1))'
# list files
alias ll='ls -hGla'
@ -13,7 +12,6 @@ alias bake='bundle exec rake'
alias clear="clear && printmotd"
#tools
alias s='start Source/*.sln'
alias resrc='source ~/.bash_aliases && source ~/.bashrc && source ~/.profile'
alias role='whoami -groups -fo list | grep -i'
alias fu='find ./ -type f -print0 | xargs -0 grep -n $1'
@ -21,20 +19,19 @@ alias fu='find ./ -type f -print0 | xargs -0 grep -n $1'
#git
alias gs='git status'
alias diff='git difftool'
alias diffc='git difftool --cached'
alias gm='git merge --ff-only'
alias gpr='git pull --rebase'
alias gmt='git mergetool'
alias grc='git rebase --continue'
alias gk='git fetch origin; git remote prune origin; gitk --all &'
alias gl='git log --pretty=format:"%h %ar by %an: %s"'
# Get week number
alias week='date +%V'
# Stopwatch
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'
alias airport='/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport'
# Get OS X Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages
alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup; npm install npm -g; npm update -g; sudo gem update --system; sudo gem update'
@ -54,7 +51,6 @@ alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && kil
# Recursively delete `.DS_Store` files
alias cleanup="find . -type f -name '*.DS_Store' -ls -delete"
# Hide/show all desktop icons (useful when presenting)
alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder"
alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder"
@ -69,4 +65,5 @@ alias pumpitup="osascript -e 'set volume 7'"
# Lock the screen (when going AFK)
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
alias mongodps="mongod --config /usr/local/etc/mongod.conf --fork --logpath ~/.docs/mongo.log"
# go
alias sgobuild="CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'"

@ -3,27 +3,25 @@
IFS=$'\n$\t'
# delete merged local branches
function prunelocal(){
for b in `git branch --merged | grep -v \*`; do git branch -D $b; done
# This function checks whether we have a given program on the system.
#
have()
{
# Completions for system administrator commands are installed as well in
# case completion is attempted via `sudo command ...'.
PATH=$PATH:/usr/sbin:/sbin:/usr/local/sbin type $1 &>/dev/null
}
# prints message of the day and a fortune
function printmotd(){
if [[ $WORK ]]; then
cat ~/work_motd
else
cat ~/motd
fi
if [[ -f $GOPATH/bin/fortune ]]; then
echo ""
$GOPATH/bin/fortune -file="$GOPATH/bin/fortunes.txt"
elif [[ -f $(which fortune 2>/dev/null) ]]; then
echo ""
fortune
fi
echo ""
# `a` with no arguments opens the current directory in Atom Editor, otherwise
# opens the given location
function a() {
if [ $# -eq 0 ]; then
atom .;
else
atom "$@";
fi;
}
# prints battery percentage, only works on OSX
@ -31,6 +29,29 @@ function batteryPercent(){
ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%d", $10/$5 * 100)}'
}
# Simple calculator
function calc() {
local result="";
result="$(printf "scale=10;$*\n" | bc --mathlib | tr -d '\\\n')";
# └─ default (when `--mathlib` is used) is 20
#
if [[ "$result" == *.* ]]; then
# improve the output for decimal numbers
printf "$result" |
sed -e 's/^\./0./' # add "0" for cases like ".5"` \
-e 's/^-\./-0./' # add "0" for cases like "-.5"`\
-e 's/0*$//;s/\.$//'; # remove trailing zeros
else
printf "$result";
fi;
printf "\n";
}
# Change working directory to the top-most Finder window location
function cdf() { # short for `cdfinder`
cd "$(osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)')";
}
# a shortcut for cloning from github
# usage: clone user/repo <dir>
function clone() {
@ -50,58 +71,35 @@ function clone() {
fi
}
# runs tcp dump on the port specified in $1. $1 defaults to 8080
function dumptcp(){
local DUMPPORT=$1
local DUMPINTERFACE=$2
if [ -z "$1" ]; then
DUMPPORT=8080
elif [[ "$1" == "help" ]]; then
echo "dumps tcp info at the specified port. Useful for looking at http requests"
echo "usage dumptcp <port>"
return 1
fi
if [ -z "$2" ]; then
DUMPINTERFACE=lo0
fi
echo "dumping tcp connections @ $DUMPINTERFACE on port $DUMPPORT..."
sudo tcpdump -s 0 -A -i $DUMPINTERFACE "tcp port $DUMPPORT and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)"
}
function gocd(){
if [ -z "$1" ]; then
cd $GOPATH;
return 0;
fi
cd $(go list -f '{{ .Dir }}' $1)
# Get a characters Unicode code point
function codepoint() {
perl -e "use utf8; print sprintf('U+%04X', ord(\"$@\"))";
# print a newline unless were piping the output to another program
if [ -t 1 ]; then
echo ""; # newline
fi;
}
function interfaces(){
ifconfig | grep "\: flags" | awk '{print $1}' | sed 's/:$//';
# Create a data URL from a file
function dataurl() {
local mimeType=$(file -b --mime-type "$1");
if [[ $mimeType == text/* ]]; then
mimeType="${mimeType};charset=utf-8";
fi
echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')";
}
# kill the process using the specified port
function freeport(){
if [ -z $1 ]; then
echo "usage: freeport <port number>" >&2
return 1
fi
lsof -t -i tcp:$1 | xargs kill
}
# simplifies using docker-compose
function dcm(){
docker-compose $@
}
# Run `dig` and display the most useful info
function digga() {
dig +nocmd "$1" any +multiline +noall +answer;
}
# simplifies using docker-machine
function dm() {
local TARGET=$2
@ -177,24 +175,204 @@ function dm() {
esac
}
# runs tcp dump on the port specified in $1. $1 defaults to 8080
function dumptcp(){
local DUMPPORT=$1
local DUMPINTERFACE=$2
# `s` with no arguments opens the current directory in Sublime Text, otherwise
# opens the given location
function s() {
if [ $# -eq 0 ]; then
subl .;
if [ -z "$1" ]; then
DUMPPORT=8080
elif [[ "$1" == "help" ]]; then
echo "dumps tcp info at the specified port. Useful for looking at http requests"
echo "usage dumptcp <port>"
return 1
fi
if [ -z "$2" ]; then
DUMPINTERFACE=lo0
fi
echo "dumping tcp connections @ $DUMPINTERFACE on port $DUMPPORT..."
sudo tcpdump -s 0 -A -i $DUMPINTERFACE "tcp port $DUMPPORT and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)"
}
# Use Gits colored diff when available
hash git &>/dev/null;
if [ $? -eq 0 ]; then
function diff() {
git diff --color "$@" | diff-so-fancy;
}
function diff-file() {
if [[ -z $1 ]] || [[ -z $2 ]]; then
echo "diff-file diffs two files (don't have to be in a repo)"
echo "usage diff-file <file1> <file2>"
return -1
fi
git diff --no-index --color --color-words "$@" | diff-so-fancy;
}
fi;
# UTF-8-encode a string of Unicode symbols
function escape() {
printf "\\\x%s" $(printf "$@" | xxd -p -c1 -u);
# print a newline unless were piping the output to another program
if [ -t 1 ]; then
echo ""; # newline
fi;
}
# kill the process using the specified port
function freeport(){
if [ -z $1 ]; then
echo "usage: freeport <port number>" >&2
return 1
fi
lsof -t -i tcp:$1 | xargs kill
}
# Compare original and gzipped file size
function gz() {
local origsize=$(wc -c < "$1");
local gzipsize=$(gzip -c "$1" | wc -c);
local ratio=$(echo "$gzipsize * 100 / $origsize" | bc -l);
printf "orig: %d bytes\n" "$origsize";
printf "gzip: %d bytes (%2.2f%%)\n" "$gzipsize" "$ratio";
}
# Show all the names (CNs and SANs) listed in the SSL certificate
# for a given domain
function getcertnames() {
if [ -z "${1}" ]; then
echo "ERROR: No domain specified.";
return 1;
fi;
local domain="${1}";
echo "Testing ${domain}";
echo ""; # newline
local tmp=$(echo -e "GET / HTTP/1.0\nEOT" \
| openssl s_client -connect "${domain}:443" -servername "${domain}" 2>&1);
if [[ "${tmp}" = *"-----BEGIN CERTIFICATE-----"* ]]; then
local certText=$(echo "${tmp}" \
| openssl x509 -text -certopt "no_aux, no_header, no_issuer, no_pubkey, \
no_serial, no_sigdump, no_signame, no_validity, no_version");
echo "Common Name:";
echo ""; # newline
echo "${certText}" | grep "Subject:" | sed -e "s/^.*CN=//" | sed -e "s/\/emailAddress=.*//";
echo ""; # newline
echo "Subject Alternative Name(s):";
echo ""; # newline
echo "${certText}" | grep -A 1 "Subject Alternative Name:" \
| sed -e "2s/DNS://g" -e "s/ //g" | tr "," "\n" | tail -n +2;
return 0;
else
subl "$@";
echo "ERROR: Certificate not found.";
return 1;
fi;
}
# `a` with no arguments opens the current directory in Atom Editor, otherwise
# Create a git.io short URL
function gitio() {
if [ -z "${1}" -o -z "${2}" ]; then
echo "Usage: \`gitio slug url\`";
return 1;
fi;
curl -i http://git.io/ -F "url=${2}" -F "code=${1}";
}
function gocd(){
if [ -z "$1" ]; then
cd $GOPATH;
return 0;
fi
cd $(go list -f '{{ .Dir }}' $1)
}
function interfaces(){
ifconfig | grep "\: flags" | awk '{print $1}' | sed 's/:$//';
}
function inline_image {
printf '\033]1338;url='"$1"';alt='"$2"'\a\n'
}
# Syntax-highlight JSON strings or files
# Usage: `json '{"foo":42}'` or `echo '{"foo":42}' | json`
function json() {
if [ -t 0 ]; then # argument
python -mjson.tool <<< "$*" | pygmentize -l javascript;
else # pipe
python -mjson.tool | pygmentize -l javascript;
fi;
}
function pubkey(){
if [[ -z $1 ]]; then
echo "Takes a path to a private key and prints a compatible public key to stdout"
echo "$1 required: path to a private key"
return -1
fi
ssh-keygen -y -f $1
}
# delete merged local branches
function prunelocal(){
for b in `git branch --merged | grep -v \*`; do git branch -D $b; done
}
# prints message of the day and a fortune
function printmotd(){
if [[ $WORK ]]; then
cat ~/work_motd
else
cat ~/motd
fi
if [[ -f $GOPATH/bin/fortune ]]; then
echo ""
$GOPATH/bin/fortune -file="$GOPATH/bin/fortunes.txt"
elif [[ -f $(which fortune 2>/dev/null) ]]; then
echo ""
fortune
fi
echo ""
}
function tunnel(){
if [[ -z $1 ]]; then
echo "Takes an ssh config host name and starts an SSH tunnel"
echo "$1 required: name of an ssh tunnel host"
echo "$2 optional: run the tunnel as a background job if defined"
return -1
fi
if [[ -z $2 ]]; then
sudo ssh -f -N $1
else
sudo ssh -f -N $1 &
fi
}
# `s` with no arguments opens the current directory in Sublime Text, otherwise
# opens the given location
function a() {
function s() {
if [ $# -eq 0 ]; then
atom .;
subl .;
else
atom "$@";
subl "$@";
fi;
}
@ -236,33 +414,12 @@ function o() {
fi;
}
# Simple calculator
function calc() {
local result="";
result="$(printf "scale=10;$*\n" | bc --mathlib | tr -d '\\\n')";
# └─ default (when `--mathlib` is used) is 20
#
if [[ "$result" == *.* ]]; then
# improve the output for decimal numbers
printf "$result" |
sed -e 's/^\./0./' # add "0" for cases like ".5"` \
-e 's/^-\./-0./' # add "0" for cases like "-.5"`\
-e 's/0*$//;s/\.$//'; # remove trailing zeros
else
printf "$result";
fi;
printf "\n";
}
# Create a new directory and enter it
function mkd() {
mkdir -p "$@" && cd "$_";
}
# Change working directory to the top-most Finder window location
function cdf() { # short for `cdfinder`
cd "$(osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)')";
}
# Create a .tar.gz archive, using `zopfli`, `pigz` or `gzip` for compression
function targz() {
@ -306,32 +463,6 @@ function fs() {
fi;
}
# Use Gits colored diff when available
hash git &>/dev/null;
if [ $? -eq 0 ]; then
function diff() {
git diff --no-index --color-words "$@";
}
fi;
# Create a data URL from a file
function dataurl() {
local mimeType=$(file -b --mime-type "$1");
if [[ $mimeType == text/* ]]; then
mimeType="${mimeType};charset=utf-8";
fi
echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')";
}
# Create a git.io short URL
function gitio() {
if [ -z "${1}" -o -z "${2}" ]; then
echo "Usage: \`gitio slug url\`";
return 1;
fi;
curl -i http://git.io/ -F "url=${2}" -F "code=${1}";
}
# Start an HTTP server from a directory, optionally specifying the port
function server() {
local port="${1:-8000}";
@ -349,40 +480,6 @@ function phpserver() {
sleep 1 && open "http://${ip}:${port}/" &
php -S "${ip}:${port}";
}
# Compare original and gzipped file size
function gz() {
local origsize=$(wc -c < "$1");
local gzipsize=$(gzip -c "$1" | wc -c);
local ratio=$(echo "$gzipsize * 100 / $origsize" | bc -l);
printf "orig: %d bytes\n" "$origsize";
printf "gzip: %d bytes (%2.2f%%)\n" "$gzipsize" "$ratio";
}
# Syntax-highlight JSON strings or files
# Usage: `json '{"foo":42}'` or `echo '{"foo":42}' | json`
function json() {
if [ -t 0 ]; then # argument
python -mjson.tool <<< "$*" | pygmentize -l javascript;
else # pipe
python -mjson.tool | pygmentize -l javascript;
fi;
}
# Run `dig` and display the most useful info
function digga() {
dig +nocmd "$1" any +multiline +noall +answer;
}
# UTF-8-encode a string of Unicode symbols
function escape() {
printf "\\\x%s" $(printf "$@" | xxd -p -c1 -u);
# print a newline unless were piping the output to another program
if [ -t 1 ]; then
echo ""; # newline
fi;
}
# Decode \x{ABCD}-style Unicode escape sequences
function unidecode() {
perl -e "binmode(STDOUT, ':utf8'); print \"$@\"";
@ -392,48 +489,6 @@ function unidecode() {
fi;
}
# Get a characters Unicode code point
function codepoint() {
perl -e "use utf8; print sprintf('U+%04X', ord(\"$@\"))";
# print a newline unless were piping the output to another program
if [ -t 1 ]; then
echo ""; # newline
fi;
}
# Show all the names (CNs and SANs) listed in the SSL certificate
# for a given domain
function getcertnames() {
if [ -z "${1}" ]; then
echo "ERROR: No domain specified.";
return 1;
fi;
local domain="${1}";
echo "Testing ${domain}";
echo ""; # newline
local tmp=$(echo -e "GET / HTTP/1.0\nEOT" \
| openssl s_client -connect "${domain}:443" -servername "${domain}" 2>&1);
if [[ "${tmp}" = *"-----BEGIN CERTIFICATE-----"* ]]; then
local certText=$(echo "${tmp}" \
| openssl x509 -text -certopt "no_aux, no_header, no_issuer, no_pubkey, \
no_serial, no_sigdump, no_signame, no_validity, no_version");
echo "Common Name:";
echo ""; # newline
echo "${certText}" | grep "Subject:" | sed -e "s/^.*CN=//" | sed -e "s/\/emailAddress=.*//";
echo ""; # newline
echo "Subject Alternative Name(s):";
echo ""; # newline
echo "${certText}" | grep -A 1 "Subject Alternative Name:" \
| sed -e "2s/DNS://g" -e "s/ //g" | tr "," "\n" | tail -n +2;
return 0;
else
echo "ERROR: Certificate not found.";
return 1;
fi;
}
# `tre` is a shorthand for `tree` with hidden files and color enabled, ignoring
# the `.git` directory, listing directories first. The output gets piped into

@ -54,7 +54,7 @@ PATH=/usr/local/bin:${GOPATH}/bin:${GOROOT}/bin:${PATH}
# http://stackoverflow.com/questions/410616/increasing-the-maximum-number-of-tcp-ip-connections-in-linux
# run these to increase concurrent connections in linux
# sudo sysctl net.ipv4.ip_local_port_range="15000 61000"
# sudo sysctl net.ipv4.ip_local_port_range="18000 61000"
# sudo sysctl net.ipv4.tcp_fin_timeout="30"
# sudo sysctl net.ipv4.tcp_tw_recycle=1
# sudo sysctl net.ipv4.tcp_tw_reuse=1

@ -2,42 +2,61 @@
# View abbreviated SHA, description, and history graph of the latest 20 commits
lo = log --oneline -n 40 --graph
l = log --oneline -n 40 --graph --show-signature
# View the current working tree status using the short format
s = status -s
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
d = !"git diff --color --patch-with-stat | diff-so-fancy"
dc = !"git diff --cached --color --patch-with-stat | diff-so-fancy"
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
di = !"d() { git diff --color --patch-with-stat HEAD~$1 | diff-so-fancy; }; git diff-index --color --quiet HEAD --; d"
# Pull in remote changes for the current repository and all its submodules
p = !"git pull; git submodule foreach git pull origin master"
# Clone a repository including all submodules
c = clone --recursive
# Commit all changes
ca = !git add -A && git commit -av -S
# commits with gpgsign flag
cs = commit -S
# commits with gpgsign and inline message flag
csm = commit -S -m
# Switch to a branch, creating it if necessary
go = checkout -B
# pull rebase
pr = pull --rebase
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
remotes = remote -v
# Credit an author on the latest commit
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f"
# Interactive rebase with the given number of latest commits
reb = "!r() { git rebase -i HEAD~$1; }; r"
# Find branches containing commit
fb = "!f() { git branch -a --contains $1; }; f"
# Find tags containing commit
ft = "!f() { git describe --always --contains $1; }; f"
# Find commits by source code
fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f"
# Find commits by commit message
fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f"
# Remove branches that have already been merged with master
dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
@ -76,7 +95,7 @@
[core]
# Use custom `.gitignore` and `.gitattributes`
excludesfile = ~/.gitignore
excludesfile = /Users/Adam/.global_ignore
attributesfile = ~/.gitattributes
# Treat spaces before tabs and all kinds of trailing whitespace as an error.
# [default] trailing-space: looks for spaces at the end of a line
@ -144,3 +163,7 @@
[help]
autocorrect=20
[credential]
helper = osxkeychain
[http]
sslVerify = false

@ -20,21 +20,13 @@ if [ -f ~/.shell_colors ]; then
. ~/.shell_colors
fi
# enable programmable completion features
if [ -f /etc/git_completion ]; then
. /etc/git_completion
fi
# enable programmable completion features
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# for when you want to do custom junk
if [ -f ~/.extensions ]; then
. ~/.extensions
# Sources a folder with shell extensions
elif [ -d ~/.extensions ]; then
if [ -d ~/.extensions ]; then
for plugin in ~/.extensions/*; do
source $plugin
done

@ -12,9 +12,8 @@
set -g default-command "/bin/bash --login"
set -g default-shell "/bin/bash"
#run-shell "powerline-daemon -q"
source ~/Tools/modules/powerline/powerline/bindings/tmux/powerline.conf
run-shell "powerline-daemon -q"
source ~/tools/modules/powerline/powerline/bindings/tmux/powerline.conf
set -g default-terminal "screen-256color"
@ -38,7 +37,6 @@ set-option -g base-index 1
#status bar
set-option -g status-utf8 on
set-option -g status-keys vi
set-option -g status-interval 1
set-option -g status-justify left

124
.vimrc

@ -37,7 +37,9 @@ colorscheme jellybeans
set omnifunc=syntaxcomplete#Complete
set completeopt-=preview
set wildignore=*.png,*.jpg,node_modules,*.min.js,*.txt,*.bak,*.exe
set autochdir
set tags=./.git/tags,tags;$HOME
set noswapfile
set backupcopy=yes
set autoread
@ -61,9 +63,14 @@ set encoding=utf-8 "nobomb
let mapleader = ","
map <Space> :noh<CR>
"list buffers
map <leader>w :buffers<CR>
map <leader>q :buffer#<CR>
" open erros
map <leader>e :lw 5<CR>
" mini buffer explorer toggle
map <Leader>b :MBEToggle<cr>
@ -77,12 +84,24 @@ map <leader>s <Plug>(easymotion-s2)
nmap <leader>n :NERDTreeToggle %:p:h<CR>
nmap <leader>m :NERDTreeClose<CR>:NERDTreeFind<CR>
" strips whitespace
noremap <leader>ss :call StripWhitespace()<CR>
" Strip trailing whitespace (,ss)
function! StripWhitespace()
let save_cursor = getpos(".")
let old_query = getreg('/')
:%s/\s\+$//e
call setpos('.', save_cursor)
call setreg('/', old_query)
endfunction
" pane resizing
nnoremap <C-w> :resize -2<Cr>
nnoremap <C-s> :resize +2<Cr>
nnoremap <C-a> :vertical resize +2<Cr>
nnoremap <C-d> :vertical resize -2<Cr>
noremap <C-w> :resize -3<Cr>
noremap <C-x> :resize +3<Cr>
noremap <C-a> :vertical resize +3<Cr>
noremap <C-d> :vertical resize -3<Cr>
"pane movements
noremap <C-h> <C-w>h
@ -91,23 +110,28 @@ noremap <C-k> <C-w>k
noremap <C-l> <C-w>l
map <leader>x :%s/\s\+$//<CR>:noh<Cr>
"open vimrc in a new tab
map <leader>v :tabedit ~/.vimrc<CR>
map <F1> <Nop>
" Save a file as root (,W)
noremap <leader>W :w !sudo tee % > /dev/null<CR>
" generate tags
nnoremap <leader>t ctags -R -f ./.git/tags .
" enable neocomplete
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_at_startup = 0
" Use smartcase
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#enable_smart_case = 0
set binary
" Don't add empty newlines at the end of files
set binary
set noeol
set history=500 " Number of things to remember in history.
set t_Co=256
@ -167,14 +191,9 @@ set showmode
set title
" Show the (partial) command as its being typed
set showcmd
" Use relative line numbers
if exists("&relativenumber")
set relativenumber
au BufReadPost * set relativenumber
endif
" Start scrolling three lines before the horizontal window border
set scrolloff=4
" Start scrolling x lines before the horizontal window border
set scrolloff=4
" vim-go
let g:go_highlight_functions = 1
@ -184,31 +203,55 @@ let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_extra_types = 1
let g:go_fmt_command = "goimports"
" rename symbol
au FileType go nmap <Leader>r <Plug>(go-rename)
" show type info
au FileType go nmap <Leader>ki <Plug>(go-info)
let g:syntastic_go_checkers = ['go', 'errcheck', 'gofmt', 'golint', 'govet']
"let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
" Automatic commands
if has("autocmd")
" Use relative line numbers
if exists("&relativenumber")
set relativenumber
au BufReadPost * set relativenumber
endif
" go def
au FileType go nmap <Leader>di <Plug>(go-def-split)
au FileType go nmap <Leader>ds <Plug>(go-def-vertical)
au FileType go nmap <Leader>dt <Plug>(go-def-tab)
" rename symbol
au FileType go nmap <Leader>r <Plug>(go-rename)
" go docs
au FileType go nmap <Leader>gd <Plug>(go-doc)
au FileType go nmap <Leader>gs <Plug>(go-doc-vertical)
au FileType go nmap <Leader>gb <Plug>(go-doc-browser)
" show type info
au FileType go nmap <Leader>ki <Plug>(go-info)
" go def
au FileType go nmap <Leader>di <Plug>(go-def-split)
au FileType go nmap <Leader>ds <Plug>(go-def-vertical)
au FileType go nmap <Leader>dt <Plug>(go-def-tab)
" go docs
au FileType go nmap <Leader>gd <Plug>(go-doc)
au FileType go nmap <Leader>gi <Plug>(go-doc-vertical)
au FileType go nmap <Leader>gb <Plug>(go-doc-browser)
endif
" ctrl p
let g:ctrlp_map = '<C-P>'
let g:ctrlp_by_filename = 0
nnoremap <C-n> :CtrlPTag<cr>
let g:ctrlp_cmd = 'CtrlPLastMode'
let g:ctrlp_extensions = ['line']
let g:go_disable_autoinstall = 0
"'c' - the directory of the current file.
"'a' - the directory of the current file, unless it is a subdirectory of the cwd
"'r' - the nearest ancestor of the current file that contains one of these directories or files: .git .hg .svn .bzr _darcs
"'w' - modifier to "r": start search from the cwd instead of the current file's directory
"0 or '' (empty string) - disable this feature.
let g:ctrlp_working_path_mode = 'rc'
let g:ctrlp_by_filename = 0
let g:ctrlp_max_files = 5000
let g:go_disable_autoinstall = 0
"airline config
let g:airline#extensions#tabline#enabled = 1
" the separator used on the left side >
@ -265,9 +308,11 @@ let g:airline#extensions#branch#enabled = 1
" syntastic settings
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_auto_loc_list = 2
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_check_on_wq = 1
let g:syntastic_loc_list_height = 1
let g:syntastic_enable_balloons = 1
let g:syntastic_javascript_checkers = ['standard']
@ -284,28 +329,15 @@ if has("autocmd")
" Treat .md files as Markdown
autocmd BufNewFile,BufRead *.md setlocal filetype=markdown
autocmd BufRead,BufNewFile *.aspx setfiletype apsx syntax=htmldjango
autocmd BufRead,BufNewFile *.ascx setfiletype ascx syntax=htmldjango
autocmd BufRead,BufNewFile *.spark setfiletype spark syntax=htmldjango
autocmd BufRead,BufNewFile *.html setfiletype html syntax=htmldjango
autocmd BufRead,BufNewFile *.template setfiletype html template syntax=htmldjango
autocmd BufRead,BufNewFile *.iced setfiletype icedcoffee syntax=coffee
autocmd BufRead,BufNewFile *.go setfiletype golang syntax=go
autocmd BufRead,BufNewFile *.php setfiletype php syntax=go
endif
au GUIEnter * set vb t_vb=
" Strip trailing whitespace (,ss)
function! StripWhitespace()
let save_cursor = getpos(".")
let old_query = getreg('/')
:%s/\s\+$//e
call setpos('.', save_cursor)
call setreg('/', old_query)
endfunction
noremap <leader>ss :call StripWhitespace()<CR>
if has('gui_running')
set go =mt

@ -3,6 +3,20 @@ laughing-hipster
My dot files
## What's included?
A very simplistic plugin system, drop shell scripts you would like to source into the ~/.extensions directory. .profile will load them automatically.
A custom SSH config setup with nice defaults.
Installs Brew when run on OSX, along with several utilities I commonly use.
Comes with an uninstall script.
Themes for vim, iterm2 and for cmder when ran on windows.
Tmux and vim configurations
## Install
1. Clone this into ~

@ -70,10 +70,8 @@ if [[ $(uname -s) == "Darwin" ]]; then
echo "installing fonts"
find ${source}/tools/modules/powerline-fonts | grep "\.[to]tf" | xargs -I {} cp {} /Users/$(whoami)/Library/Fonts/
echo "running .osx file"
sudo ./.osx
echo "installing brew"
./brew.sh
echo "installing osx stuff"
sudo ./install/.osx
elif [[ $(uname -o) == "Msys" ]]; then
echo "installing fonts"
fonts="$(find ${source}/tools/modules/powerline-fonts | grep "\.[to]tf")"
@ -82,26 +80,27 @@ elif [[ $(uname -o) == "Msys" ]]; then
for font in $fonts
do
fontname="$(basename $font)"
#cp -n $font /c/Windows/Fonts
cp -n $font "$dest/fonts_to_install/"
#reg add "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts" /v "${fontname} (TrueType)" /t REG_SZ /d "$font" /f
done
echo "go to $dest/fonts_to_install, select all of the font files and right-click -> install"
fi
mkdir ~/.extensions
rake
~/tools/vim/bundle/YouCompleteMe/install.py --all
echo ""
echo "Cleaning up..."
cleanup=".git
.gitmodules
.gitignore
install
bootstrap.sh
remove.sh
README.md
.osx
brew.sh"
README.md"
for f in ${cleanup}
do

@ -1,34 +0,0 @@
#!/bin/bash
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)";
brew update && brew install \
brew-cask \
cmake \
curl \
docker\
docker-compose \
docker-machine \
git \
gnupg \
mono \
nvm \
openssl \
python \
rbenv \
ruby-build \
tmux \
wget;
brew install go --cross-compile-all;
brew link --force openssl;
rbenv install 1.9.3-p125;
rbenv global 1.9.3-p125;
brew install macvim --override-system-vim --with-lua --with-python;
rake
~/tools/vim/bundle/YouCompleteMe/install.py --all

@ -0,0 +1 @@
#!/bin/bash

@ -1,8 +1,48 @@
# Menu bar: hide the useless Time Machine and Volume icons
defaults write com.apple.systemuiserver menuExtras -array "/System/Library/CoreServices/Menu Extras/Bluetooth.menu" "/System/Library/CoreServices/Menu Extras/AirPort.menu" "/System/Library/CoreServices/Menu Extras/Battery.menu" "/System/Library/CoreServices/Menu Extras/Clock.menu"
#!/bin/bash
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)";
brew update && brew install \
bash-completion \
brew-cask \
cmake \
curl \
diff-so-fancy \
docker\
docker-compose \
docker-machine \
git \
gnupg \
mono \
nvm \
openssl \
python \
rbenv \
ruby-build \
tmux \
wget;
brew install go --cross-compile-all;
brew install macvim --override-system-vim --with-lua --with-python;
brew install homebrew/games/freeciv
brew link --force openssl;
rbenv install 1.9.3-p125;
rbenv global 1.9.3-p125;
brew tap homebrew/completions
brewcompletions=<<EOF
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
EOF
echo ${brewcompletions} > ~/.extensions/.osx
# Menu bar: hide the useless Time Machine icon
defaults write com.apple.systemuiserver menuExtras -array "/System/Library/CoreServices/Menu Extras/Bluetooth.menu" "/System/Library/CoreServices/Menu Extras/AirPort.menu" "/System/Library/CoreServices/Menu Extras/Battery.menu" "/System/Library/CoreServices/Menu Extras/Clock.menu" "/System/Library/CoreServices/Menu Extras/Volume.menu"
# Disable opening and closing window animations
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
@ -22,7 +62,6 @@ defaults write com.apple.LaunchServices LSQuarantine -bool false
defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true
# Disable automatic termination of inactive apps
defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true

@ -0,0 +1 @@
#!/bin/bash

@ -12796,18 +12796,10 @@
<true/>
<key>MaxVertically</key>
<false/>
<key>NSColorPanelMode</key>
<string>6</string>
<key>NSFontPanelAttributes</key>
<string>1, 8</string>
<key>NSFontPanelPreviewHeight</key>
<real>0.0</real>
<key>NSNavLastRootDirectory</key>
<string>~</string>
<string>~/Desktop</string>
<key>NSNavPanelExpandedSizeForOpenMode</key>
<string>{1032, 448}</string>
<key>NSNavPanelExpandedSizeForSaveMode</key>
<string>{712, 565}</string>
<string>{712, 459}</string>
<key>NSQuotedKeystrokeBinding</key>
<string></string>
<key>NSRepeatCountBinding</key>
@ -12838,20 +12830,10 @@
<key>TB Is Shown</key>
<integer>1</integer>
</dict>
<key>NSWindow Frame NSColorPanel</key>
<string>629 270 214 309 0 0 1920 1058 </string>
<key>NSWindow Frame NSFontPanel</key>
<string>190 376 627 136 0 0 1920 1080 </string>
<key>NSWindow Frame Preferences</key>
<string>516 238 606 456 0 0 1440 877 </string>
<key>NSWindow Frame UKCrashReporter</key>
<string>99 293 592 584 0 0 1440 877 </string>
<key>NSWindow Frame com.apple.typography_panel_LiterationMonoPowerline</key>
<string>560 748 260 36 0 0 1920 1058 </string>
<string>268 455 606 456 0 0 1920 1057 </string>
<key>NSWindow Frame iTerm Window 0</key>
<string>7 328 570 377 0 0 1440 877 </string>
<key>NSWindow Frame iTerm Window 1</key>
<string>1723 9 585 376 1440 -180 1920 1080 </string>
<string>58 500 570 377 0 0 1920 1057 </string>
<key>NeverWarnAboutShortLivedSessions_DBDB563C-6289-4E02-8FC2-6381D54BF5A7</key>
<true/>
<key>New Bookmarks</key>
@ -13062,7 +13044,7 @@
<key>Columns</key>
<integer>80</integer>
<key>Command</key>
<string>source ~/.profile</string>
<string>/bin/bash --login</string>
<key>Cursor Color</key>
<dict>
<key>Blue Component</key>
@ -13084,7 +13066,7 @@
<key>Cursor Type</key>
<integer>2</integer>
<key>Custom Command</key>
<string>No</string>
<string>Yes</string>
<key>Custom Directory</key>
<string>Advanced</string>
<key>Default Bookmark</key>
@ -13601,20 +13583,28 @@
<string>/Users/Adam/projects</string>
</dict>
</array>
<key>NoSyncHaveShownPromoWithId_4</key>
<key>NoSyncDoNotWarnBeforeMultilinePaste</key>
<true/>
<key>NoSyncDoNotWarnBeforeMultilinePaste_selection</key>
<integer>0</integer>
<key>NoSyncDoNotWarnBeforePastingOneLineEndingInNewlineAtShellPrompt</key>
<true/>
<key>NoSyncDoNotWarnBeforePastingOneLineEndingInNewlineAtShellPrompt_selection</key>
<integer>1</integer>
<key>NoSyncInstallationId</key>
<string>D47DFA0C-3768-4260-BE0E-941F43470B50</string>
<string>F11500F8-4683-433D-800C-C1A904A93D66</string>
<key>NoSyncNeverRemindPrefsChangesLostForFile</key>
<true/>
<key>NoSyncNeverRemindPrefsChangesLostForFile_selection</key>
<integer>0</integer>
<integer>1</integer>
<key>NoSyncPermissionToShowTip</key>
<false/>
<key>NoSyncTimeOfFirstLaunchOfVersionWithTip</key>
<real>486460810.41955602</real>
<real>486547662.94228899</real>
<key>NoSyncTimeOfLastPromo</key>
<real>477971588.11202103</real>
<real>486545756.96420902</real>
<key>NoSyncTimeOfLastPromoDownload</key>
<real>486294956.51090801</real>
<real>486545756.96447599</real>
<key>OnlyWhenMoreTabs</key>
<true/>
<key>OpenArrangementAtStartup</key>
@ -13674,18 +13664,16 @@
<integer>8</integer>
<key>RightOption</key>
<integer>3</integer>
<key>SUAutomaticallyUpdate</key>
<true/>
<key>SUEnableAutomaticChecks</key>
<true/>
<key>SUFeedAlternateAppNameKey</key>
<string>iTerm</string>
<key>SUFeedURL</key>
<string>https://iterm2.com/appcasts/testing.xml?shard=39</string>
<string>https://iterm2.com/appcasts/testing.xml?shard=91</string>
<key>SUHasLaunchedBefore</key>
<true/>
<key>SULastCheckTime</key>
<date>2016-06-01T07:59:31Z</date>
<date>2016-06-07T14:08:53Z</date>
<key>SavePasteHistory</key>
<false/>
<key>Secure Input</key>
@ -13720,8 +13708,6 @@
</array>
<key>TripleClickSelectsFullWrappedLines</key>
<false/>
<key>UKCrashReporterLastCrashReportDate</key>
<real>1445397632</real>
<key>URLHandlersByGuid</key>
<dict/>
<key>UseBorder</key>

@ -1,9 +0,0 @@
________/\\\\\\\\\_______/\\\\\_______/\\\\\\\\\\\\_____/\\\\\\\\\\\\\\\_
_____/\\\////////______/\\\///\\\____\/\\\////////\\\__\/\\\///////////__
___/\\\/_____________/\\\/__\///\\\__\/\\\______\//\\\_\/\\\_____________
__/\\\______________/\\\______\//\\\_\/\\\_______\/\\\_\/\\\\\\\\\\\_____
_\/\\\_____________\/\\\_______\/\\\_\/\\\_______\/\\\_\/\\\///////______
_\//\\\____________\//\\\______/\\\__\/\\\_______\/\\\_\/\\\_____________
__\///\\\___________\///\\\__/\\\____\/\\\_______/\\\__\/\\\_____________
____\////\\\\\\\\\____\///\\\\\/_____\/\\\\\\\\\\\\/___\/\\\\\\\\\\\\\\\_
_______\/////////_______\/////_______\////////////_____\///////////////__

@ -19,7 +19,7 @@ namespace :vim do
lines = IO.readlines pluginsFile
puts "Loading #{lines.length} plugins..."
lines.each { |source|
if source[0] != ";" then
if source[0] != "#" then
loadTask = Rake::Task['vim:loadPlugin']
loadTask.invoke source.sub "\n", ''
loadTask.reenable()

@ -1 +1 @@
Subproject commit 67f0995f1693cac43e42caa1f41f6f637d1ec9cd
Subproject commit d77cc30a3be26cf34411af70c5e2b595eef2d46d
Loading…
Cancel
Save