From b4c703c74a750fb2665dab9e8402aad16f37e0b7 Mon Sep 17 00:00:00 2001 From: Vincent Composieux Date: Thu, 8 Feb 2018 22:11:58 +0100 Subject: [PATCH] Update .vimrc --- .vimrc | 187 +++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 150 insertions(+), 37 deletions(-) diff --git a/.vimrc b/.vimrc index f973d6a..badea3f 100644 --- a/.vimrc +++ b/.vimrc @@ -1,3 +1,5 @@ +" vim-bootstrap 55985df + "***************************************************************************** "" Vim-PLug core "***************************************************************************** @@ -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 @@ -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' @@ -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' @@ -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' @@ -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' @@ -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 @@ -113,6 +161,10 @@ Plug 'thoughtbot/vim-rspec' Plug 'ecomba/vim-ruby-refactoring' +" vim-scala +Plug 'derekwyatt/vim-scala' + + "***************************************************************************** "***************************************************************************** @@ -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 @@ -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" @@ -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 @@ -275,7 +336,7 @@ let g:NERDTreeMapOpenInTabSilent = '' let g:NERDTreeWinSize = 50 set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.db,*.sqlite nnoremap :NERDTreeFind -noremap :NERDTreeToggle +nnoremap :NERDTreeToggle " grep.vim nnoremap f :Rgrep @@ -373,25 +434,33 @@ noremap e :e =expand("%:p:h") . "/" "" Opens a tab edit command with the path of the currently edited file filled noremap te :tabe =expand("%:p:h") . "/" -"" 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().'| tr -d "\017"', 1, 0) endif cnoremap =expand("%:p:h") . "/" -noremap b :CtrlPBuffer -let g:ctrlp_map = 'e' -let g:ctrlp_open_new_file = 'r' -let g:ctrlp_cache_dir = $HOME . '/.cache/ctrlp' +nnoremap b :Buffers +nnoremap e :FZF -m + +" snippets +let g:UltiSnipsExpandTrigger="" +let g:UltiSnipsJumpForwardTrigger="" +let g:UltiSnipsJumpBackwardTrigger="" +let g:UltiSnipsEditSplit="vertical" " syntastic let g:syntastic_always_populate_loc_list=1 @@ -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 @@ -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 @@ -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! @@ -534,12 +614,21 @@ augroup go au FileType go nmap i (go-info) au FileType go nmap l (go-metalinter) au FileType go nmap :GoDecls + au FileType go nmap dr :GoDeclsDir au FileType go imap :GoDecls + au FileType go imap dr :GoDeclsDir au FileType go nmap rb :call build_go_files() 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 @@ -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 @@ -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 @@ -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 = { @@ -621,6 +725,13 @@ map s :call RunNearestSpec() map l :call RunLastSpec() map a :call RunAllSpecs() +" For ruby refactory +if has('nvim') + runtime! macros/matchit.vim +else + packadd! matchit +endif + " Ruby refactory nnoremap rap :RAddParameter nnoremap rcpc :RConvertPostConditional @@ -633,6 +744,9 @@ vnoremap rriv :RRenameInstanceVariable vnoremap rem :RExtractMethod +" scala + + "***************************************************************************** "***************************************************************************** @@ -680,4 +794,3 @@ else let g:airline_symbols.readonly = '' let g:airline_symbols.linenr = '' endif -