Skip to content

Instantly share code, notes, and snippets.

@badsyntax
Last active August 29, 2015 14:26
Show Gist options
  • Select an option

  • Save badsyntax/4a201e75e9a3d7beb48b to your computer and use it in GitHub Desktop.

Select an option

Save badsyntax/4a201e75e9a3d7beb48b to your computer and use it in GitHub Desktop.
My latest dotfiles on osx
#!/usr/bin/env bash
alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
alias serve="python -m SimpleHTTPServer"
alias serve80="sudo python -m SimpleHTTPServer 80"
alias ls='ls -G'
source /Library/Developer/CommandLineTools/usr/share/git-core/git-prompt.sh
source /Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/richard/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
export PS1='\[\033[32m\]\u@\h\[\033[00m\] in \[\033[34m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\n$ '
user=`whoami`
OS="OS X `sw_vers -productVersion`"
shell="$SHELL"
disk=`df | head -2 | tail -1 | awk '{print $5}'`
#gem install lolcat
echo "$OS. Disk: $disk. Shell: $shell. Welcome $user!"| lolcat --freq 0.5
[user]
name = Richard Willis
email = [email protected]
[color]
ui = auto
[push]
default = current
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[merge]
tool = sublime
[mergetool "sublime"]
cmd = /Applications/Sublime\\ Text.app/Contents/SharedSupport/bin/subl -w $MERGED
trustExitCode = false
[core]
editor = vim
pager = less -+$LESS -FRX
set nowrap
" Make vim more useful
set nocompatible
" Enhance command-line completion
set wildmenu
" Allow cursor keys in insert mode
set esckeys
" Optimize for fast terminal connections
set ttyfast
" Add the g flag to search/replace by default
set gdefault
" Use UTF-8 without BOM
set encoding=utf-8 nobomb
" Change mapleader
let mapleader=","
" Don’t add empty newlines at the end of files
set binary
set noeol
" Enable line numbers
" set number
" Highlight current line
" set cursorline
" Make tabs as wide as two spaces
set tabstop=2
" Highlight searches
set hlsearch
" Ignore case of searches
set ignorecase
" Highlight dynamically as pattern is typed
set incsearch
" Always show status line
set laststatus=1
" Enable mouse in all modes
set mouse=a
" Disable error bells
set noerrorbells
" Don’t reset cursor to start of line when moving around.
set nostartofline
" Show the cursor position
set ruler
" Show the current mode
set showmode
" Show the filename in the window titlebar
set title
" Start scrolling three lines before the horizontal window border
set scrolloff=3
" Enable syntax highlighting
syntax on
" Highlight colours
:highlight LineNr ctermfg=DarkGray ctermbg=NONE
" :hi CursorLine cterm=NONE ctermbg=DarkGray
" 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)
endfunc
" Similar to :retab, only that it will not replace leading whitespace
func! RetabIndents()
let saved_view = winsaveview()
execute '%s@^\(\ \{'.&ts.'\}\)\+@\=repeat("\t", len(submatch(0))/'.&ts.')@e'
call winrestview(saved_view)
endfunc
" Add commands for StripWhitespace and RetabIndents functions
command! StripWhitespace call StripWhitespace()
command! RetabIndents call RetabIndents()
" Call StripWhitespace and RetabIndents functions on file save
autocmd BufWritePre * :StripWhitespace
autocmd BufWritePre * :RetabIndents
" Automatically reload vimrc when it's saved
au BufWritePost .vimrc so ~/.vimrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment