Created
December 29, 2016 00:34
-
-
Save svnlto/764f119803e8b80370f910c44b3f815b to your computer and use it in GitHub Desktop.
new mac setup
This file contains 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
set nocompatible " be iMproved | |
filetype off " required! | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
" let Vundle manage Vundle | |
" required! | |
Plugin 'gmarik/vundle' | |
" Editing | |
Plugin 'matchit.zip' | |
Plugin 'repeat.vim' | |
Plugin 'surround.vim' | |
Plugin 'vim-indent-object' | |
Plugin 'scrooloose/syntastic' | |
" File explore | |
Plugin 'The-NERD-Commenter' | |
Plugin 'The-NERD-tree' | |
Plugin 'kien/ctrlp.vim' | |
Plugin 'bling/vim-airline' | |
" Auto complete | |
Plugin 'ervandew/supertab' | |
" Colorscheme | |
Plugin 'svnlto/vim-svnlto' | |
Plugin 'joshdick/onedark.vim' | |
Plugin 'joshdick/airline-onedark.vim' | |
" Syntax Highlight | |
Plugin 'colorizer' | |
" Programming | |
Plugin 'jelera/vim-javascript-syntax' | |
Plugin 'pangloss/vim-javascript' | |
" Others | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'airblade/vim-gitgutter' | |
Plugin 'sjl/vitality.vim' | |
Plugin 'jordwalke/VimSplitBalancer' | |
Plugin 'matze/vim-move' | |
Plugin 'mxw/vim-jsx' | |
Plugin 'moll/vim-node' | |
Plugin 'editorconfig-vim' | |
Plugin 'jistr/vim-nerdtree-tabs' | |
Plugin 'godlygeek/csapprox' | |
Plugin 'mattn/gist-vim' | |
Plugin 'mattn/webapi-vim' | |
Plugin 'ack.vim' | |
Plugin 'matchparenpp' | |
Plugin 'tpope/vim-surround' | |
Plugin 'Townk/vim-autoclose' | |
Plugin 'isRuslan/vim-es6' | |
Plugin 'othree/yajs.vim' | |
Plugin 'othree/es.next.syntax.vim' | |
Plugin 'MarcWeber/vim-addon-mw-utils' | |
Plugin 'tomtom/tlib_vim' | |
Plugin 'garbas/vim-snipmate' | |
Plugin 'honza/vim-snippets' | |
Plugin 'djoshea/vim-autoread' | |
Plugin 'tpope/vim-fireplace' | |
Plugin 'luochen1990/rainbow' | |
Plugin 'elmcast/elm-vim' | |
Plugin 'mhinz/vim-startify' | |
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux. | |
if (has("nvim")) | |
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 > | |
let $NVIM_TUI_ENABLE_TRUE_COLOR=1 | |
endif | |
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 > | |
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd > | |
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 > | |
if (has("termguicolors")) | |
set termguicolors | |
endif | |
filetype plugin indent on " required! | |
" | |
" Brief help | |
" :PluginList - list configured bundles | |
" :PluginInstall(!) - install (update) bundles | |
" :PluginSearch(!) foo - search (or refresh cache first) for foo | |
" :PluginClean(!) - confirm (or auto-approve) removal of unused bundles | |
" | |
" see :h vundle for more details or wiki for FAQ | |
" NOTE: comments after Plugin commands are not allowed. | |
syntax on | |
syntax enable | |
set so=10 | |
set ruler | |
set number | |
set hidden | |
set nowrap | |
set autoread | |
set showmatch | |
set clipboard=unnamed | |
set wildignore=*.o,*~,*.pyc | |
set backspace=eol,start,indent | |
set iskeyword+=- | |
set ffs=unix,dos,mac | |
set laststatus=2 | |
set colorcolumn=80 | |
behave mswin | |
" Turn backup off, since most stuff is in SVN, git etc. | |
set nowb | |
set nobackup | |
set noswapfile | |
" No annoying sound on errors | |
set noerrorbells | |
set visualbell | |
set t_vb= | |
set tm=500 | |
set ignorecase | |
set smartcase | |
set hlsearch | |
set incsearch | |
set expandtab | |
set smarttab | |
set smartindent | |
set shiftwidth=2 | |
set tabstop=2 | |
set autoread | |
set guifont=Hack:h12 | |
set t_Co=256 | |
set background=dark | |
colorscheme onedark | |
noremap ; : | |
noremap 0 ^ | |
noremap <space> $ | |
noremap Y y$ | |
" Treat long lines as break lines (useful when moving around in them) | |
noremap j gj | |
noremap k gk | |
" Smart way to move between windows | |
noremap <C-j> <C-W>j | |
noremap <C-k> <C-W>k | |
noremap <C-h> <C-W>h | |
noremap <C-l> <C-W>l | |
" Smart way to manage tabs | |
nnoremap tl :tabnext<CR> | |
nnoremap th :tabprev<CR> | |
nnoremap tn :tabnew<CR> | |
nnoremap tc :tabclose<CR> | |
nnoremap tm :tabmove<CR> | |
nnoremap to :tabonly<CR> | |
let mapleader = "," | |
nnoremap <leader>hs :noh<CR> | |
" edit and reload vimrc | |
nnoremap <leader>ev :e $MYVIMRC<CR> | |
nnoremap <leader>sv :source $MYVIMRC<CR> | |
autocmd! bufwritepost vimrc source % | |
map <leader>pp :setlocal paste!<cr> | |
map <leader>ss :setlocal spell!<cr> | |
" plugin settings | |
let g:airline_powerline_fonts = 1 | |
if !exists('g:airline_symbols') | |
let g:airline_symbols = {} | |
endif | |
let g:airline_symbols.space = "\ua0" | |
let vimclojure#WantNailgun = 1 | |
let g:rainbow_active = 1 | |
let g:NERDTreeChDirMode=2 | |
map tt :NERDTreeToggle<CR> | |
map ff :NERDTreeFind<CR> | |
let NERDSpaceDelims=1 | |
autocmd VimEnter * call StartUp() | |
autocmd VimEnter * wincmd p | |
let g:elm_jump_to_error = 1 | |
let g:elm_make_output_file = "elm.js" | |
let g:elm_make_show_warnings = 0 | |
let g:elm_browser_command = "" | |
let g:elm_detailed_complete = 1 | |
let g:elm_format_autosave = 0 | |
let g:ctrlp_map = '<c-p>' | |
let g:ctrlp_cmd = 'CtrlP' | |
let g:ctrlp_custom_ignore = 'tmp$\|\.git$\|\.hg$\|\.svn$\|\.rvm$\|vendor$' | |
let g:ctrlp_tabpage_position = 'a' | |
let g:ctrlp_working_path_mode = 'ra' | |
let g:ctrlp_max_files = 0 | |
let g:SuperTabCrMapping = 1 | |
" The Silver Searcher | |
if executable('ag') | |
" Use ag over grep | |
set grepprg=ag\ --nogroup\ --nocolor | |
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore | |
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' | |
" ag is fast enough that CtrlP doesn't need to cache | |
let g:ctrlp_use_caching = 0 | |
endif | |
set statusline+=%#warningmsg# | |
set statusline+=%{SyntasticStatuslineFlag()} | |
set statusline+=%* | |
let g:syntastic_javascript_checkers = ['eslint'] | |
let g:syntastic_javascript_eslint_exec = 'eslint_d' | |
let g:syntastic_check_on_wq = 0 | |
" remove trailing whitespace on save | |
autocmd BufWritePre * :%s/\s\+$//e | |
behave mswin | |
nmap <leader>l :set list!<CR> | |
function! CmdLine(str) | |
exe "menu Foo.Bar :" . a:str | |
emenu Foo.Bar | |
unmenu Foo | |
endfunction | |
if has("gui_running") " all this for gui use | |
" ugly MacVim Cruft | |
set guioptions-=r "remove scrollbars | |
set guioptions-=R "remove scrollbars | |
set guioptions-=l "remove scrollbars | |
set guioptions-=L "remove scrollbars | |
set guioptions-=T " Remove toolbars | |
"========== Mac OS X ================================== | |
" Pro Tips: | |
" Make sure to turn off anti-aliasing in general preferences panel. | |
if has("gui_macvim") | |
" Don't remove tabs on MacVim because VimGUITabs plugin makes them get out | |
" of the way when we want them to get out of the way (in full screen mode). | |
" set guioptions-=e | |
" set guifont=Menlo:h12.00 | |
" like A CSS Reset: | |
let macvim_skip_colorscheme = 1 | |
set transparency=0 | |
set fuoptions=maxvert,maxhorz | |
endif | |
endif | |
function! VisualSelection(direction, extra_filter) range | |
let l:saved_reg = @" | |
execute "normal! vgvy" | |
let l:pattern = escape(@", '\\/.*$^~[]') | |
let l:pattern = substitute(l:pattern, "\n$", "", "") | |
if a:direction == 'b' | |
execute "normal ?" . l:pattern . "^M" | |
elseif a:direction == 'gv' | |
call CmdLine("vimgrep " . '/'. l:pattern . '/' . ' **/*.' . a:extra_filter) | |
elseif a:direction == 'replace' | |
call CmdLine("%s" . '/'. l:pattern . '/') | |
elseif a:direction == 'f' | |
execute "normal /" . l:pattern . "^M" | |
endif | |
let @/ = l:pattern | |
let @" = l:saved_reg | |
endfunction | |
function! StartUp() | |
execute 'NERDTree' getcwd() | |
endfunction | |
" change cursor depending on mode | |
if empty($TMUX) | |
let &t_SI = "\<Esc>]50;CursorShape=1\x7" | |
let &t_EI = "\<Esc>]50;CursorShape=0\x7" | |
let &t_SR = "\<Esc>]50;CursorShape=2\x7" | |
else | |
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" | |
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\" | |
let &t_SR = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=2\x7\<Esc>\\" | |
endif | |
" Visual mode pressing * or # searches for the current selection | |
" Super useful! From an idea by Michael Naumann | |
vnoremap <silent> * :call VisualSelection('f', '')<CR> | |
vnoremap <silent> # :call VisualSelection('b', '')<CR> | |
" When you press <leader>r you can search and replace the selected text | |
vnoremap <silent> <leader>r :call VisualSelection('replace', '')<CR> | |
This file contains 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
#!/bin/sh | |
# Welcome to the thoughtbot laptop script! | |
# Be prepared to turn your laptop (or desktop, no haters here) | |
# into an awesome development machine. | |
fancy_echo() { | |
local fmt="$1"; shift | |
# shellcheck disable=SC2059 | |
printf "\n$fmt\n" "$@" | |
} | |
append_to_zshrc() { | |
local text="$1" zshrc | |
local skip_new_line="$2" | |
if [ -w "$HOME/.zshrc.local" ]; then | |
zshrc="$HOME/.zshrc.local" | |
else | |
zshrc="$HOME/.zshrc" | |
fi | |
if ! grep -Fqs "$text" "$zshrc"; then | |
if [ "$skip_new_line" -eq 1 ]; then | |
printf "%s\n" "$text" >> "$zshrc" | |
else | |
printf "\n%s\n" "$text" >> "$zshrc" | |
fi | |
fi | |
} | |
trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT | |
set -e | |
if [ ! -d "$HOME/.bin/" ]; then | |
mkdir "$HOME/.bin" | |
fi | |
if [ ! -f "$HOME/.zshrc" ]; then | |
touch "$HOME/.zshrc" | |
fi | |
# shellcheck disable=SC2016 | |
append_to_zshrc 'export PATH="$HOME/.bin:$PATH"' | |
case "$SHELL" in | |
*/zsh) : ;; | |
*) | |
fancy_echo "Changing your shell to zsh ..." | |
chsh -s "$(which zsh)" | |
;; | |
esac | |
brew_install_or_upgrade() { | |
if brew_is_installed "$1"; then | |
if brew_is_upgradable "$1"; then | |
fancy_echo "Upgrading %s ..." "$1" | |
brew upgrade "$@" | |
else | |
fancy_echo "Already using the latest version of %s. Skipping ..." "$1" | |
fi | |
else | |
fancy_echo "Installing %s ..." "$1" | |
brew install "$@" | |
fi | |
} | |
brew_is_installed() { | |
local name="$(brew_expand_alias "$1")" | |
brew list -1 | grep -Fqx "$name" | |
} | |
brew_is_upgradable() { | |
local name="$(brew_expand_alias "$1")" | |
! brew outdated --quiet "$name" >/dev/null | |
} | |
brew_expand_alias() { | |
brew info "$1" 2>/dev/null | head -1 | awk '{gsub(/:/, ""); print $1}' | |
} | |
brew_launchctl_restart() { | |
local name="$(brew_expand_alias "$1")" | |
local domain="homebrew.mxcl.$name" | |
local plist="$domain.plist" | |
fancy_echo "Restarting %s ..." "$1" | |
mkdir -p "$HOME/Library/LaunchAgents" | |
ln -sfv "/usr/local/opt/$name/$plist" "$HOME/Library/LaunchAgents" | |
if launchctl list | grep -Fq "$domain"; then | |
launchctl unload "$HOME/Library/LaunchAgents/$plist" >/dev/null | |
fi | |
launchctl load "$HOME/Library/LaunchAgents/$plist" >/dev/null | |
} | |
brew_cask_expand_alias() { | |
brew cask info "$1" 2>/dev/null | head -1 | awk '{gsub(/:/, ""); print $1}' | |
} | |
brew_cask_is_installed() { | |
local NAME=$(brew_cask_expand_alias "$1") | |
brew cask list -1 | grep -Fqx "$NAME" | |
} | |
brew_cask_install() { | |
if ! brew_cask_is_installed "$1"; then | |
brew cask install "$@" | |
fi | |
} | |
brew_cask_install_or_upgrade() { | |
if brew_cask_is_installed "$1"; then | |
echo "$1 is already installed, brew cask upgrade is not yet implemented" | |
else | |
brew cask install "$@" | |
fi | |
} | |
gem_install_or_update() { | |
if gem list "$1" --installed > /dev/null; then | |
fancy_echo "Updating %s ..." "$1" | |
gem update "$@" | |
else | |
fancy_echo "Installing %s ..." "$1" | |
gem install "$@" | |
rbenv rehash | |
fi | |
} | |
if ! command -v brew >/dev/null; then | |
fancy_echo "Installing Homebrew ..." | |
curl -fsS \ | |
'https://raw.githubusercontent.com/Homebrew/install/master/install' | ruby | |
append_to_zshrc '# recommended by brew doctor' | |
# shellcheck disable=SC2016 | |
append_to_zshrc 'export PATH="/usr/local/bin:$PATH"' 1 | |
export PATH="/usr/local/bin:$PATH" | |
else | |
fancy_echo "Homebrew already installed. Skipping ..." | |
fi | |
fancy_echo "Updating Homebrew formulas ..." | |
brew update | |
brew_install_or_upgrade 'ack' | |
brew_install_or_upgrade 'httpie' | |
brew_install_or_upgrade 'tree' | |
brew_install_or_upgrade 'git' | |
brew_install_or_upgrade 'git-extras' | |
brew_install_or_upgrade 'neovim' | |
brew_install_or_upgrade 'tmux' | |
brew_install_or_upgrade 'reattach-to-user-namespace' | |
brew_install_or_upgrade 'gh' | |
brew_install_or_upgrade 'rbenv-bundler' | |
brew_install_or_upgrade 'gmp' | |
brew_install_or_upgrade 'docker' | |
brew_install_or_upgrade 'docker-machine' | |
brew_install_or_upgrade 'docker-compose' | |
brew_install_or_upgrade 'docker-swarm' | |
brew_install_or_upgrade 'brew-cask' | |
node_version="stable" | |
brew_install_or_upgrade 'nvm' | |
# shellcheck disable=SC2016 | |
append_to_zshrc 'export PATH="$PATH:/usr/local/lib/node_modules"' | |
# shellcheck disable=SC2016 | |
append_to_zshrc 'source $(brew --prefix nvm)/nvm.sh' 1 | |
. "$(brew --prefix nvm)/nvm.sh" | |
nvm install "$node_version" | |
fancy_echo "Setting $node_version as the global default nodejs..." | |
nvm alias default "$node_version" | |
if [ ! -d "$HOME/.rbenv" ]; then | |
brew_install_or_upgrade 'rbenv' | |
brew_install_or_upgrade 'ruby-build' | |
# shellcheck disable=SC2016 | |
append_to_zshrc 'eval "$(rbenv init - zsh --no-rehash)"' 1 | |
fi | |
brew_install_or_upgrade 'openssl' | |
brew unlink openssl && brew link openssl --force | |
brew_install_or_upgrade 'libyaml' | |
ruby_version="$(curl -sSL http://ruby.thoughtbot.com/latest)" | |
eval "$(rbenv init - zsh)" | |
if ! rbenv versions | grep -Fq "$ruby_version"; then | |
rbenv install -s "$ruby_version" --disable-binary | |
fi | |
rbenv global "$ruby_version" | |
rbenv shell "$ruby_version" | |
sudo gem update --system | |
gem_install_or_update 'bundler' | |
gem_install_or_update 'git-smart' | |
fancy_echo "Configuring Bundler ..." | |
number_of_cores=$(sysctl -n hw.ncpu) | |
bundle config --global jobs $((number_of_cores - 1)) | |
fancy_echo "Configuring git-smart..." | |
git config --global color.ui always | |
brew tap caskroom/cask | |
brew tap caskroom/versions | |
brew_cask_install_or_upgrade '1password' | |
brew_cask_install_or_upgrade 'arq' | |
brew_cask_install_or_upgrade 'betterzipql' | |
brew_cask_install_or_upgrade 'font-hack' | |
brew_cask_install_or_upgrade 'google-chrome' | |
brew_cask_install_or_upgrade 'google-chrome-canary' | |
brew_cask_install_or_upgrade 'imageoptim' | |
brew_cask_install_or_upgrade 'istat-menus' | |
brew_cask_install_or_upgrade 'iterm2' | |
brew_cask_install_or_upgrade 'java7' | |
brew_cask_install_or_upgrade 'licecap' | |
brew_cask_install_or_upgrade 'little-snitch' | |
brew_cask_install_or_upgrade 'lunchy-go' | |
brew_cask_install_or_upgrade 'macdown' | |
brew_cask_install_or_upgrade 'qlcolorcode' | |
brew_cask_install_or_upgrade 'qlimagesize' | |
brew_cask_install_or_upgrade 'qlmarkdown' | |
brew_cask_install_or_upgrade 'qlstephen' | |
brew_cask_install_or_upgrade 'quicklook-json' | |
brew_cask_install_or_upgrade 'spotify' | |
brew_cask_install_or_upgrade 'the-unarchiver' | |
brew_cask_install_or_upgrade 'virtualbox' |
This file contains 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
source $HOME/.antigen/antigen.zsh | |
# Load the oh-my-zsh's library. | |
antigen use oh-my-zsh | |
antigen bundle git | |
antigen bundle github | |
antigen bundle nvm | |
antigen bundle npm | |
antigen bundle docker | |
antigen bundle rsync | |
antigen bundle command-not-found | |
antigen bundle unixorn/docker-helpers.zshplugin | |
antigen bundle denysdovhan/spaceship-zsh-theme | |
# Syntax highlighting bundle. | |
antigen bundle zsh-users/zsh-syntax-highlighting | |
antigen theme spaceship | |
# Tell antigen that you're done. | |
antigen apply | |
# PROMPT | |
SPACESHIP_PROMPT_SYMBOL='➔' | |
SPACESHIP_PROMPT_ADD_NEWLINE=true | |
SPACESHIP_PROMPT_SEPARATE_LINE=true | |
# GIT | |
SPACESHIP_GIT_SHOW=true | |
SPACESHIP_GIT_UNCOMMITTED='+' | |
SPACESHIP_GIT_UNSTAGED='!' | |
SPACESHIP_GIT_UNTRACKED='?' | |
SPACESHIP_GIT_STASHED='$' | |
SPACESHIP_GIT_UNPULLED='⇣' | |
SPACESHIP_GIT_UNPUSHED='⇡' | |
# NVM | |
SPACESHIP_NVM_SHOW=true | |
SPACESHIP_NVM_SYMBOL='⬢' | |
# RUBY | |
SPACESHIP_RUBY_SHOW=false | |
# Homebrew | |
export PATH="/usr/local/bin:$PATH" | |
export PATH="/usr/local/sbin:$PATH" | |
# Ruby... | |
if which rbenv > /dev/null; then | |
eval "$(rbenv init -)"; | |
fi | |
# nvim | |
export NVIM_TUI_ENABLE_CURSOR_SHAPE=1 | |
# nvm | |
export NVM_DIR=~/.nvm | |
source $(brew --prefix nvm)/nvm.sh | |
export EDITOR=nvim | |
export REACT_EDITOR=nvim | |
ulimit -n 4096 | |
alias npmoffline="npm --cache-min 9999999 " | |
# babel | |
export BABEL_DISABLE_CACHE=1 | |
# docker-machine | |
# if which docker-machine > /dev/null; then | |
# eval "$(docker-machine env default)"; | |
# fi | |
# Customize to your needs... | |
export PATH=$PATH:~/.bin | |
# launch tmux | |
alias tmux="tmux -2" | |
if [[ $TERM == xterm ]]; then TERM=xterm-256color fi | |
if [ "$TMUX" = "" ]; then tmux; fi | |
export NO_PROXY=192.168.99.0/24 | |
# comaeio | |
export COMAE_ENV=local | |
# docker cloud | |
export DOCKERCLOUD_NAMESPACE=comaeio | |
# dvm | |
[[ -s "$(brew --prefix dvm)/dvm.sh" ]] && source "$(brew --prefix dvm)/dvm.sh" | |
# digitalocean | |
export DIGITALOCEAN_ACCESS_TOKEN=8015676a735b8a34ee52d58d86b3f6eb81e5ce40e579455cf80ceda4317a58a0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment