X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/cc76d36d2a3bc4bbc61a7161f6542029bb95a409..b47ffe60e244c9165f40371736079320ea2d848b:/vim/ftplugin/cpp.vim diff --git a/vim/ftplugin/cpp.vim b/vim/ftplugin/cpp.vim index 12c6443..19850a7 100644 --- a/vim/ftplugin/cpp.vim +++ b/vim/ftplugin/cpp.vim @@ -45,30 +45,6 @@ let g:switch_const_definitions = nnoremap c :call switch#Switch({'definitions': g:switch_const_definitions}) -" Disable ale as we use ycm -let b:ale_enabled = 0 - -nnoremap gd :YcmCompleter GoTo -nnoremap d :vs:YcmCompleter GoTo -nnoremap gD :YcmCompleter GoToReferences - -nnoremap fi :YcmCompleter FixIt -nnoremap fr :YcmCompleter RefactorRename - -" format with = -call operator#user#define_ex_command('ycmcompleter-format', 'YcmCompleter Format') -map = (operator-ycmcompleter-format) -vnoremap = :YcmCompleter Format -" restore = mapping to g= -nnoremap g= = -vnoremap g= = - -" hover popup -let g:ycm_auto_hover = '' -let b:ycm_hover = { 'command': 'GetDoc', 'syntax': &filetype } -nmap gh (YCMHover) -nmap gH :YcmCompleter GetDoc - setlocal errorformat= " TODO I don't remember these errorformat or what they match, maybe CMake? {{{ setlocal errorformat+=\ %##%n\ %m\ %f:%l:%c @@ -112,3 +88,18 @@ function! InitialFoldLevel() endif endf call InitialFoldLevel() + +function! MyCppFoldText() + let l:line = getline(v:foldstart) + " expand tabs in line, foldtext does not do it on its own + let l:line = substitute(l:line, "\t", repeat(" ", shiftwidth()), "g") + let l:width = min([&textwidth, winwidth(0)]) + let l:lineinfo = printf("%d", v:foldend - v:foldstart) + let l:ellipsis = "…" + return printf("%.*s%s%*d", + \ l:width - strdisplaywidth(l:ellipsis..l:lineinfo), l:line, + \ l:ellipsis, + \ l:width - strdisplaywidth(l:line..l:ellipsis), l:lineinfo) +endfunction +setlocal foldtext=MyCppFoldText() +setlocal fillchars+=fold:\