Skip to content

Instantly share code, notes, and snippets.

@badsyntax
Created September 3, 2015 08:34
Show Gist options
  • Select an option

  • Save badsyntax/5a5baacd023c5cdaf34c to your computer and use it in GitHub Desktop.

Select an option

Save badsyntax/5a5baacd023c5cdaf34c to your computer and use it in GitHub Desktop.
Latest dotfiles for OSX
alias ls="ls -G"
alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
alias serve="~/Scripts/serve"
alias serve80="sudo ~/Scripts/serve 80"
alias t="echo $0"
alias gitlogall="git log --graph --decorate --pretty=oneline --abbrev-commit --all"
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh
source ~/Scripts/git-completion.bash
export GREP_OPTIONS='--color=always'
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWCOLORHINTS=true
GIT_PS1_SHOWUNTRACKEDFILES=true
PS1="\n\[\e[01;34m\]┌─(\[\e[01;35m\]\u@${HOSTNAME%%.*}\[\e[01;34m\])"'$(__git_ps1 "──(\[\e[01;31m\]%s\[\e[01;34m\])")'"\[\e[01;34m\]\n\[\e[01;34m\]└─(\[\e[01;32m\]\w\[\e[01;34m\])──(\[\e[01;32m\]$ \[\e[01;37m\]"
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
defshell -bash
# huge scrollback buffer
defscrollback 5000
# no welcome message
startup_message off
#screen, with the time and date and with the current window highlighted
hardstatus alwayslastline
#hardstatus string '%{= kG}%-Lw%{= kW}%50> %n%f* %t%{= kG}%+Lw%< %{= kG}%-=%c:%s%{-}'
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W}%c %{g}]'
# Mousewheel scrolling
termcapinfo xterm* ti@:te@
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