X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/066d85f264de844d55df1a47dfcaff4b39d39e46..e48f84d521de72d8f39997054e57ae43f44c0d4b:/vim/vimrc diff --git a/vim/vimrc b/vim/vimrc index 1e994bc..7d88d12 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -31,11 +31,13 @@ Plug 'majutsushi/tagbar' Plug 'octol/vim-cpp-enhanced-highlight' Plug 'raimondi/delimitmate' Plug 'ram-z/vim-clang-format', { 'branch': 'fix-undo' } -Plug 'ram-z/vimwiki', { 'branch': 'no_override_map' } -Plug 'scrooloose/syntastic' +" fix some issue with vim-clang-format not finding .clang-format +let g:clang_format#detect_style_file = 1 +Plug 'vimwiki/vimwiki', { 'branch': 'dev' } +" Plug 'scrooloose/syntastic' Plug 'sgeb/vim-diff-fold' Plug 'shougo/unite.vim' -Plug 'shougo/vimproc.vim' +Plug 'shougo/vimproc.vim', {'do': 'make'} Plug 'sjl/gundo.vim' Plug 'thinca/vim-qfreplace' Plug 'tomtom/tcomment_vim' @@ -44,16 +46,19 @@ Plug 'tpope/vim-endwise' Plug 'tpope/vim-eunuch' Plug 'tpope/vim-fugitive' Plug 'tpope/vim-repeat' +Plug 'tpope/vim-scriptease' +Plug 'tpope/vim-speeddating' Plug 'tpope/vim-surround' "investigate vim-sandwich Plug 'tpope/vim-unimpaired' Plug 'tweekmonster/spellrotate.vim' -Plug 'valloric/youcompleteme', { 'do': './install.py --clang-completer' } +Plug 'valloric/youcompleteme', { 'do': './install.py --clangd-completer --clang-completer' } Plug 'vim-scripts/mediawiki.vim' Plug 'vim-scripts/replacewithregister' Plug 'vim-scripts/yankring.vim' +Plug 'wincent/loupe' " colorschemes -Plug 'flazz/vim-colorschemes' +Plug 'morhetz/gruvbox' " snippets Plug 'sirver/ultisnips' @@ -66,13 +71,21 @@ Plug 'sgur/vim-textobj-parameter' Plug 'kana/vim-operator-user' " staging -" find an alternative (latex-box? Automatic Latex Plugin?) -Plug 'vim-latex/vim-latex' -Plug 'alx741/vinfo' -" needs editing colorscheme -" Plug 'jeaye/color_coded' " Check LucHermites plugins: https://github.com/LucHermitte/lh-cpp -Plug 'wincent/loupe' +Plug 'dense-analysis/ale' " {{{2 +let g:ale_echo_msg_format = '[%linter%] %code: %%s' +let g:ale_c_parse_compile_commands = 1 +let g:ale_cpp_parse_compile_commands = 1 +" don't use loclist as it's being populated by ycm +" (might want to enable for other filetypes) +let g:ale_set_loclist = 0 +let g:ale_cpp_gcc_options = '' +let g:ale_linters_ignore = { 'cpp': ['clangd', 'clangtidy', 'clang'] } + +Plug 'git@github.com:/ram-z/vim-orgmode', { 'branch': 'dev' } " {{{2 +Plug 'vim-scripts/syntaxrange' + +let g:org_agenda_files = ['~/org/*.org'] call plug#end() @@ -84,6 +97,8 @@ set background=dark let g:gruvbox_contrast_dark = 'hard' let g:gruvbox_contrast_light = 'soft' colorscheme gruvbox +" override the background to be black +highligh Normal ctermbg=None " options {{{1 " moving around, searching and patterns {{{2 @@ -110,7 +125,7 @@ set list " show chars defined in 'listchars' set listchars=tab:❭\ " list of strings used for list mode set listchars+=extends:❯,precedes:❮ " Only shown when not in insert mode -au InsertLeave * :set listchars+=trail:· +set listchars+=trail:· augroup trailing au! au InsertEnter * :set listchars-=trail:· @@ -338,8 +353,21 @@ augroup END map " make -nnoremap r :make! -nnoremap :make! +function! Make() + let l:make_dir = "" + if exists("b:make_dir") + let l:make_dir = "-C ".b:make_dir + elseif exists("g:make_dir") + let l:make_dir = "-C ".g:make_dir + endif + + let l:make_targets = "" + if exists("g:make_targets") + let l:make_targets = g:make_targets + endif + execute "make! ".l:make_dir." ".l:make_targets +endf +nnoremap r :call Make() " unhighlight search nnoremap / :silent nohl @@ -417,8 +445,8 @@ cnoremap cnoremap " proper movement when lines are wrapped -noremap j (v:count == 0 ? 'gj' : 'j') -noremap k (v:count == 0 ? 'gk' : 'k') +noremap j (v:count == 0 ? 'gj' : 'j') +noremap k (v:count == 0 ? 'gk' : 'k') " disable arrows noremap @@ -534,6 +562,11 @@ nnoremap gc :Gcommit -v nnoremap ga :Gwrite nnoremap gb :Gblame +augroup fugitive_gstatus + au! + autocmd BufWinEnter */.git/index resize 16 +augroup end + " Gundo {{{2 nnoremap :GundoToggle @@ -590,6 +623,8 @@ let g:syntastic_style_warning_symbol='S' let g:syntastic_always_populate_loc_list=1 nmap y :SyntasticCheck +let g:syntastic_cpp_clang_tidy_post_args = "-p build*" + if ! &diff let g:syntastic_check_on_open=1 endif @@ -703,7 +738,9 @@ endfunction " youcompleteme {{{2 let g:ycm_extra_conf_globlist = ['~/src/*','/mnt/data/src/*'] -let g:ycm_global_ycm_extra_conf = expand('$XDG_CONFIG_HOME/vim/ycm_extra_conf.py') +" ycm-clangd requires you to symlink the compile_db to the root of the project +" let g:ycm_global_ycm_extra_conf = expand('$XDG_CONFIG_HOME/vim/ycm_extra_conf.py') +let g:ycm_clangd_binary_path = 'clangd' " use clangd in path let g:ycm_extra_conf_vim_data = ['getcwd()'] let g:ycm_add_preview_to_completeopt = 1 let g:ycm_complete_in_comments = 1 @@ -725,11 +762,6 @@ nnoremap tu :GTestRunUnderCursor " vim-json {{{2 let g:vim_json_syntax_conceal = 0 -" vim-latex {{{2 -let g:tex_flavor='latex' -let g:Tex_DefaultTargetFormat='pdf' -let g:Tex_MultipleCompileFormats='pdf' - " vim-sneak {{{2 let g:sneak#streak = 1 let g:sneak#target_labels = "aoeuisnthdpylrcgfqjkxzmwvz" " dvorak @@ -776,7 +808,7 @@ nnoremap gs :set operatorfunc=SortLinesOpFuncg@ vnoremap gs :sort " edit configs {{{2 -function! EditConfig(what) +function! EditConfig(what, ext = '.vim') let l:dir = split(&runtimepath,',')[0] if a:what == 'vimrc' let l:file = expand($MYVIMRC) @@ -785,7 +817,7 @@ function! EditConfig(what) elseif empty(&filetype) echoe 'filetype is empty!' else - let l:file = l:dir.'/'.a:what.'/'.&filetype.'.vim' + let l:file = l:dir.'/'.a:what.'/'.&filetype.a:ext endif execute ':vsplit '.file @@ -795,7 +827,7 @@ nmap ev :call EditConfig('vimrc') nmap ef :call EditConfig('ftplugin') nmap es :call EditConfig('syntax') nmap ei :call EditConfig('indent') -nmap eu :UltiSnipsEdit:lcd %:p:h +nmap eu :call EditConfig('ultisnips', '.snippets') " spell check {{{2 " http://tex.stackexchange.com/a/52932