Skip to content

Commit

Permalink
Update .vimrc
Browse files Browse the repository at this point in the history
  • Loading branch information
eko committed Feb 8, 2018
1 parent d72d74d commit b4c703c
Showing 1 changed file with 150 additions and 37 deletions.
187 changes: 150 additions & 37 deletions .vimrc
@@ -1,3 +1,5 @@
" vim-bootstrap 55985df

"*****************************************************************************
"" Vim-PLug core
"*****************************************************************************
Expand All @@ -7,10 +9,14 @@ endif

let vimplug_exists=expand('~/.vim/autoload/plug.vim')

let g:vim_bootstrap_langs = "c,go,html,javascript,lua,php,python,ruby"
let g:vim_bootstrap_langs = "c,elixir,elm,erlang,go,haskell,html,javascript,lisp,lua,ocaml,perl,php,python,ruby,scala"
let g:vim_bootstrap_editor = "vim" " nvim or vim

if !filereadable(vimplug_exists)
if !executable("curl")
echoerr "You have to install curl or first install vim-plug yourself!"
execute "q!"
endif
echo "Installing Vim-Plug..."
echo ""
silent !\curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Expand All @@ -29,7 +35,6 @@ Plug 'scrooloose/nerdtree'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'airblade/vim-gitgutter'
Expand All @@ -42,7 +47,12 @@ Plug 'scrooloose/syntastic'
Plug 'Yggdroot/indentLine'
Plug 'avelino/vim-bootstrap-updater'
Plug 'sheerun/vim-polyglot'

if isdirectory('/usr/local/opt/fzf')
Plug '/usr/local/opt/fzf' | Plug 'junegunn/fzf.vim'
else
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
endif
let g:make = 'gmake'
if exists('make')
let g:make = 'make'
Expand Down Expand Up @@ -71,11 +81,32 @@ Plug 'vim-scripts/c.vim', {'for': ['c', 'cpp']}
Plug 'ludwig/split-manpage.vim'


" elixir
Plug 'elixir-lang/vim-elixir'
Plug 'carlosgaldino/elixir-snippets'


" elm
"" Elm Bundle
Plug 'elmcast/elm-vim'


" erlang
Plug 'jimenezrick/vimerl'


" go
"" Go Lang Bundle
Plug 'fatih/vim-go', {'do': ':GoInstallBinaries'}


" haskell
"" Haskell Bundle
Plug 'eagletmt/neco-ghc'
Plug 'dag/vim2hs'
Plug 'pbrisbin/vim-syntax-shakespeare'


" html
"" HTML Bundle
Plug 'hail2u/vim-css3-syntax'
Expand All @@ -89,12 +120,28 @@ Plug 'mattn/emmet-vim'
Plug 'jelera/vim-javascript-syntax'


" lisp
"" Lisp Bundle
Plug 'vim-scripts/slimv.vim'


" lua
"" Lua Bundle
Plug 'xolox/vim-lua-ftplugin'
Plug 'xolox/vim-lua-inspect'


" ocaml
"" OCaml Bundle
Plug 'def-lkb/ocp-indent-vim'


" perl
"" Perl Bundle
Plug 'vim-perl/vim-perl'
Plug 'c9s/perlomni.vim'


" php
"" PHP Bundle
Plug 'arnaud-lb/vim-php-namespace'
Expand All @@ -103,6 +150,7 @@ Plug 'arnaud-lb/vim-php-namespace'
" python
"" Python Bundle
Plug 'davidhalter/jedi-vim'
Plug 'raimon49/requirements.txt.vim', {'for': 'requirements'}


" ruby
Expand All @@ -113,6 +161,10 @@ Plug 'thoughtbot/vim-rspec'
Plug 'ecomba/vim-ruby-refactoring'


" vim-scala
Plug 'derekwyatt/vim-scala'


"*****************************************************************************
"*****************************************************************************

Expand Down Expand Up @@ -141,7 +193,7 @@ set ttyfast
"" Fix backspace indent
set backspace=indent,eol,start

