Last active
December 23, 2015 03:39
-
-
Save rjeczalik/6574654 to your computer and use it in GitHub Desktop.
dotfiles
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
#!/usr/bin/env bash | |
prefix=/opt/vim | |
vimrc=https://gist.github.com/rjeczalik/6574654/raw/377037c862ad21481e48d00210708f76c62bb412/vimrc | |
# TODO: install deps for vundle, Command-T and YouCompleteMe (python-dev, ruby-dev, xorg-dev etc.) | |
# vim --version must at very minimum yield support for +python +ruby +xterm_clipboard | |
die() { | |
if [ ! -z "${*}" ]; then | |
echo "* ${*}" | |
fi | |
echo "* Exiting . . ." | |
exit 1 | |
} | |
for dep in hg make gcc g++ ruby; do | |
if ! type ${dep} >/dev/null 2>&1; then | |
die "could not find ${dep}" | |
fi | |
done | |
cd `mktemp -d` | |
# Compile Vim from sources | |
hg clone https://vim.googlecode.com/hg/ vim || die; cd vim | |
./configure --prefix="${prefix}" --enable-cscope --enable-multibyte --enable-gpm --enable-selinux --with-features=huge --enable-acl --disable-gtk2-check --disable-gnome-check --disable-motif-check --enable-fontset --enable-luainterp --enable-pythoninterp --disable-python3interp --enable-rubyinterp --enable-tclinterp --enable-gui=auto --with-x || die | |
make -j4 || die | |
make install || die | |
# Install an alternative for vim | |
sudo update-alternatives --install /usr/bin/vim vim "${prefix}"/bin/vim 99 | |
# Install vundle | |
mkdir -p "${prefix}"/etc/vim; cd "${prefix}"/etc/vim || die | |
git clone https://github.com/gmarik/vundle.git bundle/vundle || die | |
wget -O "${prefix}"/etc/vimrc "${vimrc}" | |
ln -sf "${prefix}"/etc/vimrc "${HOME}"/.vimrc | |
ln -sf "${prefix}"/etc/vim "${HOME}"/.vim | |
vim +BundleInstall +qall | |
# Build plugins | |
cd "${prefix}"/etc/vim/bundle/command-t/ruby/command-t; ruby extconf.rb && make || die | |
cd "${prefix}"/etc/vim/bundle/YouCompleteMe; ./install.sh || die | |
for pkg in github.com/jstemmer/gotags github.com/nsf/gocode; do | |
GOPATH="${prefix}" GOBIN="${prefix}"/bin go get ${pkg} | |
done | |
if ! grep -E "PATH=.*(${prefix}/bin)" "${HOME}"/.bashrc; then | |
echo "export PATH=${prefix}/bin" >> "${HOME}"/.bashrc | |
fi |
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
filetype off | |
filetype plugin indent off | |
set nocompatible | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
Bundle 'gmarik/vundle' | |
Bundle 'jnwhiteh/vim-golang' | |
Bundle 'Blackrush/vim-gocode' | |
Bundle 'git://git.wincent.com/command-t.git' | |
Bundle 'airblade/vim-gitgutter' | |
Bundle 'Valloric/YouCompleteMe' | |
Bundle 'mileszs/ack.vim' | |
Bundle 'Lokaltog/vim-easymotion' | |
Bundle 'mattboehm/vim-accordion' | |
Bundle 'mattboehm/vim-unstack' | |
Bundle 'kien/rainbow_parentheses.vim' | |
Bundle 'jstemmer/gotags' | |
Bundle 'majutsushi/tagbar' | |
"Bundle 'bling/vim-airline' | |
Bundle 'scrooloose/nerdtree' | |
Bundle 'jistr/vim-nerdtree-tabs' | |
filetype plugin indent on | |
syntax on | |
set t_Co=256 | |
set hlsearch | |
set updatetime=750 | |
set title | |
set tabstop=2 shiftwidth=2 expandtab | |
set backspace=2 | |
set colorcolumn=80 | |
set clipboard=unnamedplus | |
set number | |
set wildignore+=*.o,*.obj,.git,*.dll,*.so,*.a,*/tmp/*,*/temp/*,*/out/*,*.swp,*.tar.*,*.zip | |
set listchars=tab:❘-,trail:·,extends:»,precedes:«,nbsp:×,eol:¶ | |
set mouse=a | |
colorscheme herald | |
let g:EasyMotion_leader_key = '\' | |
let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyz' | |
let g:ycm_autoclose_preview_window_after_completion = 1 | |
let g:ackprg = 'ag --nogroup --nocolor --column' | |
let g:unstack_mapkey='<F6>' | |
let g:tagbar_type_go = { | |
\ 'ctagstype' : 'go', | |
\ 'kinds' : [ | |
\ 'p:package', | |
\ 'i:imports:1', | |
\ 'c:constants', | |
\ 'v:variables', | |
\ 't:types', | |
\ 'n:interfaces', | |
\ 'w:fields', | |
\ 'e:embedded', | |
\ 'm:methods', | |
\ 'r:constructor', | |
\ 'f:functions' | |
\ ], | |
\ 'sro' : '.', | |
\ 'kind2scope' : { | |
\ 't' : 'ctype', | |
\ 'n' : 'ntype' | |
\ }, | |
\ 'scope2kind' : { | |
\ 'ctype' : 't', | |
\ 'ntype' : 'n' | |
\ }, | |
\ 'ctagsbin' : 'gotags', | |
\ 'ctagsargs' : '-sort -silent' | |
\ } | |
hi colorcolumn ctermbg=233 | |
hi RedundantWhitespace ctermbg=red guibg=red | |
match RedundantWhitespace /\s\+$\| \+\ze\t/ | |
au VimEnter * RainbowParenthesesToggle | |
au Syntax * RainbowParenthesesLoadRound | |
au Syntax * RainbowParenthesesLoadSquare | |
au Syntax * RainbowParenthesesLoadBraces | |
nnoremap <C-o> :Ack!<space> | |
noremap <F2> :set list!<CR> | |
noremap <F3> :CommandTFlush<CR> | |
nmap <F7> <plug>NERDTreeTabsToggle<CR> | |
nmap <F8> :TagbarToggle<CR> | |
nmap <C-n> :tabnext<CR> | |
map <C-n> :tabnext<CR> | |
imap <C-n> <Esc>:tabnext<CR>i | |
nmap <C-p> :CommandT<CR> | |
map <C-p> :CommandT<CR> | |
imap <C-p> <Esc>:CommandT<CR>i | |
nmap <C-g> :GitGutterToggle<CR> | |
map <C-g> :GitGutterToggle<CR> | |
imap <C-g> <Esc>:GitGutterToggle<CR>i | |
autocmd BufWritePre *.go Fmt | |
autocmd FileType go autocmd BufWritePre <buffer> Fmt | |
"function! EnhanceCppSyntax() | |
" syn match cCustomParen /?=(/ contains=cParen,cCppParen | |
" syn match cCustomFunc /\w\+\s*(\@=/ contains=cCustomParen | |
" syn match cCustomScope /::/ | |
" syn match cCustomClass /\w\+\s*::/ contains=cCustomScope | |
" syn match cCustomOperator /\(::\|->\|\.\|\.\*\|->\*\|(\|)\)/ | |
" hi def link cCustomFunc Function | |
" hi def link cCustomClass Structure | |
" hi def link cCustomOperator Operator | |
"endfunction | |
"au Syntax cpp call EnhanceCppSyntax() | |
function! EnhanceGoSyntax() | |
" syn match goParen /(/ | |
" syn match goCustomParen /?=(/ contains=goParen | |
" syn match goCustomFunc /\.\w\+\s*(\@=/ contains=goCustomParen | |
syn match goCustomExtraType /\<io\.ReadCloser\>/ | |
" syn match goCustomStatement /\(\.\|:=\|=\|<-\)/ | |
syn match goCustomStatement /\(:=\)/ | |
" hi def link goCustomFunc Function | |
hi def link goCustomStatement Statement | |
hi def link goCustomExtraType Type | |
endfunction | |
au Syntax go call EnhanceGoSyntax() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment