Last active
December 25, 2015 11:48
-
-
Save pablox-cl/6971283 to your computer and use it in GitHub Desktop.
Revisions
-
pablox-cl revised this gist
Oct 16, 2013 . 2 changed files with 2245 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,1218 @@ FUNCTION <SNR>83_IsInString() Called 4 times Total time: 0.000166 Self time: 0.000166 count total (s) self (s) 4 0.000164 return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string FUNCTION <SNR>88_OnVimLeave() Called 1 time Total time: 0.000113 Self time: 0.000113 count total (s) self (s) 1 0.000062 py ycm_state.OnVimLeave() 1 0.000050 py extra_conf_store.CallExtraConfVimCloseIfExists() FUNCTION <SNR>83_PrevNonBlankNonString() Called 5 times Total time: 0.000817 Self time: 0.000261 count total (s) self (s) 5 0.000006 let in_block = 0 5 0.000011 let lnum = prevnonblank(a:lnum) 8 0.000010 while lnum > 0 " Go in and out of blocks comments as necessary. " If the line isn't empty (with opt. comment) or in a string, end search. 8 0.000017 let line = getline(lnum) 8 0.000023 if line =~ '/\*' if in_block let in_block = 0 else break endif elseif !in_block && line =~ '\*/' let in_block = 1 elseif !in_block && line !~ '^\s*\%(//\).*$' && !(s:IsInStringOrComment(lnum, 1) && s:IsInStringOrComment(lnum, strlen(line))) 5 0.000006 break endif 3 0.000006 let lnum = prevnonblank(lnum - 1) 3 0.000002 endwhile 5 0.000005 return lnum FUNCTION <SNR>63_mergelists() Called 1 time Total time: 0.000651 Self time: 0.000505 count total (s) self (s) 1 0.000151 0.000016 let diskmrufs = ctrlp#utils#readfile(ctrlp#mrufiles#cachefile()) 1 0.000444 cal filter(diskmrufs, 'index(s:mrufs, v:val) < 0') 1 0.000033 let mrufs = s:mrufs + diskmrufs 1 0.000020 0.000009 retu s:chop(mrufs) FUNCTION <SNR>88_OnInsertLeave() Called 1 time Total time: 0.000415 Self time: 0.000096 count total (s) self (s) 1 0.000034 0.000006 if !s:AllowedToCompleteInCurrentFile() return endif 1 0.000002 let s:omnifunc_mode = 0 1 0.000094 0.000009 call s:UpdateDiagnosticNotifications() 1 0.000218 0.000012 call s:OnFileReadyToParse() 1 0.000054 py ycm_state.OnInsertLeave() 1 0.000004 if g:ycm_autoclose_preview_window_after_completion || g:ycm_autoclose_preview_window_after_insertion call s:ClosePreviewWindowIfNeeded() endif FUNCTION 34() Called 57 times Total time: 0.000220 Self time: 0.000220 count total (s) self (s) 57 0.000102 if self._hasErrorsOrWarningsToDisplay >= 0 57 0.000076 return self._hasErrorsOrWarningsToDisplay endif let self._hasErrorsOrWarningsToDisplay = empty(self._rawLoclist) ? 0 : (!self._quietWarnings || len(self.errors())) return self._hasErrorsOrWarningsToDisplay FUNCTION ctrlp#mrufiles#cachefile() Called 1 time Total time: 0.000014 Self time: 0.000014 count total (s) self (s) 1 0.000006 if !exists('s:cadir') || !exists('s:cafile') let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru' let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt' en 1 0.000001 retu s:cafile FUNCTION <SNR>83_IsInMultilineComment() Called 2 times Total time: 0.000225 Self time: 0.000073 count total (s) self (s) 2 0.000224 0.000072 return !s:IsLineComment(a:lnum, a:col) && synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_multiline FUNCTION <SNR>88_OnBufferUnload() Called 1 time Total time: 0.000153 Self time: 0.000127 count total (s) self (s) 1 0.000033 0.000007 if !s:AllowedToCompleteInCurrentFile() || empty( a:deleted_buffer_file ) return endif 1 0.000116 py ycm_state.OnBufferUnload( vim.eval( 'a:deleted_buffer_file' ) ) FUNCTION <SNR>88_UpdateDiagnosticNotifications() Called 2 times Total time: 0.000132 Self time: 0.000132 count total (s) self (s) 2 0.000121 if get( g:, 'loaded_syntastic_plugin', 0 ) && pyeval( 'ycm_state.NativeFiletypeCompletionUsable()' ) && pyeval( 'ycm_state.DiagnosticsForCurrentFileReady()' ) && g:ycm_register_as_syntastic_checker SyntasticCheck endif FUNCTION UltiSnips_CursorMoved() Called 27 times Total time: 0.003091 Self time: 0.003091 count total (s) self (s) 27 0.003059 exec g:_uspy "UltiSnips_Manager.cursor_moved()" FUNCTION <SNR>60_StopExplorer() Called 1 time Total time: 0.001112 Self time: 0.000040 count total (s) self (s) 1 0.000089 0.000003 call <SID>DEBUG('Entering StopExplorer()',10) 1 0.000394 0.000007 if a:force || <SID>HasEligibleBuffers() let t:miniBufExplAutoUpdate = 0 endif 1 0.000384 0.000011 let l:winNum = <SID>FindWindow('-MiniBufExplorer-', 1) 1 0.000002 if l:winNum == -1 1 0.000141 0.000005 call <SID>DEBUG('There is no MBE window, aborting...',1) 1 0.000095 0.000005 call <SID>DEBUG('Leaving StopExplorer()',10) 1 0.000001 return endif call s:SwitchWindow('w',1,l:winNum) silent! close call s:SwitchWindow('p',1) " Work around a redraw bug in gVim (Confirmed present in 7.3.50) if has('gui_gtk') && has('gui_running') redraw! endif call <SID>DEBUG('Leaving StopExplorer()',10) FUNCTION <SNR>60_IsBufferIgnored() Called 1 time Total time: 0.000204 Self time: 0.000037 count total (s) self (s) 1 0.000090 0.000006 call <SID>DEBUG('Entering IsBufferIgnored('.a:buf.')',10) " Skip unlisted buffers. 1 0.000005 if buflisted(a:buf) == 0 || index(s:BufList,a:buf) == -1 call <SID>DEBUG('Buffer '.a:buf.' is unlisted, ignoring...',5) call <SID>DEBUG('Leaving IsBufferIgnored()',10) return 1 endif " Skip non normal buffers. 1 0.000006 if getbufvar(a:buf, "&buftype") != '' call <SID>DEBUG('Buffer '.a:buf.' is not normal, ignoring...',5) call <SID>DEBUG('Leaving IsBufferIgnored()',10) return 1 endif 1 0.000087 0.000004 call <SID>DEBUG('Leaving IsBufferIgnored()',10) 1 0.000002 return 0 FUNCTION youcompleteme#Complete() Called 50 times Total time: 0.009423 Self time: 0.005546 count total (s) self (s) " After the user types one character after the call to the omnifunc, the " completefunc will be called because of our mapping that calls the " completefunc on every keystroke. Therefore we need to delegate the call we " 'stole' back to the omnifunc 50 0.000141 if s:omnifunc_mode return youcompleteme#OmniComplete( a:findstart, a:base ) endif 50 0.000053 if a:findstart " InvokeCompletion has this check but we also need it here because of random " Vim bugs and unfortunate interactions with the autocommands of other " plugins 38 0.000036 if !s:cursor_moved " for vim, -2 means not found but don't trigger an error message " see :h complete-functions return -2 endif " TODO: make this a function-local variable instead of a script-local one 38 0.001048 let s:completion_start_column = pyeval( 'base.CompletionStartColumn()' ) 38 0.002009 let s:should_use_filetype_completion = pyeval( 'ycm_state.ShouldUseFiletypeCompleter(' . s:completion_start_column . ')' ) 38 0.001375 if !s:should_use_filetype_completion && !pyeval( 'ycm_state.ShouldUseGeneralCompleter(' . s:completion_start_column . ')' ) " for vim, -2 means not found but don't trigger an error message " see :h complete-functions 26 0.000037 return -2 endif 12 0.000020 return s:completion_start_column else 12 0.003969 0.000092 return s:CompletionsForQuery( a:base, s:should_use_filetype_completion, s:completion_start_column ) endif FUNCTION <SNR>88_AllowedToCompleteInCurrentFile() Called 30 times Total time: 0.000558 Self time: 0.000558 count total (s) self (s) 30 0.000182 if empty( &filetype ) || getbufvar(winbufnr(winnr()), "&buftype") ==# 'nofile' return 0 endif 30 0.000130 let whitelist_allows = has_key( g:ycm_filetype_whitelist, '*' ) || has_key( g:ycm_filetype_whitelist, &filetype ) 30 0.000089 let blacklist_allows = !has_key( g:ycm_filetype_blacklist, &filetype ) 30 0.000049 return whitelist_allows && blacklist_allows FUNCTION g:SyntasticLoclistHide() Called 1 time Total time: 0.000005 Self time: 0.000005 count total (s) self (s) 1 0.000003 silent! lclose FUNCTION <SNR>83_Match() Called 5 times Total time: 0.000097 Self time: 0.000097 count total (s) self (s) 5 0.000079 let col = match(getline(a:lnum), a:regex) + 1 5 0.000015 return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0 FUNCTION <SNR>63_savetofile() Called 1 time Total time: 0.000392 Self time: 0.000011 count total (s) self (s) 1 0.000391 0.000010 cal ctrlp#utils#writecache(a:mrufs, s:cadir, s:cafile) FUNCTION <SNR>88_SetUpYcmChangedTick() Called 2 times Total time: 0.000015 Self time: 0.000015 count total (s) self (s) 2 0.000014 let b:ycm_changedtick = get( b:, 'ycm_changedtick', { 'file_ready_to_parse' : -1, } ) FUNCTION <SNR>88_UpdateCursorMoved() Called 26 times Total time: 0.000352 Self time: 0.000352 count total (s) self (s) 26 0.000069 let current_position = getpos('.') 26 0.000066 let s:cursor_moved = current_position != s:old_cursor_position 26 0.000114 let s:moved_vertically_in_insert_mode = s:old_cursor_position != [] && current_position[ 1 ] != s:old_cursor_position[ 1 ] 26 0.000047 let s:old_cursor_position = current_position FUNCTION <SNR>88_OnFileReadyToParse() Called 2 times Total time: 0.000228 Self time: 0.000213 count total (s) self (s) " We need to call this just in case there is no b:ycm_changetick; this can " happen for special buffers. 2 0.000027 0.000012 call s:SetUpYcmChangedTick() 2 0.000007 let buffer_changed = b:changedtick != b:ycm_changedtick.file_ready_to_parse 2 0.000002 if buffer_changed 1 0.000177 py ycm_state.OnFileReadyToParse() 1 0.000002 endif 2 0.000007 let b:ycm_changedtick.file_ready_to_parse = b:changedtick FUNCTION ctrlp#utils#writecache() Called 1 time Total time: 0.000381 Self time: 0.000367 count total (s) self (s) 1 0.000024 0.000010 if isdirectory(ctrlp#utils#mkdir(a:0 ? a:1 : s:cache_dir)) 1 0.000354 sil! cal writefile(a:lines, a:0 >= 2 ? a:2 : ctrlp#utils#cachefile()) 1 0.000002 en FUNCTION <SNR>83_GetMSL() Called 4 times Total time: 0.001107 Self time: 0.000229 count total (s) self (s) " Start on the line we're at and use its indent. 4 0.000007 let msl = a:lnum 4 0.000727 0.000015 let lnum = s:PrevNonBlankNonString(a:lnum - 1) 4 0.000007 while lnum > 0 " If we have a continuation line, or we're in a string, use line as MSL. " Otherwise, terminate search as we have found our MSL already. 4 0.000008 let line = getline(lnum) 4 0.000096 let col = match(line, s:msl_regex) + 1 4 0.000197 0.000031 if (col > 0 && !s:IsInStringOrComment(lnum, col)) || s:IsInString(lnum, strlen(line)) let msl = lnum else " Don't use lines that are part of a one line scope as msl unless the " flag in_one_line_scope is set to 1 " 4 0.000006 if a:in_one_line_scope 4 0.000002 break end let msl_one_line = s:Match(lnum, s:one_line_scope_regex) if msl_one_line == 0 break endif endif let lnum = s:PrevNonBlankNonString(lnum - 1) endwhile 4 0.000003 return msl FUNCTION <SNR>60_HasEligibleBuffers() Called 1 time Total time: 0.000387 Self time: 0.000035 count total (s) self (s) 1 0.000090 0.000005 call <SID>DEBUG('Entering HasEligibleBuffers()',10) 1 0.000004 let l:found = len(s:BufList) 1 0.000002 let l:needed = g:miniBufExplBuffersNeeded 1 0.000094 0.000007 call <SID>DEBUG('Eligible buffers are '.string(s:BufList),6) 1 0.000093 0.000008 call <SID>DEBUG('Found '.l:found.' eligible buffers of '.l:needed.' needed',6) 1 0.000100 0.000005 call <SID>DEBUG('Leaving HasEligibleBuffers()',10) 1 0.000002 return (l:found >= l:needed) FUNCTION <SNR>63_chop() Called 1 time Total time: 0.000011 Self time: 0.000011 count total (s) self (s) 1 0.000010 if len(a:mrufs) > {s:max} | cal remove(a:mrufs, {s:max}, -1) | en 1 0.000001 retu a:mrufs FUNCTION <SNR>60_FindWindow() Called 1 time Total time: 0.000373 Self time: 0.000092 count total (s) self (s) 1 0.000002 if a:doDebug 1 0.000102 0.000008 call <SID>DEBUG('Entering FindWindow('.a:bufName.','.a:doDebug.')',10) 1 0.000001 endif " Try to find an existing window that contains " our buffer. 1 0.000050 let l:winnr = bufwinnr(a:bufName) 1 0.000002 if l:winnr != -1 if a:doDebug call <SID>DEBUG('Found window '.l:winnr.' with buffer ('.winbufnr(l:winnr).' : '.bufname(winbufnr(l:winnr)).')',9) endif else 1 0.000002 if a:doDebug 1 0.000099 0.000007 call <SID>DEBUG('Can not find window with buffer ('.a:bufName.')',9) 1 0.000001 endif 1 0.000001 endif 1 0.000001 if a:doDebug 1 0.000100 0.000005 call <SID>DEBUG('Leaving FindWindow()',10) 1 0.000001 endif 1 0.000002 return l:winnr FUNCTION <SNR>83_IsLineComment() Called 2 times Total time: 0.000152 Self time: 0.000152 count total (s) self (s) 2 0.000150 return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_linecom FUNCTION <SNR>88_BufferTextChangedSinceLastMoveInInsertMode() Called 26 times Total time: 0.000512 Self time: 0.000512 count total (s) self (s) 26 0.000041 if s:moved_vertically_in_insert_mode let s:previous_num_chars_on_current_line = -1 return 0 endif 26 0.000088 let num_chars_in_current_cursor_line = strlen( getline('.') ) 26 0.000044 if s:previous_num_chars_on_current_line == -1 1 0.000003 let s:previous_num_chars_on_current_line = num_chars_in_current_cursor_line 1 0.000001 return 0 endif 25 0.000070 let changed_text_on_current_line = num_chars_in_current_cursor_line != s:previous_num_chars_on_current_line 25 0.000051 let s:previous_num_chars_on_current_line = num_chars_in_current_cursor_line 25 0.000028 return changed_text_on_current_line FUNCTION <SNR>60_DEBUG() Called 17 times Total time: 0.001595 Self time: 0.001595 count total (s) self (s) 17 0.000044 if g:miniBufExplDebugLevel >= a:level 1 0.000002 if a:level == 10 && a:msg =~ '^Entering' let g:miniBufExplFuncCallDepth += 1 endif 1 0.000006 if a:msg =~ '^Entering' let l:msg = repeat('│ ',g:miniBufExplFuncCallDepth - 1).'┌ '.a:msg elseif a:msg =~ '^Leaving' let l:msg = repeat('│ ',g:miniBufExplFuncCallDepth - 1).'└ '.a:msg else 1 0.000004 let l:msg = repeat('│ ',g:miniBufExplFuncCallDepth).a:msg 1 0.000000 endif " Prevent a report of our actions from showing up. 1 0.000003 let l:save_rep = &report 1 0.000003 let l:save_sc = &showcmd 1 0.000006 let &report = 10000 1 0.000005 set noshowcmd " Debug output to a buffer 1 0.000002 if g:miniBufExplDebugMode == 0 if bufname('%') == 'MiniBufExplorer.DBG' return endif " Get into the debug window or create it if needed let l:winNum = <SID>FindCreateWindow('MiniBufExplorer.DBG', 0, 1, 1, 1, 0) if l:winNum == -1 let g:miniBufExplDebugMode == 3 call <SID>DEBUG('Failed to get the MBE debugging window, reset debugging mode to 3.',1) call <SID>DEBUG('Forwarding message...',1) call <SID>DEBUG(a:msg,1) call <SID>DEBUG('Forwarding message end.',1) return endif " Save the current window number so we can come back here let l:currWin = winnr() call s:SwitchWindow('p',1) " Change to debug window call s:SwitchWindow('w',1,l:winNum) " Make sure we really got to our window, if not we " will display a confirm dialog and turn debugging " off so that we won't break things even more. if bufname('%') != 'MiniBufExplorer.DBG' call confirm('Error in window debugging code. Dissabling MiniBufExplorer debugging.', 'OK') let g:miniBufExplDebugLevel = 0 return endif set modified " Write Message to DBG buffer let res=append("$",s:debugIndex.':'.a:level.':'.a:msg) set nomodified norm G " Return to original window call s:SwitchWindow('p',1) call s:SwitchWindow('w',1,l:currWin) " Debug output using VIM's echo facility elseif g:miniBufExplDebugMode == 1 echo s:debugIndex.':'.a:level.':'.a:msg " Debug output to a file -- VERY SLOW!!! " should be OK on UNIX and Win32 (not the 95/98 variants) elseif g:miniBufExplDebugMode == 2 if has('system') || has('fork') if has('win32') && !has('win95') let l:result = system("cmd /c 'echo ".s:debugIndex.':'.a:level.':'.a:msg." >> MiniBufExplorer.DBG'") endif if has('unix') let l:result = system("echo '".s:debugIndex.':'.a:level.':'.a:msg." >> MiniBufExplorer.DBG'") endif else call confirm('Error in file writing version of the debugging code, vim not compiled with system or fork. Dissabling MiniBufExplorer debugging.', 'OK') let g:miniBufExplDebugLevel = 0 endif elseif g:miniBufExplDebugMode == 3 1 0.000007 let g:miniBufExplDebugOutput = g:miniBufExplDebugOutput."\n".s:debugIndex."\t".':'.a:level."\t".':'.l:msg 1 0.000001 endif 1 0.000003 let s:debugIndex = s:debugIndex + 1 1 0.000002 if a:level == 10 && a:msg =~ '^Leaving' let g:miniBufExplFuncCallDepth -= 1 endif 1 0.000003 let &report = l:save_rep 1 0.000003 let &showcmd = l:save_sc 1 0.000001 endif FUNCTION <SNR>88_OnCursorMovedInsertMode() Called 26 times Total time: 0.006551 Self time: 0.000715 count total (s) self (s) 26 0.000548 0.000085 if !s:AllowedToCompleteInCurrentFile() return endif 26 0.000437 0.000085 call s:UpdateCursorMoved() " Basically, we need to only trigger the completion menu when the user has " inserted or deleted a character, NOT just when the user moves in insert mode " (with, say, the arrow keys). If we trigger the menu even on pure moves, then " it's impossible to move in insert mode since the up/down arrows start moving " the selected completion in the completion menu. Yeah, people shouldn't be " moving in insert mode at all (that's what normal mode is for) but explain " that to the users who complain... 26 0.000614 0.000102 if !s:BufferTextChangedSinceLastMoveInInsertMode() 1 0.000000 return endif 25 0.001162 0.000088 call s:IdentifierFinishedOperations() 25 0.000042 if g:ycm_autoclose_preview_window_after_completion call s:ClosePreviewWindowIfNeeded() endif 25 0.003527 0.000092 call s:InvokeCompletion() FUNCTION <SNR>88_CompletionsForQuery() Called 12 times Total time: 0.003877 Self time: 0.003877 count total (s) self (s) 12 0.000013 if a:use_filetype_completer py completer = ycm_state.GetFiletypeCompleter() else 12 0.000503 py completer = ycm_state.GetGeneralCompleter() 12 0.000012 endif 12 0.001627 py completer.CandidatesForQueryAsync( vim.eval( 'a:query' ), int( vim.eval( 'a:completion_start_column' ) ) ) 12 0.000043 let l:results_ready = 0 27 0.000039 while !l:results_ready 22 0.000589 let l:results_ready = pyeval( 'completer.AsyncCandidateRequestReady()' ) 22 0.000182 if complete_check() 7 0.000017 let s:searched_and_results_found = 0 7 0.000021 return { 'words' : [], 'refresh' : 'always'} endif 15 0.000013 endwhile 5 0.000613 let l:results = pyeval( 'base.AdjustCandidateInsertionText( completer.CandidatesFromStoredRequest() )' ) 5 0.000024 let s:searched_and_results_found = len( l:results ) != 0 5 0.000015 return { 'words' : l:results, 'refresh' : 'always' } FUNCTION <SNR>34_diff_window_count() Called 1 time Total time: 0.000021 Self time: 0.000021 count total (s) self (s) 1 0.000003 let c = 0 2 0.000007 for nr in range(1,winnr('$')) 1 0.000005 let c += getwinvar(nr,'&diff') 1 0.000001 endfor 1 0.000002 return c FUNCTION <SNR>88_OnBlankLine() Called 25 times Total time: 0.000804 Self time: 0.000804 count total (s) self (s) 25 0.000783 return pyeval( 'not vim.current.line or vim.current.line.isspace()' ) FUNCTION <SNR>83_InOneLineScope() Called 1 time Total time: 0.000247 Self time: 0.000013 count total (s) self (s) 1 0.000224 0.000005 let msl = s:GetMSL(a:lnum, 1) 1 0.000020 0.000005 if msl > 0 && s:Match(msl, s:one_line_scope_regex) return msl endif 1 0.000000 return 0 FUNCTION <SNR>83_IsInStringOrComment() Called 9 times Total time: 0.000625 Self time: 0.000625 count total (s) self (s) 9 0.000620 return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_strcom FUNCTION <SNR>83_ExitingOneLineScope() Called 1 time Total time: 0.000443 Self time: 0.000025 count total (s) self (s) 1 0.000213 0.000005 let msl = s:GetMSL(a:lnum, 1) 1 0.000001 if msl > 0 " if the current line is in a one line scope .. 1 0.000019 0.000005 if s:Match(msl, s:one_line_scope_regex) return 0 else 1 0.000187 0.000004 let prev_msl = s:GetMSL(msl - 1, 1) 1 0.000018 0.000005 if s:Match(prev_msl, s:one_line_scope_regex) return prev_msl endif 1 0.000000 endif 1 0.000001 endif 1 0.000000 return 0 FUNCTION <SNR>88_InvokeCompletion() Called 25 times Total time: 0.003435 Self time: 0.000720 count total (s) self (s) 25 0.000063 if &completefunc != "youcompleteme#Complete" return endif 25 0.002997 0.000282 if s:InsideCommentOrStringAndShouldStop() || s:OnBlankLine() return endif " This is tricky. First, having 'refresh' set to 'always' in the dictionary " that our completion function returns makes sure that our completion function " is called on every keystroke. Second, when the sequence of characters the " user typed produces no results in our search an infinite loop can occur. The " problem is that our feedkeys call triggers the OnCursorMovedI event which we " are tied to. We prevent this infinite loop from starting by making sure that " the user has moved the cursor since the last time we provided completion " results. 25 0.000042 if !s:cursor_moved return endif " <c-x><c-u> invokes the user's completion function (which we have set to " youcompleteme#Complete), and <c-p> tells Vim to select the previous " completion candidate. This is necessary because by default, Vim selects the " first candidate when completion is invoked, and selecting a candidate " automatically replaces the current text with it. Calling <c-p> forces Vim to " deselect the first candidate and in turn preserve the user's current text " until he explicitly chooses to replace it with a completion. 25 0.000128 call feedkeys( "\<C-X>\<C-U>\<C-P>", 'n' ) FUNCTION <SNR>88_OnInsertEnter() Called 1 time Total time: 0.000031 Self time: 0.000011 count total (s) self (s) 1 0.000026 0.000006 if !s:AllowedToCompleteInCurrentFile() return endif 1 0.000002 let s:old_cursor_position = [] FUNCTION <SNR>88_IdentifierFinishedOperations() Called 25 times Total time: 0.001074 Self time: 0.001074 count total (s) self (s) 25 0.000747 if !pyeval( 'base.CurrentIdentifierFinished()' ) 22 0.000029 return endif 3 0.000251 py ycm_state.OnCurrentIdentifierFinished() 3 0.000009 let s:omnifunc_mode = 0 FUNCTION <SNR>88_InsideCommentOrString() Called 25 times Total time: 0.001602 Self time: 0.001602 count total (s) self (s) " Has to be col('.') -1 because col('.') doesn't exist at this point. We are " in insert mode when this func is called. 25 0.001356 let syntax_group = synIDattr( synIDtrans( synID( line( '.' ), col( '.' ) - 1, 1 ) ), 'name') 25 0.000070 if stridx(syntax_group, 'Comment') > -1 return 1 endif 25 0.000041 if stridx(syntax_group, 'String') > -1 return 2 endif 25 0.000018 return 0 FUNCTION <SNR>83_IndentWithContinuation() Called 1 time Total time: 0.000561 Self time: 0.000031 count total (s) self (s) " Set up variables to use and search for MSL to the previous line. 1 0.000002 let p_lnum = a:lnum 1 0.000502 0.000005 let lnum = s:GetMSL(a:lnum, 1) 1 0.000002 let line = getline(lnum) " If the previous line wasn't a MSL and is continuation return its indent. " TODO: the || s:IsInString() thing worries me a bit. 1 0.000001 if p_lnum != lnum if s:Match(p_lnum,s:continuation_regex)||s:IsInString(p_lnum,strlen(line)) return a:ind endif endif " Set up more variables now that we know we aren't continuation bound. 1 0.000002 let msl_ind = indent(lnum) " If the previous line ended with [*+/.-=], start a continuation that " indents an extra level. 1 0.000037 0.000004 if s:Match(lnum, s:continuation_regex) if lnum == p_lnum return msl_ind + a:width else return msl_ind endif endif 1 0.000001 return a:ind FUNCTION ctrlp#utils#readfile() Called 1 time Total time: 0.000121 Self time: 0.000121 count total (s) self (s) 1 0.000014 if filereadable(a:file) 1 0.000095 let data = readfile(a:file) 1 0.000005 if empty(data) || type(data) != 3 unl data let data = [] en 1 0.000001 retu data en retu [] FUNCTION <SNR>72_Highlight_Matching_Pair() Called 28 times Total time: 0.003572 Self time: 0.003572 count total (s) self (s) " Remove any previous match. 28 0.000102 if exists('w:paren_hl_on') && w:paren_hl_on 3match none let w:paren_hl_on = 0 endif " Avoid that we remove the popup menu. " Return when there are no colors (looks like the cursor jumps). 28 0.000098 if pumvisible() || (&t_Co < 8 && !has("gui_running")) return endif " Get the character under the cursor and check if it's in 'matchpairs'. 28 0.000082 let c_lnum = line('.') 28 0.000059 let c_col = col('.') 28 0.000031 let before = 0 28 0.000103 let c = getline(c_lnum)[c_col - 1] 28 0.000388 let plist = split(&matchpairs, '.\zs[:,]') 28 0.000110 let i = index(plist, c) 28 0.000029 if i < 0 " not found, in Insert mode try character before the cursor 28 0.000078 if c_col > 1 && (mode() == 'i' || mode() == 'R') 26 0.000030 let before = 1 26 0.000069 let c = getline(c_lnum)[c_col - 2] 26 0.000065 let i = index(plist, c) 26 0.000012 endif 28 0.000020 if i < 0 " not found, nothing to do 27 0.000024 return endif 1 0.000000 endif " Figure out the arguments for searchpairpos(). 1 0.000001 if i % 2 == 0 let s_flags = 'nW' let c2 = plist[i + 1] else 1 0.000001 let s_flags = 'nbW' 1 0.000001 let c2 = c 1 0.000002 let c = plist[i - 1] 1 0.000000 endif 1 0.000001 if c == '[' let c = '\[' let c2 = '\]' endif " Find the match. When it was just before the cursor move it there for a " moment. 1 0.000001 if before > 0 1 0.000003 let save_cursor = winsaveview() 1 0.000003 call cursor(c_lnum, c_col - before) 1 0.000001 endif " When not in a string or comment ignore matches inside them. " We match "escape" for special items, such as lispEscapeSpecial. 1 0.000002 let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' . '=~? "string\\|character\\|singlequote\\|escape\\|comment"' 1 0.000058 execute 'if' s_skip '| let s_skip = 0 | endif' " Limit the search to lines visible in the window. 1 0.000002 let stoplinebottom = line('w$') 1 0.000002 let stoplinetop = line('w0') 1 0.000001 if i % 2 == 0 let stopline = stoplinebottom else 1 0.000002 let stopline = stoplinetop 1 0.000000 endif " Limit the search time to 300 msec to avoid a hang on very long lines. " This fails when a timeout is not supported. 1 0.000002 if mode() == 'i' || mode() == 'R' 1 0.000004 let timeout = exists("b:matchparen_insert_timeout") ? b:matchparen_insert_timeout : g:matchparen_insert_timeout 1 0.000000 else let timeout = exists("b:matchparen_timeout") ? b:matchparen_timeout : g:matchparen_timeout endif 1 0.000001 try 1 0.001759 let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, timeout) 1 0.000002 catch /E118/ " Can't use the timeout, restrict the stopline a bit more to avoid taking " a long time on closed folds and long lines. " The "viewable" variables give a range in which we can scroll while " keeping the cursor at the same position. " adjustedScrolloff accounts for very large numbers of scrolloff. let adjustedScrolloff = min([&scrolloff, (line('w$') - line('w0')) / 2]) let bottom_viewable = min([line('$'), c_lnum + &lines - adjustedScrolloff - 2]) let top_viewable = max([1, c_lnum-&lines+adjustedScrolloff + 2]) " one of these stoplines will be adjusted below, but the current values are " minimal boundaries within the current window if i % 2 == 0 if has("byte_offset") && has("syntax_items") && &smc > 0 let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2]) let stopline = min([bottom_viewable, byte2line(stopbyte)]) else let stopline = min([bottom_viewable, c_lnum + 100]) endif let stoplinebottom = stopline else if has("byte_offset") && has("syntax_items") && &smc > 0 let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2]) let stopline = max([top_viewable, byte2line(stopbyte)]) else let stopline = max([top_viewable, c_lnum - 100]) endif let stoplinetop = stopline endif let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline) endtry 1 0.000001 if before > 0 1 0.000016 call winrestview(save_cursor) 1 0.000001 endif " If a match is found setup match highlighting. 1 0.000002 if m_lnum > 0 && m_lnum >= stoplinetop && m_lnum <= stoplinebottom exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) . 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/' let w:paren_hl_on = 1 endif FUNCTION <SNR>88_InsideCommentOrStringAndShouldStop() Called 25 times Total time: 0.001911 Self time: 0.000309 count total (s) self (s) 25 0.001702 0.000100 let retval = s:InsideCommentOrString() 25 0.000048 let inside_comment = retval == 1 25 0.000032 let inside_string = retval == 2 25 0.000050 if inside_comment && g:ycm_complete_in_comments || inside_string && g:ycm_complete_in_strings return 0 endif 25 0.000019 return retval FUNCTION GetJavascriptIndent() Called 1 time Total time: 0.002010 Self time: 0.000220 count total (s) self (s) " 3.1. Setup {{{2 " ---------- " Set up variables for restoring position in file. Could use v:lnum here. 1 0.000011 let vcol = col('.') " 3.2. Work on the current line {{{2 " ----------------------------- 1 0.000002 let ind = -1 " Get the current line. 1 0.000004 let line = getline(v:lnum) " previous nonblank line number 1 0.000004 let prevline = prevnonblank(v:lnum - 1) " If we got a closing bracket on an empty line, find its match and indent " according to it. For parentheses we indent to its column - 1, for the " others we indent to the containing line's MSL's level. Return -1 if fail. 1 0.000010 let col = matchend(line, '^\s*[],})]') 1 0.000004 if col > 0 && !s:IsInStringOrComment(v:lnum, col) call cursor(v:lnum, col) let lvar = s:InMultiVarStatement(v:lnum) if lvar let prevline_contents = s:RemoveTrailingComments(getline(prevline)) " check for comma first if (line[col - 1] =~ ',') " if the previous line ends in comma or semicolon don't indent if (prevline_contents =~ '[;,]\s*$') return indent(s:GetMSL(line('.'), 0)) " get previous line indent, if it's comma first return prevline indent elseif (prevline_contents =~ s:comma_first) return indent(prevline) " otherwise we indent 1 level else return indent(lvar) + &sw endif endif endif let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2) if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0 if line[col-1]==')' && col('.') != col('$') - 1 let ind = virtcol('.')-1 else let ind = indent(s:GetMSL(line('.'), 0)) endif endif return ind endif " If the line is comma first, dedent 1 level 1 0.000006 if (getline(prevline) =~ s:comma_first) return indent(prevline) - &sw endif 1 0.000003 if (line =~ s:ternary) if (getline(prevline) =~ s:ternary_q) return indent(prevline) else return indent(prevline) + &sw endif endif " If we are in a multi-line comment, cindent does the right thing. 1 0.000031 0.000010 if s:IsInMultilineComment(v:lnum, 1) && !s:IsLineComment(v:lnum, 1) return cindent(v:lnum) endif " Check for multiple var assignments " let var_indent = s:GetVarIndent(v:lnum) " if var_indent >= 0 " return var_indent " endif " 3.3. Work on the previous line. {{{2 " ------------------------------- " If the line is empty and the previous nonblank line was a multi-line " comment, use that comment's indent. Deduct one char to account for the " space in ' */'. 1 0.000210 0.000006 if line =~ '^\s*$' && s:IsInMultilineComment(prevline, 1) return indent(prevline) - 1 endif " Find a non-blank, non-multi-line string line above the current line. 1 0.000113 0.000008 let lnum = s:PrevNonBlankNonString(v:lnum - 1) " If the line is empty and inside a string, use the previous line. 1 0.000005 if line =~ '^\s*$' && lnum != prevline return indent(prevnonblank(v:lnum)) endif " At the start of the file use zero indent. 1 0.000001 if lnum == 0 return 0 endif " Set up variables for current line. 1 0.000002 let line = getline(lnum) 1 0.000002 let ind = indent(lnum) " If the previous line ended with a block opening, add a level of indent. 1 0.000028 0.000006 if s:Match(lnum, s:block_regex) return indent(s:GetMSL(lnum, 0)) + &sw endif " If the previous line contained an opening bracket, and we are still in it, " add indent depending on the bracket type. 1 0.000005 if line =~ '[[({]' 1 0.000194 0.000007 let counts = s:LineHasOpeningBrackets(lnum) 1 0.000004 if counts[0] == '1' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 if col('.') + 1 == col('$') return ind + &sw else return virtcol('.') endif elseif counts[1] == '1' || counts[2] == '1' return ind + &sw else 1 0.000004 call cursor(v:lnum, vcol) 1 0.000000 end 1 0.000001 endif " 3.4. Work on the MSL line. {{{2 " -------------------------- 1 0.000001 let ind_con = ind 1 0.000573 0.000012 let ind = s:IndentWithContinuation(lnum, ind_con, &sw) " }}}2 " " 1 0.000254 0.000007 let ols = s:InOneLineScope(lnum) 1 0.000001 if ols > 0 let ind = ind + &sw else 1 0.000449 0.000006 let ols = s:ExitingOneLineScope(lnum) 1 0.000002 while ols > 0 && ind > 0 let ind = ind - &sw let ols = s:InOneLineScope(ols - 1) endwhile 1 0.000000 endif 1 0.000001 return ind FUNCTION <SNR>60_NextNormalWindow() Called 1 time Total time: 0.000771 Self time: 0.000084 count total (s) self (s) 1 0.000125 0.000010 call <SID>DEBUG('Entering NextNormalWindow()',10) 1 0.000003 let l:winSum = winnr('$') 1 0.000118 0.000006 call <SID>DEBUG('Total number of open windows are '.l:winSum,9) 1 0.000001 let l:i = 1 2 0.000004 while(l:i <= l:winSum) 1 0.000095 0.000011 call <SID>DEBUG('window: '.l:i.', buffer: ('.winbufnr(l:i).':'.bufname(winbufnr(l:i)).')',9) 1 0.000214 0.000010 if !<SID>IsBufferIgnored(winbufnr(l:i)) && l:i != winnr() call <SID>DEBUG('Found window '.l:i,8) call <SID>DEBUG('Leaving NextNormalWindow()',10) return l:i endif 1 0.000002 let l:i = l:i + 1 1 0.000001 endwhile 1 0.000093 0.000004 call <SID>DEBUG('Found no window',8) 1 0.000087 0.000004 call <SID>DEBUG('Leaving NextNormalWindow()',10) 1 0.000002 return -1 FUNCTION <SNR>88_OnCursorMovedNormalMode() Called 1 time Total time: 0.000107 Self time: 0.000017 count total (s) self (s) 1 0.000026 0.000005 if !s:AllowedToCompleteInCurrentFile() return endif 1 0.000052 0.000005 call s:UpdateDiagnosticNotifications() 1 0.000028 0.000006 call s:OnFileReadyToParse() FUNCTION <SNR>83_LineHasOpeningBrackets() Called 1 time Total time: 0.000187 Self time: 0.000118 count total (s) self (s) 1 0.000002 let open_0 = 0 1 0.000001 let open_2 = 0 1 0.000001 let open_4 = 0 1 0.000002 let line = getline(a:lnum) 1 0.000006 let pos = match(line, '[][(){}]', 0) 5 0.000004 while pos != -1 4 0.000085 0.000016 if !s:IsInStringOrComment(a:lnum, pos + 1) 4 0.000013 let idx = stridx('(){}[]', line[pos]) 4 0.000005 if idx % 2 == 0 2 0.000007 let open_{idx} = open_{idx} + 1 2 0.000001 else 2 0.000007 let open_{idx - 1} = open_{idx - 1} - 1 2 0.000000 endif 4 0.000003 endif 4 0.000021 let pos = match(line, '[][(){}]', pos + 1) 4 0.000009 endwhile 1 0.000003 return (open_0 > 0) . (open_2 > 0) . (open_4 > 0) FUNCTION <SNR>56_QuitPreHook() Called 1 time Total time: 0.000035 Self time: 0.000030 count total (s) self (s) 1 0.000010 let b:syntastic_skip_checks = !g:syntastic_check_on_wq 1 0.000022 0.000017 call g:SyntasticLoclistHide() FUNCTION ctrlp#utils#mkdir() Called 1 time Total time: 0.000014 Self time: 0.000014 count total (s) self (s) 1 0.000007 if exists('*mkdir') && !isdirectory(a:dir) sil! cal mkdir(a:dir, 'p') en 1 0.000002 retu a:dir FUNCTION 25() Called 57 times Total time: 0.000610 Self time: 0.000610 count total (s) self (s) 57 0.000235 if !exists("b:syntastic_loclist") let b:syntastic_loclist = g:SyntasticLoclist.New([]) endif 57 0.000088 return b:syntastic_loclist FUNCTIONS SORTED ON TOTAL TIME count total (s) self (s) function 50 0.009423 0.005546 youcompleteme#Complete() 26 0.006551 0.000715 <SNR>88_OnCursorMovedInsertMode() 12 0.003877 <SNR>88_CompletionsForQuery() 28 0.003572 <SNR>72_Highlight_Matching_Pair() 25 0.003435 0.000720 <SNR>88_InvokeCompletion() 27 0.003091 UltiSnips_CursorMoved() 1 0.002010 0.000220 GetJavascriptIndent() 25 0.001911 0.000309 <SNR>88_InsideCommentOrStringAndShouldStop() 25 0.001602 <SNR>88_InsideCommentOrString() 17 0.001595 <SNR>60_DEBUG() 1 0.001112 0.000040 <SNR>60_StopExplorer() 4 0.001107 0.000229 <SNR>83_GetMSL() 25 0.001074 <SNR>88_IdentifierFinishedOperations() 5 0.000817 0.000261 <SNR>83_PrevNonBlankNonString() 25 0.000804 <SNR>88_OnBlankLine() 1 0.000771 0.000084 <SNR>60_NextNormalWindow() 1 0.000651 0.000505 <SNR>63_mergelists() 9 0.000625 <SNR>83_IsInStringOrComment() 57 0.000610 25() 1 0.000561 0.000031 <SNR>83_IndentWithContinuation() FUNCTIONS SORTED ON SELF TIME count total (s) self (s) function 50 0.009423 0.005546 youcompleteme#Complete() 12 0.003877 <SNR>88_CompletionsForQuery() 28 0.003572 <SNR>72_Highlight_Matching_Pair() 27 0.003091 UltiSnips_CursorMoved() 25 0.001602 <SNR>88_InsideCommentOrString() 17 0.001595 <SNR>60_DEBUG() 25 0.001074 <SNR>88_IdentifierFinishedOperations() 25 0.000804 <SNR>88_OnBlankLine() 25 0.003435 0.000720 <SNR>88_InvokeCompletion() 26 0.006551 0.000715 <SNR>88_OnCursorMovedInsertMode() 9 0.000625 <SNR>83_IsInStringOrComment() 57 0.000610 25() 30 0.000558 <SNR>88_AllowedToCompleteInCurrentFile() 26 0.000512 <SNR>88_BufferTextChangedSinceLastMoveInInsertMode() 1 0.000651 0.000505 <SNR>63_mergelists() 1 0.000381 0.000367 ctrlp#utils#writecache() 26 0.000352 <SNR>88_UpdateCursorMoved() 25 0.001911 0.000309 <SNR>88_InsideCommentOrStringAndShouldStop() 5 0.000817 0.000261 <SNR>83_PrevNonBlankNonString() 4 0.001107 0.000229 <SNR>83_GetMSL() This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,1027 @@ FUNCTION <SNR>63_file() Called 4 times Total time: 0.000010 Self time: 0.000010 count total (s) self (s) 4 0.000009 return s:file FUNCTION 34() Called 110 times Total time: 0.000419 Self time: 0.000419 count total (s) self (s) 110 0.000204 if self._hasErrorsOrWarningsToDisplay >= 0 110 0.000150 return self._hasErrorsOrWarningsToDisplay endif let self._hasErrorsOrWarningsToDisplay = empty(self._rawLoclist) ? 0 : (!self._quietWarnings || len(self.errors())) return self._hasErrorsOrWarningsToDisplay FUNCTION <SNR>59_HasEligibleBuffers() Called 1 time Total time: 0.000426 Self time: 0.000041 count total (s) self (s) 1 0.000102 0.000006 call <SID>DEBUG('Entering HasEligibleBuffers()',10) 1 0.000004 let l:found = len(s:BufList) 1 0.000007 let l:needed = g:miniBufExplBuffersNeeded 1 0.000105 0.000007 call <SID>DEBUG('Eligible buffers are '.string(s:BufList),6) 1 0.000102 0.000007 call <SID>DEBUG('Found '.l:found.' eligible buffers of '.l:needed.' needed',6) 1 0.000101 0.000005 call <SID>DEBUG('Leaving HasEligibleBuffers()',10) 1 0.000002 return (l:found >= l:needed) FUNCTION <SNR>59_ListPop() Called 1 time Total time: 0.000218 Self time: 0.000023 count total (s) self (s) 1 0.000107 0.000009 call <SID>DEBUG('Entering ListPop('.string(a:list).','.a:val.')',10) 1 0.000009 call filter(a:list, 'v:val != '.a:val) 1 0.000101 0.000004 call <SID>DEBUG('Leaving ListPop()',10) FUNCTION <SNR>86_InvokeCompletion() Called 49 times Total time: 0.013817 Self time: 0.001178 count total (s) self (s) 49 0.000124 if &completefunc != "youcompleteme#Complete" return endif 49 0.012963 0.000324 if s:InsideCommentOrStringAndShouldStop() || s:OnBlankLine() return endif " This is tricky. First, having 'refresh' set to 'always' in the dictionary " that our completion function returns makes sure that our completion function " is called on every keystroke. Second, when the sequence of characters the " user typed produces no results in our search an infinite loop can occur. The " problem is that our feedkeys call triggers the OnCursorMovedI event which we " are tied to. We prevent this infinite loop from starting by making sure that " the user has moved the cursor since the last time we provided completion " results. 49 0.000065 if !s:cursor_moved return endif " <c-x><c-u> invokes the user's completion function (which we have set to " youcompleteme#Complete), and <c-p> tells Vim to select the previous " completion candidate. This is necessary because by default, Vim selects the " first candidate when completion is invoked, and selecting a candidate " automatically replaces the current text with it. Calling <c-p> forces Vim to " deselect the first candidate and in turn preserve the user's current text " until he explicitly chooses to replace it with a completion. 49 0.000232 call feedkeys( "\<C-X>\<C-U>\<C-P>", 'n' ) FUNCTION <SNR>63_exists_file() Called 2 times Total time: 0.000037 Self time: 0.000033 count total (s) self (s) 2 0.000037 0.000033 return filereadable(s:file()) FUNCTION <SNR>59_IsBufferIgnored() Called 1 time Total time: 0.000247 Self time: 0.000054 count total (s) self (s) 1 0.000103 0.000007 call <SID>DEBUG('Entering IsBufferIgnored('.a:buf.')',10) " Skip unlisted buffers. 1 0.000005 if buflisted(a:buf) == 0 || index(s:BufList,a:buf) == -1 call <SID>DEBUG('Buffer '.a:buf.' is unlisted, ignoring...',5) call <SID>DEBUG('Leaving IsBufferIgnored()',10) return 1 endif " Skip non normal buffers. 1 0.000004 if getbufvar(a:buf, "&buftype") != '' call <SID>DEBUG('Buffer '.a:buf.' is not normal, ignoring...',5) call <SID>DEBUG('Leaving IsBufferIgnored()',10) return 1 endif 1 0.000102 0.000005 call <SID>DEBUG('Leaving IsBufferIgnored()',10) 1 0.000017 return 0 FUNCTION UltiSnips_CursorMoved() Called 75 times Total time: 0.007262 Self time: 0.007262 count total (s) self (s) 75 0.007195 exec g:_uspy "UltiSnips_Manager.cursor_moved()" FUNCTION <SNR>86_IdentifierFinishedOperations() Called 49 times Total time: 0.002039 Self time: 0.002039 count total (s) self (s) 49 0.001362 if !pyeval( 'base.CurrentIdentifierFinished()' ) 42 0.000048 return endif 7 0.000562 py ycm_state.OnCurrentIdentifierFinished() 7 0.000019 let s:omnifunc_mode = 0 FUNCTION <SNR>63_is_in_a_git_repo() Called 2 times Total time: 0.022168 Self time: 0.000145 count total (s) self (s) 2 0.000117 0.000029 let cmd = s:escape('git rev-parse' . s:discard_stdout_and_stderr()) 2 0.022030 0.000095 call system(s:command_in_directory_of_file(cmd)) 2 0.000016 return !v:shell_error FUNCTION <SNR>86_UpdateCursorMoved() Called 74 times Total time: 0.000972 Self time: 0.000972 count total (s) self (s) 74 0.000202 let current_position = getpos('.') 74 0.000186 let s:cursor_moved = current_position != s:old_cursor_position 74 0.000326 let s:moved_vertically_in_insert_mode = s:old_cursor_position != [] && current_position[ 1 ] != s:old_cursor_position[ 1 ] 74 0.000136 let s:old_cursor_position = current_position FUNCTION youcompleteme#Complete() Called 98 times Total time: 0.021118 Self time: 0.009485 count total (s) self (s) " After the user types one character after the call to the omnifunc, the " completefunc will be called because of our mapping that calls the " completefunc on every keystroke. Therefore we need to delegate the call we " 'stole' back to the omnifunc 98 0.000257 if s:omnifunc_mode return youcompleteme#OmniComplete( a:findstart, a:base ) endif 98 0.000102 if a:findstart " InvokeCompletion has this check but we also need it here because of random " Vim bugs and unfortunate interactions with the autocommands of other " plugins 61 0.000065 if !s:cursor_moved " for vim, -2 means not found but don't trigger an error message " see :h complete-functions return -2 endif " TODO: make this a function-local variable instead of a script-local one 61 0.001792 let s:completion_start_column = pyeval( 'base.CompletionStartColumn()' ) 61 0.003215 let s:should_use_filetype_completion = pyeval( 'ycm_state.ShouldUseFiletypeCompleter(' . s:completion_start_column . ')' ) 61 0.002209 if !s:should_use_filetype_completion && !pyeval( 'ycm_state.ShouldUseGeneralCompleter(' . s:completion_start_column . ')' ) " for vim, -2 means not found but don't trigger an error message " see :h complete-functions 24 0.000035 return -2 endif 37 0.000067 return s:completion_start_column else 37 0.011899 0.000266 return s:CompletionsForQuery( a:base, s:should_use_filetype_completion, s:completion_start_column ) endif FUNCTION <SNR>71_Highlight_Matching_Pair() Called 76 times Total time: 0.014312 Self time: 0.014312 count total (s) self (s) " Remove any previous match. 76 0.000256 if exists('w:paren_hl_on') && w:paren_hl_on 3match none let w:paren_hl_on = 0 endif " Avoid that we remove the popup menu. " Return when there are no colors (looks like the cursor jumps). 76 0.000250 if pumvisible() || (&t_Co < 8 && !has("gui_running")) return endif " Get the character under the cursor and check if it's in 'matchpairs'. 76 0.000220 let c_lnum = line('.') 76 0.000157 let c_col = col('.') 76 0.000085 let before = 0 76 0.000295 let c = getline(c_lnum)[c_col - 1] 76 0.000995 let plist = split(&matchpairs, '.\zs[:,]') 76 0.000216 let i = index(plist, c) 76 0.000080 if i < 0 " not found, in Insert mode try character before the cursor 76 0.000199 if c_col > 1 && (mode() == 'i' || mode() == 'R') 74 0.000096 let before = 1 74 0.000210 let c = getline(c_lnum)[c_col - 2] 74 0.000160 let i = index(plist, c) 74 0.000042 endif 76 0.000055 if i < 0 " not found, nothing to do 75 0.000067 return endif 1 0.000001 endif " Figure out the arguments for searchpairpos(). 1 0.000001 if i % 2 == 0 1 0.000002 let s_flags = 'nW' 1 0.000003 let c2 = plist[i + 1] 1 0.000001 else let s_flags = 'nbW' let c2 = c let c = plist[i - 1] endif 1 0.000001 if c == '[' let c = '\[' let c2 = '\]' endif " Find the match. When it was just before the cursor move it there for a " moment. 1 0.000001 if before > 0 1 0.000004 let save_cursor = winsaveview() 1 0.000003 call cursor(c_lnum, c_col - before) 1 0.000000 endif " When not in a string or comment ignore matches inside them. " We match "escape" for special items, such as lispEscapeSpecial. 1 0.000003 let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' . '=~? "string\\|character\\|singlequote\\|escape\\|comment"' 1 0.000125 execute 'if' s_skip '| let s_skip = 0 | endif' " Limit the search to lines visible in the window. 1 0.000003 let stoplinebottom = line('w$') 1 0.000003 let stoplinetop = line('w0') 1 0.000001 if i % 2 == 0 1 0.000002 let stopline = stoplinebottom 1 0.000001 else let stopline = stoplinetop endif " Limit the search time to 300 msec to avoid a hang on very long lines. " This fails when a timeout is not supported. 1 0.000002 if mode() == 'i' || mode() == 'R' 1 0.000006 let timeout = exists("b:matchparen_insert_timeout") ? b:matchparen_insert_timeout : g:matchparen_insert_timeout 1 0.000000 else let timeout = exists("b:matchparen_timeout") ? b:matchparen_timeout : g:matchparen_timeout endif 1 0.000001 try 1 0.009726 let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, timeout) 1 0.000002 catch /E118/ " Can't use the timeout, restrict the stopline a bit more to avoid taking " a long time on closed folds and long lines. " The "viewable" variables give a range in which we can scroll while " keeping the cursor at the same position. " adjustedScrolloff accounts for very large numbers of scrolloff. let adjustedScrolloff = min([&scrolloff, (line('w$') - line('w0')) / 2]) let bottom_viewable = min([line('$'), c_lnum + &lines - adjustedScrolloff - 2]) let top_viewable = max([1, c_lnum-&lines+adjustedScrolloff + 2]) " one of these stoplines will be adjusted below, but the current values are " minimal boundaries within the current window if i % 2 == 0 if has("byte_offset") && has("syntax_items") && &smc > 0 let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2]) let stopline = min([bottom_viewable, byte2line(stopbyte)]) else let stopline = min([bottom_viewable, c_lnum + 100]) endif let stoplinebottom = stopline else if has("byte_offset") && has("syntax_items") && &smc > 0 let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2]) let stopline = max([top_viewable, byte2line(stopbyte)]) else let stopline = max([top_viewable, c_lnum - 100]) endif let stoplinetop = stopline endif let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline) endtry 1 0.000002 if before > 0 1 0.000054 call winrestview(save_cursor) 1 0.000001 endif " If a match is found setup match highlighting. 1 0.000003 if m_lnum > 0 && m_lnum >= stoplinetop && m_lnum <= stoplinebottom exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) . 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/' let w:paren_hl_on = 1 endif FUNCTION <SNR>86_OnCursorMovedInsertMode() Called 74 times Total time: 0.021295 Self time: 0.001768 count total (s) self (s) 74 0.001520 0.000251 if !s:AllowedToCompleteInCurrentFile() return endif 74 0.001238 0.000266 call s:UpdateCursorMoved() " Basically, we need to only trigger the completion menu when the user has " inserted or deleted a character, NOT just when the user moves in insert mode " (with, say, the arrow keys). If we trigger the menu even on pure moves, then " it's impossible to move in insert mode since the up/down arrows start moving " the selected completion in the completion menu. Yeah, people shouldn't be " moving in insert mode at all (that's what normal mode is for) but explain " that to the users who complain... 74 0.001713 0.000283 if !s:BufferTextChangedSinceLastMoveInInsertMode() 25 0.000015 return endif 49 0.002228 0.000189 call s:IdentifierFinishedOperations() 49 0.000095 if g:ycm_autoclose_preview_window_after_completion call s:ClosePreviewWindowIfNeeded() endif 49 0.013982 0.000165 call s:InvokeCompletion() FUNCTION <SNR>35_crend() Called 1 time Total time: 0.000028 Self time: 0.000028 count total (s) self (s) 1 0.000011 let n = "" 1 0.000010 if !exists("b:endwise_addition") || !exists("b:endwise_words") || !exists("b:endwise_syngroups") 1 0.000004 return n end let synpat = '\%('.substitute(b:endwise_syngroups,',','\\|','g').'\)' let wordchoice = '\%('.substitute(b:endwise_words,',','\\|','g').'\)' if exists("b:endwise_pattern") let beginpat = substitute(b:endwise_pattern,'&',substitute(wordchoice,'\\','\\&','g'),'g') else let beginpat = '\<'.wordchoice.'\>' endif let lnum = line('.') - 1 let space = matchstr(getline(lnum),'^\s*') let col = match(getline(lnum),beginpat) + 1 let word = matchstr(getline(lnum),beginpat) let endword = substitute(word,'.*',b:endwise_addition,'') let y = n.endword."\<C-O>O" let endpat = '\w\@<!'.endword.'\w\@!' if a:always return y elseif col <= 0 || synIDattr(synID(lnum,col,1),'name') !~ '^'.synpat.'$' return n elseif getline('.') !~ '^\s*#\=$' return n endif let line = s:mysearchpair(beginpat,endpat,synpat) " even is false if no end was found, or if the end found was less " indented than the current line let even = strlen(matchstr(getline(line),'^\s*')) >= strlen(space) if line == 0 let even = 0 endif if !even && line == line('.') + 1 return y endif if even return n endif return y FUNCTION <SNR>63_set_file() Called 2 times Total time: 0.000007 Self time: 0.000007 count total (s) self (s) 2 0.000006 let s:file = a:file FUNCTION <SNR>86_OnCursorHold() Called 2 times Total time: 0.000572 Self time: 0.000067 count total (s) self (s) 2 0.000096 0.000012 if !s:AllowedToCompleteInCurrentFile() return endif 2 0.000061 0.000014 call s:SetUpCompleteopt() " Order is important here; we need to extract any done diagnostics before " reparsing the file again 2 0.000327 0.000016 call s:UpdateDiagnosticNotifications() 2 0.000080 0.000017 call s:OnFileReadyToParse() FUNCTION <SNR>86_SetUpYcmChangedTick() Called 4 times Total time: 0.000038 Self time: 0.000038 count total (s) self (s) 4 0.000033 let b:ycm_changedtick = get( b:, 'ycm_changedtick', { 'file_ready_to_parse' : -1, } ) FUNCTION <SNR>59_FindWindow() Called 1 time Total time: 0.000383 Self time: 0.000088 count total (s) self (s) 1 0.000002 if a:doDebug 1 0.000104 0.000006 call <SID>DEBUG('Entering FindWindow('.a:bufName.','.a:doDebug.')',10) 1 0.000001 endif " Try to find an existing window that contains " our buffer. 1 0.000048 let l:winnr = bufwinnr(a:bufName) 1 0.000002 if l:winnr != -1 if a:doDebug call <SID>DEBUG('Found window '.l:winnr.' with buffer ('.winbufnr(l:winnr).' : '.bufname(winbufnr(l:winnr)).')',9) endif else 1 0.000001 if a:doDebug 1 0.000103 0.000007 call <SID>DEBUG('Can not find window with buffer ('.a:bufName.')',9) 1 0.000001 endif 1 0.000000 endif 1 0.000001 if a:doDebug 1 0.000105 0.000004 call <SID>DEBUG('Leaving FindWindow()',10) 1 0.000000 endif 1 0.000001 return l:winnr FUNCTION <SNR>59_AutoUpdate() Called 1 time Total time: 0.002015 Self time: 0.000128 count total (s) self (s) 1 0.000105 0.000007 call <SID>DEBUG('Entering AutoUpdate('.a:curBufNum.')',10) 1 0.000111 0.000009 call <SID>DEBUG('Current state: '.winnr().' : '.bufnr('%').' : '.bufname('%'),10) 1 0.000002 if (s:miniBufExplInAutoUpdate == 1) call <SID>DEBUG('AutoUpdate recursion stopped',9) call <SID>DEBUG('Leaving AutoUpdate()',10) return else 1 0.000002 let s:miniBufExplInAutoUpdate = 1 1 0.000001 endif " Skip windows holding ignored buffer 1 0.000257 0.000010 if !a:force && <SID>IsBufferIgnored(a:curBufNum) == 1 call <SID>DEBUG('Leaving AutoUpdate()',10) let s:miniBufExplInAutoUpdate = 0 return endif 1 0.000001 if s:MRUEnable == 1 1 0.000451 0.000010 call <SID>ListPush(s:MRUList,a:curBufNum) 1 0.000001 endif " Only allow updates when the AutoUpdate flag is set " this allows us to stop updates on startup. 1 0.000005 if exists('t:miniBufExplAutoUpdate') && t:miniBufExplAutoUpdate == 1 " if we don't have a window then create one 1 0.000395 0.000012 let l:winnr = <SID>FindWindow('-MiniBufExplorer-', 1) 1 0.000440 0.000014 if (exists('t:skipEligibleBuffersCheck') && t:skipEligibleBuffersCheck == 1) || <SID>HasEligibleBuffers() == 1 if (l:winnr == -1) if g:miniBufExplAutoStart == 1 call <SID>DEBUG('MiniBufExplorer was not running, starting...', 9) call <SID>StartExplorer(a:curBufNum) else call <SID>DEBUG('MiniBufExplorer was not running, aborting...', 9) call <SID>DEBUG('Leaving AutoUpdate()',10) let s:miniBufExplInAutoUpdate = 0 return endif else call <SID>DEBUG('Updating MiniBufExplorer...', 9) call <SID>UpdateExplorer(a:curBufNum) endif else 1 0.000002 if (l:winnr == -1) 1 0.000100 0.000005 call <SID>DEBUG('MiniBufExplorer was not running, aborting...', 9) 1 0.000100 0.000005 call <SID>DEBUG('Leaving AutoUpdate()',10) 1 0.000002 let s:miniBufExplInAutoUpdate = 0 1 0.000001 return else call <SID>DEBUG('Failed in eligible check', 9) call <SID>StopExplorer(0) " we do not want to turn auto-updating off let t:miniBufExplAutoUpdate = 1 endif endif else call <SID>DEBUG('AutoUpdates are turned off, terminating',9) endif call <SID>DEBUG('Leaving AutoUpdate()',10) let s:miniBufExplInAutoUpdate = 0 FUNCTION <SNR>86_UpdateDiagnosticNotifications() Called 4 times Total time: 0.000484 Self time: 0.000484 count total (s) self (s) 4 0.000451 if get( g:, 'loaded_syntastic_plugin', 0 ) && pyeval( 'ycm_state.NativeFiletypeCompletionUsable()' ) && pyeval( 'ycm_state.DiagnosticsForCurrentFileReady()' ) && g:ycm_register_as_syntastic_checker SyntasticCheck endif FUNCTION <SNR>63_escape() Called 2 times Total time: 0.000063 Self time: 0.000063 count total (s) self (s) 2 0.000006 if &shellxquote ==# '"' return '"' . substitute(a:str, '"', '""', 'g') . '"' else 2 0.000011 let esc = exists('+shellxescape') ? &shellxescape : '"&|<>()@^' 2 0.000035 return &shellquote . substitute(a:str, '['.esc.']', '&', 'g') . get({'(': ')', '"(': ')"'}, &shellquote, &shellquote) endif FUNCTION <SNR>63_current_file() Called 2 times Total time: 0.000033 Self time: 0.000033 count total (s) self (s) 2 0.000031 return expand('%:p') FUNCTION <SNR>86_OnCursorMovedNormalMode() Called 1 time Total time: 0.000139 Self time: 0.000021 count total (s) self (s) 1 0.000033 0.000005 if !s:AllowedToCompleteInCurrentFile() return endif 1 0.000067 0.000005 call s:UpdateDiagnosticNotifications() 1 0.000035 0.000007 call s:OnFileReadyToParse() FUNCTION <SNR>86_OnInsertLeave() Called 1 time Total time: 0.000573 Self time: 0.000170 count total (s) self (s) 1 0.000042 0.000007 if !s:AllowedToCompleteInCurrentFile() return endif 1 0.000003 let s:omnifunc_mode = 0 1 0.000124 0.000013 call s:UpdateDiagnosticNotifications() 1 0.000266 0.000009 call s:OnFileReadyToParse() 1 0.000122 py ycm_state.OnInsertLeave() 1 0.000006 if g:ycm_autoclose_preview_window_after_completion || g:ycm_autoclose_preview_window_after_insertion call s:ClosePreviewWindowIfNeeded() endif FUNCTION <SNR>86_InsideCommentOrStringAndShouldStop() Called 49 times Total time: 0.011154 Self time: 0.000617 count total (s) self (s) 49 0.010733 0.000196 let retval = s:InsideCommentOrString() 49 0.000094 let inside_comment = retval == 1 49 0.000064 let inside_string = retval == 2 49 0.000104 if inside_comment && g:ycm_complete_in_comments || inside_string && g:ycm_complete_in_strings return 0 endif 49 0.000032 return retval FUNCTION GitGutter() Called 2 times Total time: 0.022367 Self time: 0.000107 count total (s) self (s) 2 0.000022 0.000015 call s:set_file(a:file) 2 0.022271 0.000018 if s:is_active() call s:init() if a:0 == 1 let diff = s:run_diff(1) else let diff = s:run_diff(0) endif let s:hunks = s:parse_diff(diff) let modified_lines = s:process_hunks(s:hunks) if g:gitgutter_sign_column_always call s:add_dummy_sign() else if s:differences(s:hunks) call s:add_dummy_sign() " prevent flicker else call s:remove_dummy_sign() endif endif call s:clear_signs(a:file) call s:find_other_signs(a:file) call s:show_signs(a:file, modified_lines) endif FUNCTION <SNR>63_directory_of_file() Called 2 times Total time: 0.000028 Self time: 0.000022 count total (s) self (s) 2 0.000026 0.000020 return shellescape(fnamemodify(s:file(), ':h')) FUNCTION <SNR>86_SetUpCompleteopt() Called 2 times Total time: 0.000047 Self time: 0.000047 count total (s) self (s) " Some plugins (I'm looking at you, vim-notes) change completeopt by for " instance adding 'longest'. This breaks YCM. So we force our settings. " There's no two ways about this: if you want to use YCM then you have to " have these completeopt settings, otherwise YCM won't work at all. " We need menuone in completeopt, otherwise when there's only one candidate " for completion, the menu doesn't show up. 2 0.000017 set completeopt-=menu 2 0.000006 set completeopt+=menuone " This is unnecessary with our features. People use this option to insert " the common prefix of all the matches and then add more differentiating chars " so that they can select a more specific match. With our features, they " don't need to insert the prefix; they just type the differentiating chars. " Also, having this option set breaks the plugin. 2 0.000004 set completeopt-=longest 2 0.000004 if g:ycm_add_preview_to_completeopt set completeopt+=preview endif FUNCTION <SNR>86_OnBlankLine() Called 49 times Total time: 0.001485 Self time: 0.001485 count total (s) self (s) 49 0.001454 return pyeval( 'not vim.current.line or vim.current.line.isspace()' ) FUNCTION <SNR>63_discard_stdout_and_stderr() Called 2 times Total time: 0.000025 Self time: 0.000025 count total (s) self (s) 2 0.000007 if !exists('s:discard') if &shellredir ==? '>%s 2>&1' let s:discard = ' > /dev/null 2>&1' else let s:discard = ' >& /dev/null' endif endif 2 0.000003 return s:discard FUNCTION <SNR>86_InsideCommentOrString() Called 49 times Total time: 0.010537 Self time: 0.010537 count total (s) self (s) " Has to be col('.') -1 because col('.') doesn't exist at this point. We are " in insert mode when this func is called. 49 0.010069 let syntax_group = synIDattr( synIDtrans( synID( line( '.' ), col( '.' ) - 1, 1 ) ), 'name') 49 0.000130 if stridx(syntax_group, 'Comment') > -1 return 1 endif 49 0.000072 if stridx(syntax_group, 'String') > -1 return 2 endif 49 0.000036 return 0 FUNCTION <SNR>86_BufferTextChangedSinceLastMoveInInsertMode() Called 74 times Total time: 0.001430 Self time: 0.001430 count total (s) self (s) 74 0.000117 if s:moved_vertically_in_insert_mode 1 0.000002 let s:previous_num_chars_on_current_line = -1 1 0.000000 return 0 endif 73 0.000243 let num_chars_in_current_cursor_line = strlen( getline('.') ) 73 0.000117 if s:previous_num_chars_on_current_line == -1 2 0.000005 let s:previous_num_chars_on_current_line = num_chars_in_current_cursor_line 2 0.000001 return 0 endif 71 0.000205 let changed_text_on_current_line = num_chars_in_current_cursor_line != s:previous_num_chars_on_current_line 71 0.000155 let s:previous_num_chars_on_current_line = num_chars_in_current_cursor_line 71 0.000084 return changed_text_on_current_line FUNCTION <SNR>59_UpdateBufferStateDict() Called 2 times Total time: 0.002579 Self time: 0.000127 count total (s) self (s) 2 0.000244 0.000020 call <SID>DEBUG('Entering UpdateBufferStateDict('.a:bufNum.','.a:deleted.')',10) 2 0.000008 let l:bufNum = 0 + a:bufNum 2 0.000004 if a:deleted && has_key(s:bufStateDict, l:bufNum) call filter(s:bufStateDict, 'v:key != '.l:bufNum) call <SID>DEBUG('Leaving UpdateBufferStateDict()',10) return endif 2 0.000008 if has_key(s:bufStateDict, l:bufNum) 1 0.000007 if s:bufStateDict[l:bufNum] != getbufvar(a:bufNum, '&modified') 1 0.000006 let s:bufStateDict[l:bufNum] = getbufvar(a:bufNum, '&modified') 1 0.002028 0.000013 call <SID>AutoUpdate(bufnr(a:bufNum),0) 1 0.000001 endif 1 0.000001 else 1 0.000009 let s:bufStateDict[l:bufNum] = getbufvar(a:bufNum, '&modified') 1 0.000001 endif 2 0.000225 0.000012 call <SID>DEBUG('Leaving UpdateBufferStateDict()',10) FUNCTION <SNR>63_command_in_directory_of_file() Called 2 times Total time: 0.000068 Self time: 0.000040 count total (s) self (s) 2 0.000048 0.000020 let s:cmd_in_dir = 'pushd ' . s:directory_of_file() . ' && ' . a:cmd 2 0.000019 return substitute(s:cmd_in_dir, "'", '"', 'g') FUNCTION <SNR>63_is_active() Called 2 times Total time: 0.022253 Self time: 0.000048 count total (s) self (s) 2 0.022252 0.000047 return g:gitgutter_enabled && s:exists_file() && s:is_in_a_git_repo() && s:is_tracked_by_git() FUNCTION <SNR>86_AllowedToCompleteInCurrentFile() Called 79 times Total time: 0.001451 Self time: 0.001451 count total (s) self (s) 79 0.000449 if empty( &filetype ) || getbufvar(winbufnr(winnr()), "&buftype") ==# 'nofile' return 0 endif 79 0.000338 let whitelist_allows = has_key( g:ycm_filetype_whitelist, '*' ) || has_key( g:ycm_filetype_whitelist, &filetype ) 79 0.000245 let blacklist_allows = !has_key( g:ycm_filetype_blacklist, &filetype ) 79 0.000143 return whitelist_allows && blacklist_allows FUNCTION <SNR>59_ListPush() Called 1 time Total time: 0.000441 Self time: 0.000029 count total (s) self (s) 1 0.000108 0.000010 call <SID>DEBUG('Entering ListPush('.string(a:list).','.a:val.')',10) " Remove the buffer number from the list if it already exists. 1 0.000225 0.000007 call <SID>ListPop(a:list,a:val) " Add the buffer number to the head of the list. 1 0.000004 call insert(a:list,a:val) 1 0.000101 0.000005 call <SID>DEBUG('Leaving ListPush()',10) FUNCTION <SNR>86_OnInsertEnter() Called 1 time Total time: 0.000052 Self time: 0.000017 count total (s) self (s) 1 0.000046 0.000011 if !s:AllowedToCompleteInCurrentFile() return endif 1 0.000003 let s:old_cursor_position = [] FUNCTION <SNR>86_OnFileReadyToParse() Called 4 times Total time: 0.000348 Self time: 0.000310 count total (s) self (s) " We need to call this just in case there is no b:ycm_changetick; this can " happen for special buffers. 4 0.000063 0.000025 call s:SetUpYcmChangedTick() 4 0.000018 let buffer_changed = b:changedtick != b:ycm_changedtick.file_ready_to_parse 4 0.000006 if buffer_changed 1 0.000224 py ycm_state.OnFileReadyToParse() 1 0.000002 endif 4 0.000013 let b:ycm_changedtick.file_ready_to_parse = b:changedtick FUNCTION <SNR>86_CompletionsForQuery() Called 37 times Total time: 0.011633 Self time: 0.011633 count total (s) self (s) 37 0.000056 if a:use_filetype_completer py completer = ycm_state.GetFiletypeCompleter() else 37 0.000929 py completer = ycm_state.GetGeneralCompleter() 37 0.000037 endif 37 0.004444 py completer.CandidatesForQueryAsync( vim.eval( 'a:query' ), int( vim.eval( 'a:completion_start_column' ) ) ) 37 0.000126 let l:results_ready = 0 103 0.000149 while !l:results_ready 72 0.001794 let l:results_ready = pyeval( 'completer.AsyncCandidateRequestReady()' ) 72 0.000528 if complete_check() 6 0.000014 let s:searched_and_results_found = 0 6 0.000017 return { 'words' : [], 'refresh' : 'always'} endif 66 0.000042 endwhile 31 0.002613 let l:results = pyeval( 'base.AdjustCandidateInsertionText( completer.CandidatesFromStoredRequest() )' ) 31 0.000139 let s:searched_and_results_found = len( l:results ) != 0 31 0.000092 return { 'words' : l:results, 'refresh' : 'always' } FUNCTION <SNR>59_DEBUG() Called 25 times Total time: 0.002566 Self time: 0.002566 count total (s) self (s) 25 0.000073 if g:miniBufExplDebugLevel >= a:level if a:level == 10 && a:msg =~ '^Entering' let g:miniBufExplFuncCallDepth += 1 endif if a:msg =~ '^Entering' let l:msg = repeat('│ ',g:miniBufExplFuncCallDepth - 1).'┌ '.a:msg elseif a:msg =~ '^Leaving' let l:msg = repeat('│ ',g:miniBufExplFuncCallDepth - 1).'└ '.a:msg else let l:msg = repeat('│ ',g:miniBufExplFuncCallDepth).a:msg endif " Prevent a report of our actions from showing up. let l:save_rep = &report let l:save_sc = &showcmd let &report = 10000 set noshowcmd " Debug output to a buffer if g:miniBufExplDebugMode == 0 if bufname('%') == 'MiniBufExplorer.DBG' return endif " Get into the debug window or create it if needed let l:winNum = <SID>FindCreateWindow('MiniBufExplorer.DBG', 0, 1, 1, 1, 0) if l:winNum == -1 let g:miniBufExplDebugMode == 3 call <SID>DEBUG('Failed to get the MBE debugging window, reset debugging mode to 3.',1) call <SID>DEBUG('Forwarding message...',1) call <SID>DEBUG(a:msg,1) call <SID>DEBUG('Forwarding message end.',1) return endif " Save the current window number so we can come back here let l:currWin = winnr() call s:SwitchWindow('p',1) " Change to debug window call s:SwitchWindow('w',1,l:winNum) " Make sure we really got to our window, if not we " will display a confirm dialog and turn debugging " off so that we won't break things even more. if bufname('%') != 'MiniBufExplorer.DBG' call confirm('Error in window debugging code. Dissabling MiniBufExplorer debugging.', 'OK') let g:miniBufExplDebugLevel = 0 return endif set modified " Write Message to DBG buffer let res=append("$",s:debugIndex.':'.a:level.':'.a:msg) set nomodified norm G " Return to original window call s:SwitchWindow('p',1) call s:SwitchWindow('w',1,l:currWin) " Debug output using VIM's echo facility elseif g:miniBufExplDebugMode == 1 echo s:debugIndex.':'.a:level.':'.a:msg " Debug output to a file -- VERY SLOW!!! " should be OK on UNIX and Win32 (not the 95/98 variants) elseif g:miniBufExplDebugMode == 2 if has('system') || has('fork') if has('win32') && !has('win95') let l:result = system("cmd /c 'echo ".s:debugIndex.':'.a:level.':'.a:msg." >> MiniBufExplorer.DBG'") endif if has('unix') let l:result = system("echo '".s:debugIndex.':'.a:level.':'.a:msg." >> MiniBufExplorer.DBG'") endif else call confirm('Error in file writing version of the debugging code, vim not compiled with system or fork. Dissabling MiniBufExplorer debugging.', 'OK') let g:miniBufExplDebugLevel = 0 endif elseif g:miniBufExplDebugMode == 3 let g:miniBufExplDebugOutput = g:miniBufExplDebugOutput."\n".s:debugIndex."\t".':'.a:level."\t".':'.l:msg endif let s:debugIndex = s:debugIndex + 1 if a:level == 10 && a:msg =~ '^Leaving' let g:miniBufExplFuncCallDepth -= 1 endif let &report = l:save_rep let &showcmd = l:save_sc endif FUNCTION 25() Called 110 times Total time: 0.001170 Self time: 0.001170 count total (s) self (s) 110 0.000463 if !exists("b:syntastic_loclist") let b:syntastic_loclist = g:SyntasticLoclist.New([]) endif 110 0.000158 return b:syntastic_loclist FUNCTIONS SORTED ON TOTAL TIME count total (s) self (s) function 2 0.022367 0.000107 GitGutter() 2 0.022253 0.000048 <SNR>63_is_active() 2 0.022168 0.000145 <SNR>63_is_in_a_git_repo() 74 0.021295 0.001768 <SNR>86_OnCursorMovedInsertMode() 98 0.021118 0.009485 youcompleteme#Complete() 76 0.014312 <SNR>71_Highlight_Matching_Pair() 49 0.013817 0.001178 <SNR>86_InvokeCompletion() 37 0.011633 <SNR>86_CompletionsForQuery() 49 0.011154 0.000617 <SNR>86_InsideCommentOrStringAndShouldStop() 49 0.010537 <SNR>86_InsideCommentOrString() 75 0.007262 UltiSnips_CursorMoved() 2 0.002579 0.000127 <SNR>59_UpdateBufferStateDict() 25 0.002566 <SNR>59_DEBUG() 49 0.002039 <SNR>86_IdentifierFinishedOperations() 1 0.002015 0.000128 <SNR>59_AutoUpdate() 49 0.001485 <SNR>86_OnBlankLine() 79 0.001451 <SNR>86_AllowedToCompleteInCurrentFile() 74 0.001430 <SNR>86_BufferTextChangedSinceLastMoveInInsertMode() 110 0.001170 25() 74 0.000972 <SNR>86_UpdateCursorMoved() FUNCTIONS SORTED ON SELF TIME count total (s) self (s) function 76 0.014312 <SNR>71_Highlight_Matching_Pair() 37 0.011633 <SNR>86_CompletionsForQuery() 49 0.010537 <SNR>86_InsideCommentOrString() 98 0.021118 0.009485 youcompleteme#Complete() 75 0.007262 UltiSnips_CursorMoved() 25 0.002566 <SNR>59_DEBUG() 49 0.002039 <SNR>86_IdentifierFinishedOperations() 74 0.021295 0.001768 <SNR>86_OnCursorMovedInsertMode() 49 0.001485 <SNR>86_OnBlankLine() 79 0.001451 <SNR>86_AllowedToCompleteInCurrentFile() 74 0.001430 <SNR>86_BufferTextChangedSinceLastMoveInInsertMode() 49 0.013817 0.001178 <SNR>86_InvokeCompletion() 110 0.001170 25() 74 0.000972 <SNR>86_UpdateCursorMoved() 49 0.011154 0.000617 <SNR>86_InsideCommentOrStringAndShouldStop() 4 0.000484 <SNR>86_UpdateDiagnosticNotifications() 110 0.000419 34() 4 0.000348 0.000310 <SNR>86_OnFileReadyToParse() 1 0.000573 0.000170 <SNR>86_OnInsertLeave() 2 0.022168 0.000145 <SNR>63_is_in_a_git_repo() -
pablox-cl revised this gist
Oct 14, 2013 . 1 changed file with 853 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,853 @@ FUNCTION <SNR>83_GetMSL() Called 4 times Total time: 0.001975 Self time: 0.000225 count total (s) self (s) " Start on the line we're at and use its indent. 4 0.000006 let msl = a:lnum 4 0.001461 0.000014 let lnum = s:PrevNonBlankNonString(a:lnum - 1) 4 0.000004 while lnum > 0 " If we have a continuation line, or we're in a string, use line as MSL. " Otherwise, terminate search as we have found our MSL already. 4 0.000007 let line = getline(lnum) 4 0.000104 let col = match(line, s:msl_regex) + 1 4 0.000329 0.000026 if (col > 0 && !s:IsInStringOrComment(lnum, col)) || s:IsInString(lnum, strlen(line)) let msl = lnum else " Don't use lines that are part of a one line scope as msl unless the " flag in_one_line_scope is set to 1 " 4 0.000005 if a:in_one_line_scope 4 0.000002 break end let msl_one_line = s:Match(lnum, s:one_line_scope_regex) if msl_one_line == 0 break endif endif let lnum = s:PrevNonBlankNonString(lnum - 1) endwhile 4 0.000004 return msl FUNCTION <SNR>88_OnInsertLeave() Called 1 time Total time: 0.000463 Self time: 0.000100 count total (s) self (s) 1 0.000038 0.000006 if !s:AllowedToCompleteInCurrentFile() return endif 1 0.000002 let s:omnifunc_mode = 0 1 0.000110 0.000007 call s:UpdateDiagnosticNotifications() 1 0.000237 0.000009 call s:OnFileReadyToParse() 1 0.000062 py ycm_state.OnInsertLeave() 1 0.000005 if g:ycm_autoclose_preview_window_after_completion || g:ycm_autoclose_preview_window_after_insertion call s:ClosePreviewWindowIfNeeded() endif FUNCTION 34() Called 13 times Total time: 0.000058 Self time: 0.000058 count total (s) self (s) 13 0.000026 if self._hasErrorsOrWarningsToDisplay >= 0 13 0.000021 return self._hasErrorsOrWarningsToDisplay endif let self._hasErrorsOrWarningsToDisplay = empty(self._rawLoclist) ? 0 : (!self._quietWarnings || len(self.errors())) return self._hasErrorsOrWarningsToDisplay FUNCTION GetJavascriptIndent() Called 1 time Total time: 0.004147 Self time: 0.000201 count total (s) self (s) " 3.1. Setup {{{2 " ---------- " Set up variables for restoring position in file. Could use v:lnum here. 1 0.000009 let vcol = col('.') " 3.2. Work on the current line {{{2 " ----------------------------- 1 0.000002 let ind = -1 " Get the current line. 1 0.000003 let line = getline(v:lnum) " previous nonblank line number 1 0.000004 let prevline = prevnonblank(v:lnum - 1) " If we got a closing bracket on an empty line, find its match and indent " according to it. For parentheses we indent to its column - 1, for the " others we indent to the containing line's MSL's level. Return -1 if fail. 1 0.000010 let col = matchend(line, '^\s*[],})]') 1 0.000004 if col > 0 && !s:IsInStringOrComment(v:lnum, col) call cursor(v:lnum, col) let lvar = s:InMultiVarStatement(v:lnum) if lvar let prevline_contents = s:RemoveTrailingComments(getline(prevline)) " check for comma first if (line[col - 1] =~ ',') " if the previous line ends in comma or semicolon don't indent if (prevline_contents =~ '[;,]\s*$') return indent(s:GetMSL(line('.'), 0)) " get previous line indent, if it's comma first return prevline indent elseif (prevline_contents =~ s:comma_first) return indent(prevline) " otherwise we indent 1 level else return indent(lvar) + &sw endif endif endif let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2) if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0 if line[col-1]==')' && col('.') != col('$') - 1 let ind = virtcol('.')-1 else let ind = indent(s:GetMSL(line('.'), 0)) endif endif return ind endif " If the line is comma first, dedent 1 level 1 0.000005 if (getline(prevline) =~ s:comma_first) return indent(prevline) - &sw endif 1 0.000004 if (line =~ s:ternary) if (getline(prevline) =~ s:ternary_q) return indent(prevline) else return indent(prevline) + &sw endif endif " If we are in a multi-line comment, cindent does the right thing. 1 0.000598 0.000008 if s:IsInMultilineComment(v:lnum, 1) && !s:IsLineComment(v:lnum, 1) return cindent(v:lnum) endif " Check for multiple var assignments " let var_indent = s:GetVarIndent(v:lnum) " if var_indent >= 0 " return var_indent " endif " 3.3. Work on the previous line. {{{2 " ------------------------------- " If the line is empty and the previous nonblank line was a multi-line " comment, use that comment's indent. Deduct one char to account for the " space in ' */'. 1 0.000718 0.000007 if line =~ '^\s*$' && s:IsInMultilineComment(prevline, 1) return indent(prevline) - 1 endif " Find a non-blank, non-multi-line string line above the current line. 1 0.000312 0.000011 let lnum = s:PrevNonBlankNonString(v:lnum - 1) " If the line is empty and inside a string, use the previous line. 1 0.000004 if line =~ '^\s*$' && lnum != prevline return indent(prevnonblank(v:lnum)) endif " At the start of the file use zero indent. 1 0.000000 if lnum == 0anonymous gist. -c, --copy Copy the resulting URL to the clipboard -e, --embed Copy the embed code for the gist to the clipboard -o, --open Open the resulting URL in a browser --no-open -P, --paste Paste from the clipboard to gist -h, --help Show this message. -v, --version Print the version. return 0 endif " Set up variables for current line. 1 0.000002 let line = getline(lnum) 1 0.000002 let ind = indent(lnum) " If the previous line ended with a block opening, add a level of indent. 1 0.000026 0.000006 if s:Match(lnum, s:block_regex) return indent(s:GetMSL(lnum, 0)) + &sw endif " If the previous line contained an opening bracket, and we are still in it, " add indent depending on the bracket type. 1 0.000004 if line =~ '[[({]' 1 0.000218 0.000007 let counts = s:LineHasOpeningBrackets(lnum) 1 0.000003 if counts[0] == '1' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 if col('.') + 1 == col('$') return ind + &sw else return virtcol('.') endif elseif counts[1] == '1' || counts[2] == '1' return ind + &sw else 1 0.000003 call cursor(v:lnum, vcol) 1 0.000001 end 1 0.000000 endif " 3.4. Work on the MSL line. {{{2 " -------------------------- 1 0.000001 let ind_con = ind 1 0.000711 0.000011 let ind = s:IndentWithContinuation(lnum, ind_con, &sw) " }}}2 " " 1 0.000483 0.000005 let ols = s:InOneLineScope(lnum) 1 0.000000 if ols > 0 let ind = ind + &sw else 1 0.000940 0.000005 let ols = s:ExitingOneLineScope(lnum) 1 0.000001 while ols > 0 && ind > 0 let ind = ind - &sw let ols = s:InOneLineScope(ols - 1) endwhile 1 0.000000 endif 1 0.000000 return ind FUNCTION UltiSnips_CursorMoved() Called 7 times Total time: 0.001065 Self time: 0.001065 count total (s) self (s) 7 0.001053 exec g:_uspy "UltiSnips_Manager.cursor_moved()" FUNCTION <SNR>88_UpdateDiagnosticNotifications() Called 6 times Total time: 0.000427 Self time: 0.000427 count total (s) self (s) 6 0.000389 if get( g:, 'loaded_syntastic_plugin', 0 ) && pyeval( 'ycm_state.NativeFiletypeCompletionUsable()' ) && pyeval( 'ycm_state.DiagnosticsForCurrentFileReady()' ) && g:ycm_register_as_syntastic_checker SyntasticCheck endif FUNCTION youcompleteme#Complete() Called 2 times Total time: 0.000237 Self time: 0.000237 count total (s) self (s) " After the user types one character after the call to the omnifunc, the " completefunc will be called because of our mapping that calls the " completefunc on every keystroke. Therefore we need to delegate the call we " 'stole' back to the omnifunc 2 0.000004 if s:omnifunc_mode return youcompleteme#OmniComplete( a:findstart, a:base ) endif 2 0.000002 if a:findstart " InvokeCompletion has this check but we also need it here because of random " Vim bugs and unfortunate interactions with the autocommands of other " plugins 2 0.000002 if !s:cursor_moved " for vim, -2 means not found but don't trigger an error message " see :h complete-functions return -2 endif " TODO: make this a function-local variable instead of a script-local one 2 0.000048 let s:completion_start_column = pyeval( 'base.CompletionStartColumn()' ) 2 0.000093 let s:should_use_filetype_completion = pyeval( 'ycm_state.ShouldUseFiletypeCompleter(' . s:completion_start_column . ')' ) 2 0.000066 if !s:should_use_filetype_completion && !pyeval( 'ycm_state.ShouldUseGeneralCompleter(' . s:completion_start_column . ')' ) " for vim, -2 means not found but don't trigger an error message " see :h complete-functions 2 0.000002 return -2 endif return s:completion_start_column else return s:CompletionsForQuery( a:base, s:should_use_filetype_completion, s:completion_start_column ) endif FUNCTION <SNR>71_Highlight_Matching_Pair() Called 8 times Total time: 0.000569 Self time: 0.000569 count total (s) self (s) " Remove any previous match. 8 0.000037 if exists('w:paren_hl_on') && w:paren_hl_on 3match none let w:paren_hl_on = 0 endif " Avoid that we remove the popup menu. " Return when there are no colors (looks like the cursor jumps). 8 0.000034 if pumvisible() || (&t_Co < 8 && !has("gui_running")) return endif " Get the character under the cursor and check if it's in 'matchpairs'. 8 0.000027 let c_lnum = line('.') 8 0.000020 let c_col = col('.') 8 0.000010 let before = 0 8 0.000040 let c = getline(c_lnum)[c_col - 1] 8 0.000149 let plist = split(&matchpairs, '.\zs[:,]') 8 0.000030 let i = index(plist, c) 8 0.000007 if i < 0 " not found, in Insert mode try character before the cursor 8 0.000022 if c_col > 1 && (mode() == 'i' || mode() == 'R') 2 0.000002 let before = 1 2 0.000005 let c = getline(c_lnum)[c_col - 2] 2 0.000004 let i = index(plist, c) 2 0.000001 endif 8 0.000008 if i < 0 " not found, nothing to do 8 0.000011 return endif endif " Figure out the arguments for searchpairpos(). if i % 2 == 0 let s_flags = 'nW' leanonymous gist. -c, --copy Copy the resulting URL to the clipboard -e, --embed Copy the embed code for the gist to the clipboard -o, --open Open the resulting URL in a browser --no-open -P, --paste Paste from the clipboard to gist -h, --help Show this message. -v, --version Print the version.t c2 = plist[i + 1] else let s_flags = 'nbW' let c2 = c let c = plist[i - 1] endif if c == '[' let c = '\[' let c2 = '\]' endif " Find the match. When it was just before the cursor move it there for a " moment. if before > 0 let save_cursor = winsaveview() call cursor(c_lnum, c_col - before) endif " When not in a string or comment ignore matches inside them. " We match "escape" for special items, such as lispEscapeSpecial. let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' . '=~? "string\\|character\\|singlequote\\|escape\\|comment"' execute 'if' s_skip '| let s_skip = 0 | endif' " Limit the search to lines visible in the window. let stoplinebottom = line('w$') let stoplinetop = line('w0') if i % 2 == 0 let stopline = stoplinebottom else let stopline = stoplinetop endif " Limit the search time to 300 msec to avoid a hang on very long lines. " This fails when a timeout is not supported. if mode() == 'i' || mode() == 'R' let timeout = exists("b:matchparen_insert_timeout") ? b:matchparen_insert_timeout : g:matchparen_insert_timeout else let timeout = exists("b:matchparen_timeout") ? b:matchparen_timeout : g:matchparen_timeout endif try let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, timeout) catch /E118/ " Can't use the timeout, restrict the stopline a bit more to avoid taking " a long time on closed folds and long lines. " The "viewable" variables give a range in which we can scroll while " keeping the cursor at the same position. " adjustedScrolloff accounts for very large numbers of scrolloff. let adjustedScrolloff = min([&scrolloff, (line('w$') - line('w0')) / 2]) let bottom_viewable = min([line('$'), c_lnum + &lines - adjustedScrolloff - 2]) let top_viewable = max([1, c_lnum-&lines+adjustedScrolloff + 2]) " one of these stoplines will be adjusted below, but the current values are " minimal boundaries within the current window if i % 2 == 0 if has("byte_offset") && has("syntax_items") && &smc > 0 let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2]) let stopline = min([bottom_viewable, byte2line(stopbyte)]) else let stopline = min([bottom_viewable, c_lnum + 100]) endif let stoplinebottom = stopline else if has("byte_offset") && has("syntax_items") && &smc > 0 let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2]) let stopline = max([top_viewable, byte2line(stopbyte)]) else let stopline = max([top_viewable, c_lnum - 100]) endif let stoplinetop = stopline endif let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline) endtry if before > 0 call winrestview(save_cursor) endif " If a match is found setup match highlighting. if m_lnum > 0 && m_lnum >= stoplinetop && m_lnum <= stoplinebottom exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) . 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/' let w:paren_hl_on = 1 endif FUNCTION <SNR>88_AllowedToCompleteInCurrentFile() Called 9 times Total time: 0.000210 Self time: 0.000210 count total (s) self (s) 9 0.000073 if empty( &filetype ) || getbufvar(winbufnr(winnr()), "&buftype") ==# 'nofile' return 0 endif 9 0.000048 let whitelist_allows = has_key( g:ycm_filetype_whitelist, '*' ) || has_key( g:ycm_filetype_whitelist, &filetype ) 9 0.000033 let blacklist_allows = !has_key( g:ycm_filetype_blacklist, &filetype ) 9 0.000020 return whitelist_allows && blacklist_allows FUNCTION <SNR>83_PrevNonBlankNonString() Called 5 times Total time: 0.001748 Self time: 0.000223 count total (s) self (s) 5 0.000007 let in_block = 0 5 0.000010 let lnum = prevnonblank(a:lnum) 8 0.000008 while lnum > 0 " Go in and out of blocks comments as necessary. " If the line isn't empty (with opt. comment) or in a string, end search. 8 0.000014 let line = getline(lnum) 8 0.000020 if line =~ '/\*' if in_block let in_block = 0 else break endif elseif !in_block && line =~ '\*/' let in_block = 1 elseif !in_block && line !~ '^\s*\%(//\).*$' && !(s:IsInStringOrComment(lnum, 1) && s:IsInStringOrComment(lnum, strlen(line))) 5 0.000005 break endif 3 0.000006 let lnum = prevnonblank(lnum - 1) 3 0.000003 endwhile 5 0.000005 return lnum FUNCTION <SNR>83_Match() Called 5 times Total time: 0.000090 Self time: 0.000090 count total (s) self (s) 5 0.000073 let col = match(getline(a:lnum), a:regex) + 1 5 0.000014 return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0 FUNCTION <SNR>88_SetUpYcmChangedTick() Called 6 times Total time: 0.000052 Self time: 0.000052 count total (s) self (s) 6 0.000048 let b:ycm_changedtick = get( b:, 'ycm_changedtick', { 'file_ready_to_parse' : -1, } ) FUNCTION <SNR>88_UpdateCursorMoved() Called 2 times Total time: 0.000024 Self time: 0.000024 count total (s) self (s) 2 0.000005 let current_position = getpos('.') 2 0.000006 let s:cursor_moved = current_position != s:old_cursor_position 2 0.000008 let s:moved_vertically_in_insert_mode = s:old_cursor_position != [] && current_position[ 1 ] != s:old_cursor_position[ 1 ] 2 0.000004 let s:old_cursor_position = current_position FUNCTION <SNR>88_OnFileReadyToParse() Called 6 times Total time: 0.000367 Self time: 0.000315 count total (s) self (s) " We need to call this just in case there is no b:ycm_changetick; this can " happen for special buffers. 6 0.000083 0.000031 call s:SetUpYcmChangedTick() 6 0.000026 let buffer_changed = b:changedtick != b:ycm_changedtick.file_ready_to_parse 6 0.000008 if buffer_changed 1 0.000200 py ycm_state.OnFileReadyToParse() 1 0.000002 endif 6 0.000021 let b:ycm_changedtick.file_ready_to_parse = b:changedtick FUNCTION <SNR>83_IsLineComment() Called 2 times Total time: 0.001004 Self time: 0.001004 count total (s) self (s) 2 0.001003 return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_linecom FUNCTION <SNR>88_BufferTextChangedSinceLastMoveInInsertMode() Called 2 times Total time: 0.000030 Self time: 0.000030 count total (s) self (s) 2 0.000003 if s:moved_vertically_in_insert_mode let s:previous_num_chars_on_current_line = -1 return 0 endif 2 0.000006 let num_chars_in_current_cursor_line = strlen( getline('.') ) 2 0.000002 if s:previous_num_chars_on_current_line == -1 1 0.000002 let s:previous_num_chars_on_current_line = num_chars_in_current_cursor_line 1 0.000000 return 0 endif 1 0.000002 let changed_text_on_current_line = num_chars_in_current_cursor_line != s:previous_num_chars_on_current_line 1 0.000002 let s:previous_num_chars_on_current_line = num_chars_in_current_cursor_line 1 0.000001 return changed_text_on_current_line FUNCTION <SNR>83_IsInString() Called 4 times Total time: 0.000303 Self time: 0.000303 count total (s) self (s) 4 0.000299 return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string FUNCTION <SNR>88_OnCursorMovedInsertMode() Called 2 times Total time: 0.000451 Self time: 0.000051 count total (s) self (s) 2 0.000037 0.000005 if !s:AllowedToCompleteInCurrentFile() return endif 2 0.000032 0.000008 call s:UpdateCursorMoved() " Basically, we need to only trigger the completion menu when the user has " inserted or deleted a character, NOT just when the user moves in insert mode " (with, say, the arrow keys). If we trigger the menu even on pure moves, then " it's impossible to move in insert mode since the up/down arrows start moving " the selected completion in the completion menu. Yeah, people shouldn't be " moving in insert mode at all (that's what normal mode is for) but explain " that to the users who complain... 2 0.000040 0.000010 if !s:BufferTextChangedSinceLastMoveInInsertMode() 1 0.000000 return endif 1 0.000140 0.000006 call s:IdentifierFinishedOperations() 1 0.000001 if g:ycm_autoclose_preview_window_after_completion call s:ClosePreviewWindowIfNeeded() endif 1 0.000185 0.000005 call s:InvokeCompletion() FUNCTION <SNR>83_IsInMultilineComment() Called 2 times Total time: 0.001301 Self time: 0.000297 count total (s) self (s) 2 0.001301 0.000297 return !s:IsLineComment(a:lnum, a:col) && synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_multiline FUNCTION <SNR>88_OnInsertEnter() Called 1 time Total time: 0.000025 Self time: 0.000007 count total (s) self (s) 1 0.000022 0.000004 if !s:AllowedToCompleteInCurrentFile() return endif 1 0.000002 let s:old_cursor_position = [] FUNCTION <SNR>88_OnBlankLine() Called 1 time Total time: 0.000030 Self time: 0.000030 count total (s) self (s) 1 0.000029 return pyeval( 'not vim.current.line or vim.current.line.isspace()' ) FUNCTION <SNR>83_InOneLineScope() Called 1 time Total time: 0.000478 Self time: 0.000011 count total (s) self (s) 1 0.000458 0.000004 let msl = s:GetMSL(a:lnum, 1) 1 0.000018 0.000005 if msl > 0 && s:Match(msl, s:one_line_scope_regex) return msl endif 1 0.000001 return 0 FUNCTION <SNR>83_IsInStringOrComment() Called 9 times Total time: 0.001633 Self time: 0.001633 count total (s) self (s) 9 0.001628 return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_strcom FUNCTION <SNR>83_ExitingOneLineScope() Called 1 time Total time: 0.000935 Self time: 0.000026 count total (s) self (s) 1 0.000456 0.000004 let msl = s:GetMSL(a:lnum, 1) 1 0.000001 if msl > 0 " if the current line is in a one line scope .. 1 0.000017 0.000004 if s:Match(msl, s:one_line_scope_regex) return 0 else 1 0.000434 0.000004 let prev_msl = s:GetMSL(msl - 1, 1) 1 0.000021 0.000007 if s:Match(prev_msl, s:one_line_scope_regex) return prev_msl endif 1 0.000000 endif 1 0.000000 endif 1 0.000000 return 0 FUNCTION <SNR>88_InvokeCompletion() Called 1 time Total time: 0.000180 Self time: 0.000027 count total (s) self (s) 1 0.000002 if &completefunc != "youcompleteme#Complete" return endif 1 0.000163 0.000010 if s:InsideCommentOrStringAndShouldStop() || s:OnBlankLine() return endif " This is tricky. First, having 'refresh' set to 'always' in the dictionary " that our completion function returns makes sure that our completion function " is called on every keystroke. Second, when the sequence of characters the " user typed produces no results in our search an infinite loop can occur. The " problem is that our feedkeys call triggers the OnCursorMovedI event which we " are tied to. We prevent this infinite loop from starting by making sure that " the user has moved the cursor since the last time we provided completion " results. 1 0.000002 if !s:cursor_moved return endif " <c-x><c-u> invokes the user's completion function (which we have set to " youcompleteme#Complete), and <c-p> tells Vim to select the previous " completion candidate. This is necessary because by default, Vim selects the " first candidate when completion is invoked, and selecting a candidate " automatically replaces the current text with it. Calling <c-p> forces Vim to " deselect the first candidate and in turn preserve the user's current text " until he explicitly chooses to replace it with a completion. 1 0.000005 call feedkeys( "\<C-X>\<C-U>\<C-P>", 'n' ) FUNCTION <SNR>88_IdentifierFinishedOperations() Called 1 time Total time: 0.000134 Self time: 0.000134 count total (s) self (s) 1 0.000030 if !pyeval( 'base.CurrentIdentifierFinished()' ) return endif 1 0.000099 py ycm_state.OnCurrentIdentifierFinished() 1 0.000003 let s:omnifunc_mode = 0 FUNCTION <SNR>88_InsideCommentOrString() Called 1 time Total time: 0.000110 Self time: 0.000110 count total (s) self (s) " Has to be col('.') -1 because col('.') doesn't exist at this point. We are " in insert mode when this func is called. 1 0.000101 let syntax_group = synIDattr( synIDtrans( synID( line( '.' ), col( '.' ) - 1, 1 ) ), 'name') 1 0.000003 if stridx(syntax_group, 'Comment') > -1 return 1 endif 1 0.000002 if stridx(syntax_group, 'String') > -1 return 2 endif 1 0.000000 return 0 FUNCTION <SNR>83_IndentWithContinuation() Called 1 time Total time: 0.000700 Self time: 0.000031 count total (s) self (s) " Set up variables to use and search for MSL to the previous line. 1 0.000002 let p_lnum = a:lnum 1 0.000644 0.000005 let lnum = s:GetMSL(a:lnum, 1) 1 0.000002 let line = getline(lnum) " If the previous line wasn't a MSL and is continuation return its indent. " TODO: the || s:IsInString() thing worries me a bit. 1 0.000001 if p_lnum != lnum if s:Match(p_lnum,s:continuation_regex)||s:IsInString(p_lnum,strlen(line)) return a:ind endif endif " Set up more variables now that we know we aren't continuation bound. 1 0.000002 let msl_ind = indent(lnum) " If the previous line ended with [*+/.-=], start a continuation that " indents an extra level. 1 0.000038 0.000008 if s:Match(lnum, s:continuation_regex) if lnum == p_lnum return msl_ind + a:width else return msl_ind endif endif 1 0.000001 return a:ind FUNCTION <SNR>88_OnCursorMovedNormalMode() Called 5 times Total time: 0.000708 Self time: 0.000117 count total (s) self (s) 5 0.000156 0.000028 if !s:AllowedToCompleteInCurrentFile() return endif 5 0.000357 0.000033 call s:UpdateDiagnosticNotifications() 5 0.000175 0.000036 call s:OnFileReadyToParse() FUNCTION <SNR>83_LineHasOpeningBrackets() Called 1 time Total time: 0.000211 Self time: 0.000103 count total (s) self (s) 1 0.000002 let open_0 = 0 1 0.000001 let open_2 = 0 1 0.000001 let open_4 = 0 1 0.000001 let line = getline(a:lnum) 1 0.000007 let pos = match(line, '[][(){}]', 0) 5 0.000005 while pos != -1 4 0.000119 0.000011 if !s:IsInStringOrComment(a:lnum, pos + 1) 4 0.000015 let idx = stridx('(){}[]', line[pos]) 4 0.000004 if idx % 2 == 0 2 0.000006 let open_{idx} = open_{idx} + 1 2 0.000002 else 2 0.000006 let open_{idx - 1} = open_{idx - 1} - 1 2 0.000001 endif 4 0.000002 endif 4 0.000018 let pos = match(line, '[][(){}]', pos + 1) 4 0.000003 endwhile 1 0.000003 return (open_0 > 0) . (open_2 > 0) . (open_4 > 0) FUNCTION <SNR>88_InsideCommentOrStringAndShouldStop() Called 1 time Total time: 0.000123 Self time: 0.000013 count total (s) self (s) 1 0.000116 0.000006 let retval = s:InsideCommentOrString() 1 0.000001 let inside_comment = retval == 1 1 0.000002 let inside_string = retval == 2 1 0.000002 if inside_comment && g:ycm_complete_in_comments || inside_string && g:ycm_complete_in_strings return 0 endif 1 0.000001 return retval FUNCTION 25() Called 13 times Total time: 0.000171 Self time: 0.000171 count total (s) self (s) 13 0.000069 if !exists("b:syntastic_loclist") let b:syntastic_loclist = g:SyntasticLoclist.New([]) endif 13 0.000024 return b:syntastic_loclist FUNCTIONS SORTED ON TOTAL TIME count total (s) self (s) function 1 0.004147 0.000201 GetJavascriptIndent() 4 0.001975 0.000225 <SNanonymous gist. -c, --copy Copy the resulting URL to the clipboard -e, --embed Copy the embed code for the gist to the clipboard -o, --open Open the resulting URL in a browser --no-open -P, --paste Paste from the clipboard to gist -h, --help Show this message. -v, --version Print the version.R>83_GetMSL() 5 0.001748 0.000223 <SNR>83_PrevNonBlankNonString() 9 0.001633 <SNR>83_IsInStringOrComment() 2 0.001301 0.000297 <SNR>83_IsInMultilineComment() 7 0.001065 UltiSnips_CursorMoved() 2 0.001004 <SNR>83_IsLineComment() 1 0.000935 0.000026 <SNR>83_ExitingOneLineScope() 5 0.000708 0.000117 <SNR>88_OnCursorMovedNormalMode() 1 0.000700 0.000031 <SNR>83_IndentWithContinuation() 8 0.000569 <SNR>71_Highlight_Matching_Pair() 1 0.000478 0.000011 <SNR>83_InOneLineScope() 1 0.000463 0.000100 <SNR>88_OnInsertLeave() 2 0.000451 0.000051 <SNR>88_OnCursorMovedInsertMode() 6 0.000427 <SNR>88_UpdateDiagnosticNotifications() 6 0.000367 0.000315 <SNR>88_OnFileReadyToParse() 4 0.000303 <SNR>83_IsInString() 2 0.000237 youcompleteme#Complete() 1 0.000211 0.000103 <SNR>83_LineHasOpeningBrackets() 9 0.000210 <SNR>88_AllowedToCompleteInCurrentFile() FUNCTIONS SORTED ON SELF TIME count total (s) self (s) function 9 0.001633 <SNR>83_IsInStringOrComment() 7 0.001065 UltiSnips_CursorMoved() 2 0.001004 <SNR>83_IsLineComment() 8 0.000569 <SNR>71_Highlight_Matching_Pair() 6 0.000427 <SNR>88_UpdateDiagnosticNotifications() 6 0.000367 0.000315 <SNR>88_OnFileReadyToParse() 4 0.000303 <SNR>83_IsInString() 2 0.001301 0.000297 <SNR>83_IsInMultilineComment() 2 0.000237 youcompleteme#Complete() 4 0.001975 0.000225 <SNR>83_GetMSL() 5 0.001748 0.000223 <SNR>83_PrevNonBlankNonString() 9 0.000210 <SNR>88_AllowedToCompleteInCurrentFile() 1 0.004147 0.000201 GetJavascriptIndent() 13 0.000171 25() 1 0.000134 <SNR>88_IdentifierFinishedOperations() 5 0.000708 0.000117 <SNR>88_OnCursorMovedNormalMode() 1 0.000110 <SNR>88_InsideCommentOrString() 1 0.000211 0.000103 <SNR>83_LineHasOpeningBrackets() 1 0.000463 0.000100 <SNR>88_OnInsertLeave() 5 0.000090 <SNR>83_Match() -
Pablo Olmos de Aguilera Corradini created this gist
Oct 14, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,377 @@ // Generated on 2013-10-13 using generator-webapp 0.4.3 'use strict'; // # Globbing // for performance reasons we're only matching one level down: // 'test/spec/{,*/}*.js' // use this if you want to recursively match all subfolders: // 'test/spec/**/*.js' module.exports = function (grunt) { // stylus task declaration grunt.loadNpmTasks('grunt-contrib-stylus'); // overriding compass task grunt.registerTask('compass', ['stylus']); // show elapsed time at the end require('time-grunt')(grunt); // load all grunt tasks require('load-grunt-tasks')(grunt); grunt.initConfig({ // configurable paths yeoman: { app: 'app', dist: 'dist' }, watch: { compass: { files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'], tasks: ['compass:server', 'autoprefixer'] }, stylus: { files: [ 'app/styles/**/*.styl' ], tasks: ['stylus'] }, styles: { files: ['<%= yeoman.app %>/styles/{,*/}*.css'], tasks: ['copy:styles', 'autoprefixer'] }, livereload: { options: { livereload: '<%= connect.options.livereload %>' }, files: [ '<%= yeoman.app %>/*.html', '.tmp/styles/{,*/}*.css', '{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js', '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}' ] } }, connect: { options: { port: 9000, livereload: 35729, // change this to '0.0.0.0' to access the server from outside hostname: 'localhost' }, livereload: { options: { open: true, base: [ '.tmp', '<%= yeoman.app %>' ] } }, test: { options: { base: [ '.tmp', 'test', '<%= yeoman.app %>' ] } }, dist: { options: { open: true, base: '<%= yeoman.dist %>' } } }, clean: { dist: { files: [{ dot: true, src: [ '.tmp', '<%= yeoman.dist %>/*', '!<%= yeoman.dist %>/.git*' ] }] }, server: '.tmp' }, jshint: { options: { jshintrc: '.jshintrc' }, all: [ 'Gruntfile.js', '<%= yeoman.app %>/scripts/{,*/}*.js', '!<%= yeoman.app %>/scripts/vendor/*', 'test/spec/{,*/}*.js' ] }, mocha: { all: { options: { run: true, urls: ['http://<%= connect.test.options.hostname %>:<%= connect.test.options.port %>/index.html'] } } }, compass: { options: { sassDir: '<%= yeoman.app %>/styles', cssDir: '.tmp/styles', generatedImagesDir: '.tmp/images/generated', imagesDir: '<%= yeoman.app %>/images', javascriptsDir: '<%= yeoman.app %>/scripts', fontsDir: '<%= yeoman.app %>/styles/fonts', importPath: '<%= yeoman.app %>/bower_components', httpImagesPath: '/images', httpGeneratedImagesPath: '/images/generated', httpFontsPath: '/styles/fonts', relativeAssets: false, assetCacheBuster: false }, dist: { options: { generatedImagesDir: '<%= yeoman.dist %>/images/generated' } }, server: { options: { debugInfo: true } } }, stylus: { compile: { options: { compress: true, paths: ['node_modules/grunt-contrib-stylus/node_modules'] }, files: { 'app/styles/*.css': ['app/styles/*.styl'] } } }, autoprefixer: { options: { browsers: ['last 1 version'] }, dist: { files: [{ expand: true, cwd: '.tmp/styles/', src: '{,*/}*.css', dest: '.tmp/styles/' }] } }, // not used since Uglify task does concat, // but still available if needed /*concat: { dist: {} },*/ requirejs: { dist: { // Options: https://github.com/jrburke/r.js/blob/master/build/example.build.js options: { // `name` and `out` is set by grunt-usemin baseUrl: '<%= yeoman.app %>/scripts', optimize: 'none', // TODO: Figure out how to make sourcemaps work with grunt-usemin // https://github.com/yeoman/grunt-usemin/issues/30 //generateSourceMaps: true, // required to support SourceMaps // http://requirejs.org/docs/errors.html#sourcemapcomments preserveLicenseComments: false, useStrict: true, wrap: true //uglify2: {} // https://github.com/mishoo/UglifyJS2 } } }, rev: { dist: { files: { src: [ '<%= yeoman.dist %>/scripts/{,*/}*.js', '<%= yeoman.dist %>/styles/{,*/}*.css', '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}', '<%= yeoman.dist %>/styles/fonts/{,*/}*.*' ] } } }, useminPrepare: { options: { dest: '<%= yeoman.dist %>' }, html: '<%= yeoman.app %>/index.html' }, usemin: { options: { dirs: ['<%= yeoman.dist %>'] }, html: ['<%= yeoman.dist %>/{,*/}*.html'], css: ['<%= yeoman.dist %>/styles/{,*/}*.css'] }, imagemin: { dist: { files: [{ expand: true, cwd: '<%= yeoman.app %>/images', src: '{,*/}*.{png,jpg,jpeg}', dest: '<%= yeoman.dist %>/images' }] } }, svgmin: { dist: { files: [{ expand: true, cwd: '<%= yeoman.app %>/images', src: '{,*/}*.svg', dest: '<%= yeoman.dist %>/images' }] } }, cssmin: { // This task is pre-configured if you do not wish to use Usemin // blocks for your CSS. By default, the Usemin block from your // `index.html` will take care of minification, e.g. // // <!-- build:css({.tmp,app}) styles/main.css --> // // dist: { // files: { // '<%= yeoman.dist %>/styles/main.css': [ // '.tmp/styles/{,*/}*.css', // '<%= yeoman.app %>/styles/{,*/}*.css' // ] // } // } }, htmlmin: { dist: { options: { /*removeCommentsFromCDATA: true, // https://github.com/yeoman/grunt-usemin/issues/44 //collapseWhitespace: true, collapseBooleanAttributes: true, removeAttributeQuotes: true, removeRedundantAttributes: true, useShortDoctype: true, removeEmptyAttributes: true, removeOptionalTags: true*/ }, files: [{ expand: true, cwd: '<%= yeoman.app %>', src: '*.html', dest: '<%= yeoman.dist %>' }] } }, // Put files not handled in other tasks here copy: { dist: { files: [{ expand: true, dot: true, cwd: '<%= yeoman.app %>', dest: '<%= yeoman.dist %>', src: [ '*.{ico,png,txt}', '.htaccess', 'images/{,*/}*.{webp,gif}', 'styles/fonts/{,*/}*.*' ] }] }, styles: { expand: true, dot: true, cwd: '<%= yeoman.app %>/styles', dest: '.tmp/styles/', src: '{,*/}*.css' } }, modernizr: { devFile: '<%= yeoman.app %>/bower_components/modernizr/modernizr.js', outputFile: '<%= yeoman.dist %>/bower_components/modernizr/modernizr.js', files: [ '<%= yeoman.dist %>/scripts/{,*/}*.js', '<%= yeoman.dist %>/styles/{,*/}*.css', '!<%= yeoman.dist %>/scripts/vendor/*' ], uglify: true }, concurrent: { server: [ 'stylus', 'copy:styles' ], test: [ 'copy:styles' ], dist: [ 'compass', 'copy:styles', 'imagemin', 'svgmin', 'htmlmin' ] }, bower: { options: { exclude: ['modernizr'] }, all: { rjsConfig: '<%= yeoman.app %>/scripts/main.js' } } }); grunt.registerTask('server', function (target) { if (target === 'dist') { return grunt.task.run(['build', 'connect:dist:keepalive']); } grunt.task.run([ 'clean:server', 'concurrent:server', 'autoprefixer', 'connect:livereload', 'watch' ]); }); grunt.registerTask('test', [ 'clean:server', 'concurrent:test', 'autoprefixer', 'connect:test', 'mocha' ]); grunt.registerTask('build', [ 'clean:dist', 'useminPrepare', 'concurrent:dist', 'autoprefixer', 'requirejs', 'concat', 'cssmin', 'uglify', 'modernizr', 'copy:dist', 'rev', 'usemin' ]); grunt.registerTask('default', [ 'jshint', 'test', 'build' ]); };