"" Tabs. May be overriten by autocmd rules
"" Tabs. May be overridden by autocmd rules
set tabstop=4
set softtabstop=0
set shiftwidth=4
Expand All @@ -164,8 +216,12 @@ set nobackup
set noswapfile

set fileformats=unix,dos,mac
set showcmd
set shell=/bin/sh

if exists('$SHELL')
set shell=$SHELL
else
set shell=/bin/sh
endif

" session management
let g:session_directory = "~/.vim/session"
Expand Down Expand Up @@ -238,6 +294,11 @@ set titlestring=%F

set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\

" Search mappings: These will make it so that going to the next one in a
" search will center on the line it's found in.
nnoremap n nzzzv
nnoremap N Nzzzv
if exists("*fugitive#statusline")
set statusline+=%{fugitive#statusline()}
endif
Expand Down Expand Up @@ -275,7 +336,7 @@ let g:NERDTreeMapOpenInTabSilent = '<RightMouse>'
let g:NERDTreeWinSize = 50
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.db,*.sqlite
nnoremap <silent> <F2> :NERDTreeFind<CR>
noremap <F3> :NERDTreeToggle<CR>
nnoremap <silent> <F3> :NERDTreeToggle<CR>
" grep.vim
nnoremap <silent> <leader>f :Rgrep<CR>
Expand Down Expand Up @@ -373,25 +434,33 @@ noremap <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
"" Opens a tab edit command with the path of the currently edited file filled
noremap <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR>
"" ctrlp.vim
"" fzf.vim
set wildmode=list:longest,list:full
set wildignore+=*.o,*.obj,.git,*.rbc,*.pyc,__pycache__
let g:ctrlp_custom_ignore = '\v[\/](node_modules|target|dist)|(\.(swp|tox|ico|git|hg|svn))$'
let g:ctrlp_user_command = "find %s -type f | grep -Ev '"+ g:ctrlp_custom_ignore +"'"
let g:ctrlp_use_caching = 1
let $FZF_DEFAULT_COMMAND = "find * -path '*/\.*' -prune -o -path 'node_modules/**' -prune -o -path 'target/**' -prune -o -path 'dist/**' -prune -o -type f -print -o -type l -print 2> /dev/null"

" The Silver Searcher
if executable('ag')
let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""'
set grepprg=ag\ --nogroup\ --nocolor
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
let g:ctrlp_use_caching = 0
endif

" ripgrep
if executable('rg')
let $FZF_DEFAULT_COMMAND = 'rg --files --hidden --follow --glob "!.git/*"'
set grepprg=rg\ --vimgrep
command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --hidden --follow --glob "!.git/*" --color "always" '.shellescape(<q-args>).'| tr -d "\017"', 1, <bang>0)
endif

cnoremap <C-P> <C-R>=expand("%:p:h") . "/" <CR>
noremap <leader>b :CtrlPBuffer<CR>
let g:ctrlp_map = '<leader>e'
let g:ctrlp_open_new_file = 'r'
let g:ctrlp_cache_dir = $HOME . '/.cache/ctrlp'
nnoremap <silent> <leader>b :Buffers<CR>
nnoremap <silent> <leader>e :FZF -m<CR>
" snippets
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<c-b>"
let g:UltiSnipsEditSplit="vertical"

" syntastic
let g:syntastic_always_populate_loc_list=1
Expand Down Expand Up @@ -465,25 +534,35 @@ autocmd FileType c setlocal tabstop=4 shiftwidth=4 expandtab
autocmd FileType cpp setlocal tabstop=4 shiftwidth=4 expandtab


" go
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'
\ }
" elixir


" elm
" elm-vim
let g:elm_setup_keybindings = 0
let g:elm_format_autosave = 1

" vim-polyglot
let g:polyglot_disabled = ['elm']

" syntastic
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:elm_syntastic_show_warnings = 1


" erlang
let erlang_folding = 1
let erlang_show_errors = 1


