My Setup

Author Avatar
Yiyun Yao May 31, 2017

Oh My Zsh

https://github.com/robbyrussell/oh-my-zsh

Install

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
brew install autojump

Installation Permission Problem

(Github)[https://github.com/Homebrew/brew/issues/3228]

Configure

Add following lines to .zshrc

plugins=(git cpp autojump osx)
[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh

if [[ "$TERM_PROGRAM" == "nuclide" ]]; then
  export EDITOR='atom --wait'
else
  export EDITOR=vim # your favorite editor here
fi

zsh-autosuggestions

git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

Add following lines to .zshrc

plugins=(zsh-autosuggestions)

Oh My Tmux

https://github.com/gpakosz/.tmux

Install

cd
git clone https://github.com/gpakosz/.tmux.git
ln -s -f .tmux/.tmux.conf
cp .tmux/.tmux.conf.local .
tmux source-file ~/.tmux.conf

Add following lines to .zshrc.

tls='tmux ls'
tat='tmux attach -t'
trn='tmux rename'

Also if you want the tmux works with the Mac copy/paste. Please install reattach-to-user-namespace

spf13-vim

https://github.com/spf13/spf13-vim

Install

curl https://j.mp/spf13-vim3 -L > spf13-vim.sh && sh spf13-vim.sh

Open vim and run

:PluginInstall

Configure

Modify .vimrc.bundles

let g:spf13_bundle_groups=['general', 'writing', 'youcompleteme', 'programming', 'python', 'javascript', 'html', 'misc',]

Install YouCompleteMe (cpp & javascript)

cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer
./install.py --tern-completer

Add settings for YouCompleteMe in .vimrc.local

let g:ycm_global_ycm_extra_conf = "~/.vim/.ycm_extra_conf.py"
let g:ycm_confirm_extra_conf = 0
let g:ycm_seed_identifiers_with_syntax = 1
let g:ycm_collect_identifiers_from_tag_files = 1
let g:ycm_min_num_of_chars_for_completion = 1
set completeopt=longest,menu

Get .ycm_extra_conf.py

cd
wget https://raw.githubusercontent.com/Valloric/ycmd/master/cpp/ycm/.ycm_extra_conf.py

Add the path under include <...> to the .ycm_extra_conf.py with -isystem

echo | clang -v -E -x c++ -

Open vim and restart YcmServer

:YcmRestartServer

[optional] Add google/vim-codefmt

Add plugins to .vimrc.bundles.local and run :PluginInstall

Plugin 'google/vim-maktaba'
Plugin 'google/vim-codefmt'
Plugin 'google/vim-glaive'

Add settings to .vimrc.local

call glaive#Install()
Glaive codefmt plugin[mappings]
Glaive codefmt google_java_executable="java -jar /path/to/google-java-format-VERSION-all-deps.jar"
Glaive codefmt clang_format_style="google"

augroup autoformat_settings
  autocmd FileType bzl AutoFormatBuffer buildifier
  autocmd FileType c,cpp,proto,javascript AutoFormatBuffer clang-format
  autocmd FileType dart AutoFormatBuffer dartfmt
  autocmd FileType go AutoFormatBuffer gofmt
  autocmd FileType gn AutoFormatBuffer gn
  autocmd FileType html,css,json AutoFormatBuffer js-beautify
  autocmd FileType java AutoFormatBuffer google-java-format
  autocmd FileType python AutoFormatBuffer yapf
  " Alternative: autocmd FileType python AutoFormatBuffer autopep8
augroup END

" vim-javascript
autocmd Filetype javascript setlocal ts=2 sts=2 sw=2

Unbind existing key mapping of <Leader>= in .vimrc