" go
" vim-go
" run :GoBuild or :GoTestCompile based on the go file
function! s:build_go_files()
let l:file = expand('%')
if l:file =~# '^\f\+_test\.go$'
call go#cmd#Test(0, 1)
call go#test#Test(0, 1)
elseif l:file =~# '^\f\+\.go$'
call go#cmd#Build(0)
endif
Expand All @@ -492,7 +571,7 @@ endfunction
let g:go_list_type = "quickfix"
let g:go_fmt_command = "goimports"
let g:go_fmt_fail_silently = 1
let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:syntastic_go_checkers = ['golint', 'govet']
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }

let g:go_highlight_types = 1
Expand All @@ -501,13 +580,14 @@ let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_structs = 1
let g:go_highlight_generate_tags = 1
let g:go_highlight_space_tab_error = 0
let g:go_highlight_array_whitespace_error = 0
let g:go_highlight_trailing_whitespace_error = 0
let g:go_highlight_extra_types = 0
let g:go_highlight_extra_types = 1

autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4
autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 softtabstop=4

augroup completion_preview_close
autocmd!
Expand All @@ -534,12 +614,21 @@ augroup go
au FileType go nmap <Leader>i <Plug>(go-info)
au FileType go nmap <silent> <Leader>l <Plug>(go-metalinter)
au FileType go nmap <C-g> :GoDecls<cr>
au FileType go nmap <leader>dr :GoDeclsDir<cr>
au FileType go imap <C-g> <esc>:<C-u>GoDecls<cr>
au FileType go imap <leader>dr <esc>:<C-u>GoDeclsDir<cr>
au FileType go nmap <leader>rb :<C-u>call <SID>build_go_files()<CR>
augroup END


" haskell
let g:haskell_conceal_wide = 1
let g:haskell_multiline_strings = 1
let g:necoghc_enable_detailed_browse = 1
autocmd Filetype haskell setlocal omnifunc=necoghc#omnifunc


" html
" for html files, 2 spaces
autocmd Filetype html setlocal ts=2 sw=2 expandtab
Expand All @@ -551,13 +640,28 @@ let g:javascript_enable_domhtmlcss = 1
" vim-javascript
augroup vimrc-javascript
autocmd!
autocmd FileType javascript set tabstop=4|set shiftwidth=4|set expandtab softtabstop=4 smartindent
autocmd FileType javascript setl tabstop=4|setl shiftwidth=4|setl expandtab softtabstop=4
augroup END


" lisp


" lua


" ocaml
" Add Merlin to rtp
let g:opamshare = substitute(system('opam config var share'),'\n$','','''')
execute "set rtp+=" . g:opamshare . "/merlin/vim"

" Set Merlin as Syntastic checker for OCaml
let g:syntastic_ocaml_checkers = ['merlin']


" perl


" php


Expand All @@ -566,7 +670,7 @@ augroup END
augroup vimrc-python
autocmd!
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=8 colorcolumn=79
\ formatoptions+=croq softtabstop=4 smartindent
\ formatoptions+=croq softtabstop=4
\ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
augroup END

Expand Down Expand Up @@ -601,7 +705,7 @@ let g:rubycomplete_rails = 1
augroup vimrc-ruby
autocmd!
autocmd BufNewFile,BufRead *.rb,*.rbw,*.gemspec setlocal filetype=ruby
autocmd FileType ruby set tabstop=2|set shiftwidth=2|set expandtab softtabstop=2 smartindent
autocmd FileType ruby set tabstop=2|set shiftwidth=2|set expandtab softtabstop=2
augroup END

let g:tagbar_type_ruby = {
Expand All @@ -621,6 +725,13 @@ map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
" For ruby refactory
if has('nvim')
runtime! macros/matchit.vim
else
packadd! matchit
endif

" Ruby refactory
nnoremap <leader>rap :RAddParameter<cr>
nnoremap <leader>rcpc :RConvertPostConditional<cr>
Expand All @@ -633,6 +744,9 @@ vnoremap <leader>rriv :RRenameInstanceVariable<cr>
vnoremap <leader>rem :RExtractMethod<cr>

" scala


"*****************************************************************************
"*****************************************************************************

Expand Down Expand Up @@ -680,4 +794,3 @@ else
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''
endif

0 comments on commit b4c703c

Please sign in to comment.