Skip to content

Instantly share code, notes, and snippets.

@justinmk
Created December 16, 2013 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinmk/7982490 to your computer and use it in GitHub Desktop.
Save justinmk/7982490 to your computer and use it in GitHub Desktop.
vim-airline issue #326, profile #2, moving in normal-modw with hjkl movement
FUNCTION airline#extensions#undotree#apply()
Called 1 time
Total time: 0.000027
Self time: 0.000027
count total (s) self (s)
1 0.000004 if exists('t:undotree')
if &ft == 'undotree'
if exists('*t:undotree.GetStatusLine')
call airline#extensions#apply_left_override('undo', '%{t:undotree.GetStatusLine()}')
else
call airline#extensions#apply_left_override('undotree', '%f')
endif
endif
if &ft == 'diff' && exists('*t:diffpanel.GetStatusLine')
call airline#extensions#apply_left_override('diff', '%{t:diffpanel.GetStatusLine()}')
endif
endif
FUNCTION airline#util#exec_funcrefs()
Called 2 times
Total time: 0.007871
Self time: 0.000163
count total (s) self (s)
7 0.000021 for Fn in a:list
7 0.007809 0.000101 let code = call(Fn, a:000)
7 0.000013 if code != 0
2 0.000002 return code
endif
5 0.000005 endfor
return 0
FUNCTION airline#extensions#unite#apply()
Called 1 time
Total time: 0.000024
Self time: 0.000024
count total (s) self (s)
1 0.000007 if &ft == 'unite'
call a:1.add_section('airline_a', ' Unite ')
call a:1.add_section('airline_b', ' %{get(unite#get_context(), "buffer_name", "")} ')
call a:1.add_section('airline_c', ' %{unite#get_status_string()} ')
call a:1.split()
call a:1.add_section('airline_y', ' %{get(unite#get_context(), "real_buffer_name", "")} ')
return 1
endif
FUNCTION airline#check_mode()
Called 636 times
Total time: 0.073783
Self time: 0.051090
count total (s) self (s)
636 0.003019 let context = s:contexts[a:winnr]
636 0.002254 if get(w:, 'airline_active', 1)
381 0.001245 let l:m = mode()
381 0.000855 if l:m ==# "i"
let l:mode = ['insert']
elseif l:m ==# "R"
let l:mode = ['replace']
elseif l:m =~# '\v(v|V||s|S|)'
let l:mode = ['visual']
else
381 0.001058 let l:mode = ['normal']
381 0.000346 endif
381 0.002162 let w:airline_current_mode = get(g:airline_mode_map, l:m, l:m)
381 0.000328 else
255 0.000614 let l:mode = ['inactive']
255 0.001236 let w:airline_current_mode = get(g:airline_mode_map, '__')
255 0.000210 endif
636 0.001013 if g:airline_detect_modified
636 0.001417 if &modified
call add(l:mode, 'modified')
endif
636 0.000393 endif
636 0.001287 if g:airline_detect_paste && &paste
call add(l:mode, 'paste')
endif
636 0.004323 let mode_string = join(l:mode)
636 0.003018 if get(w:, 'airline_lastmode', '') != mode_string
1 0.000183 0.000015 call airline#highlighter#highlight_modified_inactive(context.bufnr)
1 0.022542 0.000017 call airline#highlighter#highlight(l:mode)
1 0.000003 let w:airline_lastmode = mode_string
1 0.000000 endif
636 0.000669 return ''
FUNCTION <SNR>93_Highlight_Matching_Pair()
Called 130 times
Total time: 0.017258
Self time: 0.017258
count total (s) self (s)
" Remove any previous match.
130 0.000585 if exists('w:paren_hl_on') && w:paren_hl_on
2 0.000008 3match none
2 0.000004 let w:paren_hl_on = 0
2 0.000002 endif
" Avoid that we remove the popup menu.
" Return when there are no colors (looks like the cursor jumps).
130 0.001266 if pumvisible() || (&t_Co < 8 && !has("gui_running"))
return
endif
" Get the character under the cursor and check if it's in 'matchpairs'.
130 0.000481 let c_lnum = line('.')
130 0.000425 let c_col = col('.')
130 0.000237 let before = 0
130 0.000790 let c = getline(c_lnum)[c_col - 1]
130 0.002709 let plist = split(&matchpairs, '.\zs[:,]')
130 0.000611 let i = index(plist, c)
130 0.000205 if i < 0
" not found, in Insert mode try character before the cursor
128 0.000604 if c_col > 1 && (mode() == 'i' || mode() == 'R')
let before = 1
let c = getline(c_lnum)[c_col - 2]
let i = index(plist, c)
endif
128 0.000155 if i < 0
" not found, nothing to do
128 0.000123 return
endif
endif
" Figure out the arguments for searchpairpos().
2 0.000003 if i % 2 == 0
let s_flags = 'nW'
let c2 = plist[i + 1]
else
2 0.000004 let s_flags = 'nbW'
2 0.000003 let c2 = c
2 0.000006 let c = plist[i - 1]
2 0.000002 endif
2 0.000005 if c == '['
let c = '\['
let c2 = '\]'
endif
" Find the match. When it was just before the cursor move it there for a
" moment.
2 0.000002 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.
2 0.000008 let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' . '=~? "string\\|character\\|singlequote\\|escape\\|comment"'
2 0.002741 execute 'if' s_skip '| let s_skip = 0 | endif'
" Limit the search to lines visible in the window.
2 0.000010 let stoplinebottom = line('w$')
2 0.000008 let stoplinetop = line('w0')
2 0.000003 if i % 2 == 0
let stopline = stoplinebottom
else
2 0.000004 let stopline = stoplinetop
2 0.000001 endif
" Limit the search time to 300 msec to avoid a hang on very long lines.
" This fails when a timeout is not supported.
2 0.000008 if mode() == 'i' || mode() == 'R'
let timeout = exists("b:matchparen_insert_timeout") ? b:matchparen_insert_timeout : g:matchparen_insert_timeout
else
2 0.000011 let timeout = exists("b:matchparen_timeout") ? b:matchparen_timeout : g:matchparen_timeout
2 0.000002 endif
2 0.000004 try
2 0.002975 let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, timeout)
2 0.000006 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
2 0.000004 if before > 0
call winrestview(save_cursor)
endif
" If a match is found setup match highlighting.
2 0.000006 if m_lnum > 0 && m_lnum >= stoplinetop && m_lnum <= stoplinebottom
2 0.000141 exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) . 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/'
2 0.000007 let w:paren_hl_on = 1
2 0.000002 endif
FUNCTION airline#util#append()
Called 762 times
Total time: 0.010436
Self time: 0.010436
count total (s) self (s)
762 0.001990 if a:minwidth > 0 && winwidth(0) < a:minwidth
return ''
endif
762 0.003708 let prefix = s:spc == "\ua0" ? s:spc : s:spc.s:spc
762 0.002869 return empty(a:text) ? '' : prefix.g:airline_left_alt_sep.s:spc.a:text
FUNCTION <SNR>118_get_section()
Called 12 times
Total time: 0.000511
Self time: 0.000455
count total (s) self (s)
12 0.000068 if has_key(s:section_truncate_width, a:key)
7 0.000033 if winwidth(a:winnr) < s:section_truncate_width[a:key]
3 0.000005 return ''
endif
4 0.000002 endif
9 0.000026 let spc = g:airline_symbols.space
9 0.000169 0.000113 let text = airline#util#getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key})
9 0.000089 let [prefix, suffix] = [get(a:000, 0, '%('.spc), get(a:000, 1, spc.'%)')]
9 0.000054 return empty(text) ? '' : prefix.text.suffix
FUNCTION <SNR>105_is_excluded_window()
Called 2 times
Total time: 0.000182
Self time: 0.000182
count total (s) self (s)
2 0.000008 for matchft in g:airline_exclude_filetypes
if matchft ==# &ft
return 1
endif
endfor
8 0.000020 for matchw in g:airline_exclude_filenames
6 0.000081 if matchstr(expand('%'), matchw) ==# matchw
return 1
endif
6 0.000006 endfor
2 0.000005 if g:airline_exclude_preview && &previewwindow
return 1
endif
2 0.000002 return 0
FUNCTION airline#themes#get_highlight()
Called 2098 times
Total time: 0.379662
Self time: 0.021526
count total (s) self (s)
2098 0.378467 0.020331 return call('airline#highlighter#get_highlight', [a:group] + a:000)
FUNCTION <SNR>111_on_cursormove()
Called 130 times
Total time: 0.001748
Self time: 0.001748
count total (s) self (s)
130 0.000343 if a:total_count >= a:min_count
130 0.000304 if &showtabline != 2
set showtabline=2
endif
130 0.000107 else
if &showtabline != 0
set showtabline=0
endif
endif
FUNCTION <SNR>122_wrap_name()
Called 510 times
Total time: 0.010227
Self time: 0.010227
count total (s) self (s)
510 0.003488 let _ = s:buf_nr_show ? printf(s:buf_nr_format, a:bufnr) : ''
510 0.001527 let _ .= a:buffer_name
510 0.002502 if getbufvar(a:bufnr, '&modified') == 1
let _ .= s:buf_modified_symbol
endif
510 0.000627 return _
FUNCTION <SNR>67_invoke_funcrefs()
Called 2 times
Total time: 0.008161
Self time: 0.000124
count total (s) self (s)
2 0.000115 0.000025 let builder = airline#builder#new(a:context)
2 0.007907 0.000036 let err = airline#util#exec_funcrefs(a:funcrefs + s:core_funcrefs, builder, a:context)
2 0.000004 if err == 1
2 0.000092 0.000016 let a:context.line = builder.build()
2 0.000015 let s:contexts[a:context.winnr] = a:context
2 0.000022 call setwinvar(a:context.winnr, '&statusline', '%!airline#statusline('.a:context.winnr.')')
2 0.000002 endif
FUNCTION <SNR>118_build_sections()
Called 3 times
Total time: 0.006826
Self time: 0.000218
count total (s) self (s)
14 0.000025 for key in a:keys
11 0.000036 if key == 'warning' && !a:context.active
1 0.000001 continue
endif
10 0.006694 0.000086 call s:add_section(a:builder, a:context, key)
10 0.000010 endfor
FUNCTION <SNR>113_exec_separator()
Called 1049 times
Total time: 0.522551
Self time: 0.047753
count total (s) self (s)
1049 0.201916 0.007784 let l:from = airline#themes#get_highlight(a:from.a:suffix)
1049 0.192970 0.007440 let l:to = airline#themes#get_highlight(a:to.a:suffix)
1049 0.005153 let group = a:from.'_to_'.a:to.a:suffix
1049 0.001622 if a:inverse
521 0.003552 let colors = [ l:from[1], l:to[1], l:from[3], l:to[3] ]
521 0.000521 else
528 0.003396 let colors = [ l:to[1], l:from[1], l:to[3], l:from[3] ]
528 0.000496 endif
1049 0.004112 let a:dict[group] = colors
1049 0.102417 0.007281 call airline#highlighter#exec(group, colors)
FUNCTION airline#parts#filetype()
Called 636 times
Total time: 0.002202
Self time: 0.002202
count total (s) self (s)
636 0.001629 return &filetype
FUNCTION airline#parts#iminsert()
Called 381 times
Total time: 0.002852
Self time: 0.002852
count total (s) self (s)
381 0.001096 if g:airline_detect_iminsert && &iminsert && exists('b:keymap_name')
return toupper(b:keymap_name)
endif
381 0.000316 return ''
FUNCTION airline#highlighter#add_separator()
Called 1029 times
Total time: 0.536707
Self time: 0.023816
count total (s) self (s)
1029 0.008410 let s:separators[a:from.a:to] = [a:from, a:to, a:inverse]
1029 0.527372 0.014481 call <sid>exec_separator({}, a:from, a:to, a:inverse, '')
FUNCTION signature#SignRefresh()
Called 1 time
Total time: 0.011561
Self time: 0.000882
count total (s) self (s)
" Description: Add signs for new marks/markers and remove signs for deleted marks/markers
" Arguments: '1' to force a sign refresh
1 0.000013 if !exists('b:sig_enabled') | let b:sig_enabled = 1 | endif
" If Signature has been disabled, return
1 0.000006 if ( !b:sig_enabled ) | return | endif
1 0.000010 if !exists('b:sig_marks') | let b:sig_marks = {} | endif
" b:sig_marks = { lnum:signs_str }
1 0.000008 if !exists('b:sig_markers') | let b:sig_markers = {} | endif
" b:sig_markers = { lnum:marker }
1 0.000016 let l:SignatureIncludeMarks = ( exists('b:SignatureIncludeMarks') ? b:SignatureIncludeMarks : g:SignatureIncludeMarks )
1 0.002378 0.000033 let l:used_marks = map( copy(s:MarksList( "used" )), 'v:val[0]')
53 0.001978 0.000119 for i in s:MarksList( "free" )
" ... remove it
52 0.005784 0.000504 call s:ToggleSign( i, 0, 0 )
52 0.000063 endfor
" Add signs for marks ...
1 0.001204 0.000009 for j in s:MarksList( "used" )
" ... if mark is not present in our b:sig_marks list or if it is present but at the wrong line,
" remove the old sign and add a new one
if !has_key( b:sig_marks, j[1] ) || b:sig_marks[j[1]] !~# j[0] || ( a:0 > 0 && a:1 )
call s:ToggleSign( j[0], 0, 0 )
call s:ToggleSign( j[0], 1, j[1] )
endif
endfor
FUNCTION <SNR>118_add_section()
Called 10 times
Total time: 0.006608
Self time: 0.000291
count total (s) self (s)
" i have no idea why the warning section needs special treatment, but it's
" needed to prevent separators from showing up
10 0.000026 if a:key == 'warning'
1 0.000009 0.000006 call a:builder.add_raw('%(')
1 0.000001 endif
10 0.006450 0.000139 call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key))
10 0.000026 if a:key == 'warning'
1 0.000008 0.000005 call a:builder.add_raw('%)')
1 0.000000 endif
FUNCTION airline#extensions#tabline#get_buffer_name()
Called 510 times
Total time: 0.041732
Self time: 0.006925
count total (s) self (s)
510 0.041423 0.006616 return airline#extensions#tabline#formatters#{s:formatter}(a:nr, get(s:, 'current_buffer_list', []))
FUNCTION airline#highlighter#get_highlight()
Called 2098 times
Total time: 0.358136
Self time: 0.107071
count total (s) self (s)
2098 0.127821 0.014663 let fg = s:get_syn(a:group, 'fg')
2098 0.121434 0.015580 let bg = s:get_syn(a:group, 'bg')
2098 0.053857 let reverse = synIDattr(synIDtrans(hlID(a:group)), 'reverse', has('gui_running') ? 'gui' : 'term')
2098 0.052293 0.020240 return reverse ? s:get_array(bg, fg, a:000) : s:get_array(fg, bg, a:000)
FUNCTION airline#extensions#default#apply()
Called 2 times
Total time: 0.007295
Self time: 0.000167
count total (s) self (s)
2 0.000008 let winnr = a:context.winnr
2 0.000007 let active = a:context.active
2 0.000041 0.000027 if airline#util#getwinvar(winnr, 'airline_render_left', active || (!active && !g:airline_inactive_collapse))
1 0.001710 0.000009 call <sid>build_sections(a:builder, a:context, s:layout[0])
1 0.000001 else
1 0.000134 0.000016 call a:builder.add_section('airline_c'.(a:context.bufnr), ' %f%m ')
1 0.000002 endif
2 0.000199 0.000038 call a:builder.split(s:get_section(winnr, 'gutter', '', ''))
2 0.000023 0.000014 if airline#util#getwinvar(winnr, 'airline_render_right', 1)
2 0.005146 0.000021 call <sid>build_sections(a:builder, a:context, s:layout[1])
2 0.000002 endif
2 0.000002 return 1
FUNCTION airline#util#wrap()
Called 1398 times
Total time: 0.009374
Self time: 0.009374
count total (s) self (s)
1398 0.004169 if a:minwidth > 0 && winwidth(0) < a:minwidth
return ''
endif
1398 0.001661 return a:text
FUNCTION airline#extensions#tabline#get()
Called 255 times
Total time: 0.739116
Self time: 0.006209
count total (s) self (s)
255 0.001913 if s:show_buffers && tabpagenr('$') == 1
return s:get_buffers()
else
255 0.735391 0.002484 return s:get_tabs()
endif
FUNCTION 92()
Called 257 times
Total time: 0.002281
Self time: 0.002281
count total (s) self (s)
257 0.000564 let self._side = 0
257 0.001409 let self._line .= '%#'.self._curgroup.'#'.(a:0 ? a:1 : '%=')
FUNCTION 94()
Called 1286 times
Total time: 0.670408
Self time: 0.133701
count total (s) self (s)
1286 0.003399 if self._curgroup != ''
1029 0.002616 if self._curgroup == a:group
let self._line .= self._side ? self._context.left_alt_sep : self._context.right_alt_sep
else
1029 0.544227 0.007520 call airline#highlighter#add_separator(self._curgroup, a:group, self._side)
1029 0.008384 let self._line .= '%#'.self._curgroup.'_to_'.a:group.'#'
1029 0.004970 let self._line .= self._side ? self._context.left_sep : self._context.right_sep
1029 0.000988 endif
1029 0.000627 endif
1286 0.003391 if self._curgroup != a:group
1286 0.005150 let self._line .= '%#'.a:group.'#'
1286 0.001050 endif
1286 0.001892 if self._context.active
1282 0.002811 let contents = []
1282 0.012758 let content_parts = split(a:contents, '__accent')
2309 0.005059 for cpart in content_parts
1027 0.009640 let accent = matchstr(cpart, '_\zs[^#]*\ze')
1027 0.004184 call add(contents, cpart)
1027 0.001309 endfor
1282 0.006046 let line = join(contents, a:group)
1282 0.011173 let line = substitute(line, '__restore__', a:group, 'g')
1282 0.001280 else
4 0.000072 let line = substitute(a:contents, '%#__accent[^#]*#', '', 'g')
4 0.000046 let line = substitute(line, '%#__restore__#', '', 'g')
4 0.000004 endif
1286 0.003430 let self._line .= line
1286 0.002837 let self._curgroup = a:group
FUNCTION 95()
Called 257 times
Total time: 0.001007
Self time: 0.001007
count total (s) self (s)
257 0.000815 let self._line .= a:text
FUNCTION 96()
Called 257 times
Total time: 0.002371
Self time: 0.002371
count total (s) self (s)
257 0.000577 if !self._context.active
1 0.000062 let self._line = substitute(self._line, '%#.\{-}\ze#', '\0_inactive', 'g')
1 0.000001 endif
257 0.000439 return self._line
FUNCTION airline#util#getwinvar()
Called 13 times
Total time: 0.000079
Self time: 0.000079
count total (s) self (s)
13 0.000065 return getwinvar(a:winnr, a:key, a:def)
FUNCTION airline#extensions#tabline#title()
Called 510 times
Total time: 0.050676
Self time: 0.008944
count total (s) self (s)
510 0.002842 let buflist = tabpagebuflist(a:n)
510 0.001772 let winnr = tabpagewinnr(a:n)
510 0.045409 0.003677 return airline#extensions#tabline#get_buffer_name(buflist[winnr - 1])
FUNCTION <SNR>55_MarksList()
Called 3 times
Total time: 0.005399
Self time: 0.005399
count total (s) self (s)
" Description: Takes two optional arguments - mode and line no.
" If no arguments are specified, returns a list of [mark, line no.] pairs that are in use in the buffer
" or are free to be placed in which case, line no. is 0
"
" Arguments: a:1 (mode) = 'used' : Returns list of [ [used marks => line no.] ]
" 'free' : Returns list of [ free marks ]
" a:2 (line no.) : Returns list of used marks on current line. Note that mode = 'free' is meaningless here
" and thus, is ignored
3 0.000034 let l:SignatureIncludeMarks = ( exists('b:SignatureIncludeMarks') ? b:SignatureIncludeMarks : g:SignatureIncludeMarks )
3 0.000011 let l:marks_list = []
" Add local marks first
81 0.001209 for i in filter( split( l:SignatureIncludeMarks, '\zs' ), 'v:val =~# "[a-z]"' )
78 0.000641 let l:marks_list = add(l:marks_list, [i, line("'" . i)])
78 0.000093 endfor
" Add global (uppercase) marks to list only if it is in use in this buffer or hasn't been used at all.
81 0.001170 for i in filter( split( l:SignatureIncludeMarks, '\zs' ), 'v:val =~# "[A-Z]"' )
78 0.000648 let [ l:buf, l:line, l:col, l:off ] = getpos( "'" . i )
78 0.000343 if l:buf == bufnr('%') || l:buf == 0
78 0.000495 let l:marks_list = add(l:marks_list, [i, l:line])
78 0.000082 endif
78 0.000065 endfor
3 0.000006 if ( a:0 == 0 )
return l:marks_list
elseif (( a:0 == 1 ) && ( a:1 ==? "used" ))
2 0.000203 return filter( l:marks_list, 'v:val[1] > 0' )
elseif (( a:0 == 1 ) && ( a:1 ==? "free" ))
1 0.000169 return map( filter( l:marks_list, 'v:val[1] == 0' ), 'v:val[0]' )
elseif (( a:0 == 2 ) && ( a:2 > 0 ))
return map( filter( l:marks_list, 'v:val[1] == ' . a:2 ), 'v:val[0]' )
endif
FUNCTION airline#highlighter#highlight()
Called 1 time
Total time: 0.022525
Self time: 0.005302
count total (s) self (s)
1 0.000005 let p = g:airline#themes#{g:airline_theme}#palette
" draw the base mode, followed by any overrides
1 0.000009 let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val')
1 0.000004 let suffix = a:modes[0] == 'inactive' ? '_inactive' : ''
2 0.000004 for mode in mapped
1 0.000006 if exists('g:airline#themes#{g:airline_theme}#palette[mode]')
1 0.000004 let dict = g:airline#themes#{g:airline_theme}#palette[mode]
28 0.000083 for kvp in items(dict)
27 0.000114 let mode_colors = kvp[1]
27 0.002677 0.000253 call airline#highlighter#exec(kvp[0].suffix, mode_colors)
81 0.000303 for accent in keys(s:accents)
54 0.000211 if !has_key(p.accents, accent)
continue
endif
54 0.000324 let colors = copy(mode_colors)
54 0.000266 if p.accents[accent][0] != ''
27 0.000148 let colors[0] = p.accents[accent][0]
27 0.000031 endif
54 0.000187 if p.accents[accent][2] != ''
27 0.000122 let colors[2] = p.accents[accent][2]
27 0.000029 endif
54 0.000143 if len(colors) >= 5
12 0.000072 let colors[4] = get(p.accents[accent], 4, '')
12 0.000013 else
42 0.000233 call add(colors, get(p.accents[accent], 4, ''))
42 0.000033 endif
54 0.005698 0.000559 call airline#highlighter#exec(kvp[0].suffix.'_'.accent, colors)
54 0.000099 endfor
27 0.000020 endfor
" TODO: optimize this
21 0.000070 for sep in items(s:separators)
20 0.009964 0.000304 call <sid>exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix)
20 0.000034 endfor
1 0.000001 endif
1 0.000001 endfor
FUNCTION unite#handlers#_on_cursor_hold()
Called 1 time
Total time: 0.000203
Self time: 0.000183
count total (s) self (s)
1 0.000014 let is_async = 0
1 0.000048 0.000028 call s:restore_statusline()
1 0.000005 if &filetype ==# 'unite'
" Redraw.
call unite#redraw()
call s:change_highlight()
let unite = unite#get_current_unite()
let is_async = unite.is_async
if !unite.is_async && unite.context.auto_quit
call unite#force_quit_session()
endif
else
" Search other unite window.
1 0.000046 for winnr in filter(range(1, winnr('$')), "getbufvar(winbufnr(v:val), '&filetype') ==# 'unite'")
let unite = getbufvar(winbufnr(winnr), 'unite')
if unite.is_async
" Redraw unite buffer.
call unite#redraw(winnr)
let is_async = unite.is_async
endif
endfor
1 0.000002 endif
1 0.000003 if is_async
" Ignore key sequences.
call feedkeys("g\<ESC>", 'n')
endif
FUNCTION airline#parts#readonly()
Called 381 times
Total time: 0.001542
Self time: 0.001542
count total (s) self (s)
381 0.001216 return &readonly ? g:airline_symbols.readonly : ''
FUNCTION UndotreeUpdate()
Called 130 times
Total time: 0.001356
Self time: 0.001356
count total (s) self (s)
130 0.000888 if !exists('t:undotree')
130 0.000206 return
endif
if !exists('w:undotree_id')
let w:undotree_id = 'id_'.s:getUniqueID()
call s:log("Unique window id assigned: ".w:undotree_id)
endif
" assume window layout won't change during updating.
let thiswinnr = winnr()
call t:undotree.Update()
" focus moved
if winnr() != thiswinnr
call s:exec("norm! ".thiswinnr."\<c-w>\<c-w>")
endif
FUNCTION airline#parts#paste()
Called 381 times
Total time: 0.001760
Self time: 0.001760
count total (s) self (s)
381 0.001448 return g:airline_detect_paste && &paste ? g:airline_symbols.paste : ''
FUNCTION airline#update_statusline()
Called 1 time
Total time: 0.008323
Self time: 0.000162
count total (s) self (s)
2 0.000020 for nr in filter(range(1, winnr('$')), 'v:val != winnr()')
1 0.000009 call setwinvar(nr, 'airline_active', 0)
1 0.000011 let context = { 'winnr': nr, 'active': 0, 'bufnr': winbufnr(nr) }
1 0.003423 0.000021 call s:invoke_funcrefs(context, s:inactive_funcrefs)
1 0.000001 endfor
1 0.000003 unlet! w:airline_render_left
1 0.000002 unlet! w:airline_render_right
9 0.000014 for section in s:sections
8 0.000028 unlet! w:airline_section_{section}
8 0.000007 endfor
1 0.000003 let w:airline_active = 1
1 0.000009 let context = { 'winnr': winnr(), 'active': 1, 'bufnr': winbufnr(winnr()) }
1 0.004769 0.000010 call s:invoke_funcrefs(context, g:airline_statusline_funcrefs)
FUNCTION <SNR>105_sync_active_winnr()
Called 130 times
Total time: 0.009917
Self time: 0.001594
count total (s) self (s)
130 0.001015 if exists('#airline') && winnr() != s:active_winnr
1 0.008336 0.000013 call airline#update_statusline()
1 0.000001 endif
FUNCTION airline#parts#mode()
Called 381 times
Total time: 0.001963
Self time: 0.001963
count total (s) self (s)
381 0.001637 return get(w:, 'airline_current_mode', '')
FUNCTION airline#highlighter#exec()
Called 1131 times
Total time: 0.102831
Self time: 0.102831
count total (s) self (s)
1131 0.002635 let colors = a:colors
1131 0.001774 if s:is_win32term
let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, ''))
let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, ''))
endif
1131 0.085367 exec printf('hi %s %s %s %s %s %s %s %s', a:group, get(colors, 0, '') != '' ? 'guifg='.colors[0] : '', get(colors, 1, '') != '' ? 'guibg='.colors[1] : '', get(colors, 2, '') != '' ? 'ctermfg='.colors[2] : '', get(colors, 3, '') != '' ? 'ctermbg='.colors[3] : '', get(colors, 4, '') != '' ? 'gui='.colors[4] : '', get(colors, 4, '') != '' ? 'cterm='.colors[4] : '', get(colors, 4, '') != '' ? 'term='.colors[4] : '')
FUNCTION <SNR>113_get_array()
Called 2098 times
Total time: 0.032053
Self time: 0.032053
count total (s) self (s)
2098 0.004907 let fg = a:fg
2098 0.003605 let bg = a:bg
2098 0.021071 return has('gui_running') ? [ fg, bg, '', '', join(a:opts, ',') ] : [ '', '', fg, bg, join(a:opts, ',') ]
FUNCTION airline#extensions#tabline#formatters#default()
Called 510 times
Total time: 0.034807
Self time: 0.024580
count total (s) self (s)
510 0.001054 let _ = ''
510 0.002139 let name = bufname(a:bufnr)
510 0.001243 if empty(name)
let _ .= '[No Name]'
else
510 0.000800 if s:fnamecollapse
510 0.010371 let _ .= substitute(fnamemodify(name, s:fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g')
510 0.000560 else
let _ .= fnamemodify(name, s:fmod)
endif
510 0.000576 endif
510 0.013607 0.003380 return s:wrap_name(a:bufnr, _)
FUNCTION <SNR>55_ToggleSign()
Called 52 times
Total time: 0.005280
Self time: 0.005280
count total (s) self (s)
" Description: Enable/Disable/Toggle signs for marks/markers on the specified line number, depending on value of mode
" Arguments:
" sign : The mark/marker whose sign is to be placed/removed/toggled
" mode = 0 : Remove
" 1 : Place
" lnum : Line number on which the sign is to be placed.
" If mode = 0, the line number is ignored and 'sign' is removed from all lines
"echom "DEBUG: sign = " . a:sign . ", mode = " . a:mode . ", lnum = " . a:lnum
52 0.000508 let l:SignatureIncludeMarkers = ( exists('b:SignatureIncludeMarkers') ? b:SignatureIncludeMarkers : g:SignatureIncludeMarkers )
52 0.000451 let l:SignatureMarkOrder = ( exists('b:SignatureMarkOrder') ? b:SignatureMarkOrder : g:SignatureMarkOrder )
52 0.000491 let l:SignaturePrioritizeMarks = ( exists('b:SignaturePrioritizeMarks') ? b:SignaturePrioritizeMarks : g:SignaturePrioritizeMarks )
52 0.000153 let l:lnum = a:lnum
52 0.000296 let l:id = ( winbufnr(0) + 1 ) * l:lnum
52 0.000626 if stridx( l:SignatureIncludeMarkers, a:sign ) >= 0 " Toggle sign for markers {{{3
if a:mode
let b:sig_markers[l:lnum] = a:sign . get( b:sig_markers, l:lnum, "" )
else
let b:sig_markers[l:lnum] = substitute( b:sig_markers[l:lnum], "\\C" . a:sign, "", "" )
" If there are no markers on the line, delete signs on that line
if b:sig_markers[l:lnum] == ""
call remove( b:sig_markers, l:lnum )
endif
endif
else " Toggle sign for marks {{{3
52 0.000087 if a:mode
let b:sig_marks[l:lnum] = a:sign . get( b:sig_marks, l:lnum, "" )
else
52 0.000482 let l:arr = keys( filter( copy(b:sig_marks), 'v:val =~# a:sign' ))
52 0.000220 if empty(l:arr) | return | endif
let l:lnum = l:arr[0]
let l:id = ( winbufnr(0) + 1 ) * l:lnum
let b:sig_marks[l:lnum] = substitute( b:sig_marks[l:lnum], "\\C" . a:sign, "", "" )
" If there are no marks on the line, delete signs on that line
if b:sig_marks[l:lnum] == ""
call remove( b:sig_marks, l:lnum )
endif
endif
endif
" TODO: Place sign only if there are no signs from other plugins (eg. syntastic)
if ( has_key( b:sig_marks, l:lnum ) && ( l:SignaturePrioritizeMarks || !has_key( b:sig_markers, l:lnum )))
let l:str = substitute( l:SignatureMarkOrder, "\m", strpart( b:sig_marks[l:lnum], 0, 1 ), "" )
let l:str = substitute( l:str, "\p", strpart( b:sig_marks[l:lnum], 1, 1 ), "" )
execute 'sign define sig_Sign_' . l:id . ' text=' . l:str . ' texthl=' . g:SignatureMarkTextHL
elseif has_key( b:sig_markers, l:lnum )
let l:str = strpart( b:sig_markers[l:lnum], 0, 1 )
execute 'sign define sig_Sign_' . l:id . ' text=' . l:str . ' texthl=' . g:SignatureMarkerTextHL
else
execute 'sign unplace ' . l:id
return
endif
execute 'sign place ' . l:id . ' line=' . l:lnum . ' name=sig_Sign_' . l:id . ' buffer=' . winbufnr(0)
FUNCTION <SNR>111_get_buffer_list()
Called 130 times
Total time: 0.073473
Self time: 0.073473
count total (s) self (s)
130 0.000328 let buffers = []
130 0.000806 let cur = bufnr('%')
3640 0.004852 for nr in range(1, bufnr('$'))
3510 0.010486 if buflisted(nr) && bufexists(nr)
2990 0.005105 for ex in s:excludes
if match(bufname(nr), ex)
continue
endif
endfor
2990 0.009763 if getbufvar(nr, 'current_syntax') == 'qf'
130 0.000177 continue
endif
2860 0.006844 call add(buffers, nr)
2860 0.002090 endif
3380 0.002173 endfor
130 0.001027 let s:current_buffer_list = buffers
130 0.000187 return buffers
FUNCTION airline#extensions#quickfix#apply()
Called 1 time
Total time: 0.000015
Self time: 0.000015
count total (s) self (s)
1 0.000004 if &buftype == 'quickfix'
let w:airline_section_a = s:get_text()
let w:airline_section_b = '%{get(w:, "quickfix_title", "")}'
let w:airline_section_c = ''
let w:airline_section_x = ''
endif
FUNCTION <SNR>111_get_tabs()
Called 255 times
Total time: 0.732907
Self time: 0.052299
count total (s) self (s)
255 0.012766 0.002064 let b = airline#builder#new(s:builder_context)
765 0.002343 for i in range(1, tabpagenr('$'))
510 0.001608 if i == tabpagenr()
255 0.000596 let group = 'airline_tabsel'
255 0.000430 if g:airline_detect_modified
765 0.001801 for bi in tabpagebuflist(i)
510 0.002328 if getbufvar(bi, '&modified')
let group = 'airline_tabmod'
endif
510 0.000443 endfor
255 0.000183 endif
255 0.000530 else
255 0.000558 let group = 'airline_tab'
255 0.000182 endif
510 0.000935 let val = '%('
510 0.000900 if s:tab_nr_type == 0
let val .= ' %{len(tabpagebuflist('.i.'))}'
else
510 0.003103 let val .= (g:airline_symbols.space).i
510 0.000426 endif
510 0.202692 0.006521 call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)')
510 0.000819 endfor
255 0.002473 0.001472 call b.add_raw('%T')
255 0.153292 0.001562 call b.add_section('airline_tabfill', '')
255 0.003588 0.001327 call b.split()
255 0.160987 0.001836 call b.add_section('airline_tab', ' %999XX ')
255 0.159456 0.002159 call b.add_section('airline_tabtype', ' tabs ')
255 0.003797 0.001502 return b.build()
FUNCTION <SNR>121_add_register()
Called 130 times
Total time: 0.003869
Self time: 0.003869
count total (s) self (s)
130 0.001161 let reg = [getreg(a:name), getregtype(a:name)]
130 0.000670 if get(s:prev_registers, a:name, []) ==# reg
" Skip same register value.
return
endif
130 0.000745 let len_history = len(reg[0])
" Ignore too long yank.
130 0.000326 if len_history < 2 || len_history > 100000
130 0.000121 return
endif
let s:prev_registers[a:name] = reg
" Append register value.
call insert(s:yank_histories, reg)
FUNCTION airline#extensions#apply()
Called 2 times
Total time: 0.000347
Self time: 0.000165
count total (s) self (s)
2 0.000009 let s:active_winnr = winnr()
2 0.000203 0.000021 if s:is_excluded_window()
return -1
endif
2 0.000006 if &buftype == 'help'
call airline#extensions#apply_left_override('Help', '%f')
let w:airline_section_x = ''
let w:airline_section_y = ''
let w:airline_render_right = 1
endif
2 0.000003 if &previewwindow
let w:airline_section_a = 'Preview'
let w:airline_section_b = ''
let w:airline_section_c = bufname(winbufnr(winnr()))
endif
2 0.000021 if has_key(s:filetype_overrides, &ft)
let args = s:filetype_overrides[&ft]
call airline#extensions#apply_left_override(args[0], args[1])
endif
2 0.000011 for item in items(s:filetype_regex_overrides)
if match(&ft, item[0]) >= 0
call airline#extensions#apply_left_override(item[1][0], item[1][1])
endif
endfor
FUNCTION airline#statusline()
Called 636 times
Total time: 0.012945
Self time: 0.012945
count total (s) self (s)
636 0.005970 if has_key(s:contexts, a:winnr)
636 0.005513 return '%{airline#check_mode('.a:winnr.')}'.s:contexts[a:winnr].line
endif
" in rare circumstances this happens...see #276
return ''
FUNCTION airline#highlighter#highlight_modified_inactive()
Called 1 time
Total time: 0.000168
Self time: 0.000036
count total (s) self (s)
1 0.000006 if getbufvar(a:bufnr, '&modified')
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c') ? g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c : []
else
1 0.000010 let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c') ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c : []
1 0.000000 endif
1 0.000002 if !empty(colors)
1 0.000141 0.000009 call airline#highlighter#exec('airline_c'.(a:bufnr).'_inactive', colors)
1 0.000001 endif
FUNCTION <SNR>165_restore_statusline()
Called 1 time
Total time: 0.000020
Self time: 0.000020
count total (s) self (s)
1 0.000012 if &filetype !=# 'unite' || !g:unite_force_overwrite_statusline
1 0.000003 return
endif
let unite = unite#get_current_unite()
if &l:statusline != unite.statusline
" Restore statusline.
let &l:statusline = unite.statusline
endif
FUNCTION <SNR>113_get_syn()
Called 4196 times
Total time: 0.219012
Self time: 0.219012
count total (s) self (s)
" need to pass in mode, known to break on 7.3.547
4196 0.025161 let mode = has('gui_running') ? 'gui' : 'cterm'
4196 0.100146 let color = synIDattr(synIDtrans(hlID(a:group)), a:what, mode)
4196 0.015634 if empty(color) || color == -1
10 0.000236 let color = synIDattr(synIDtrans(hlID('Normal')), a:what, mode)
10 0.000012 endif
4196 0.011203 if empty(color) || color == -1
if has('gui_running')
let color = a:what ==# 'fg' ? '#000000' : '#FFFFFF'
else
let color = a:what ==# 'fg' ? 0 : 1
endif
endif
4196 0.004996 return color
FUNCTION <SNR>121_load()
Called 130 times
Total time: 0.005993
Self time: 0.005993
count total (s) self (s)
130 0.005582 if !filereadable(g:unite_source_history_yank_file) || s:yank_histories_file_mtime == getftime(g:unite_source_history_yank_file)
130 0.000180 return
endif
let file = readfile(g:unite_source_history_yank_file)
if empty(file)
return
endif
try
sandbox let s:yank_histories = eval(file[0])
" Type check.
let history = s:yank_histories[0]
let history[0] = history[0]
catch
let s:yank_histories = []
endtry
let s:yank_histories_file_mtime = getftime(g:unite_source_history_yank_file)
FUNCTION unite#sources#history_yank#_append()
Called 130 times
Total time: 0.015874
Self time: 0.006012
count total (s) self (s)
130 0.000623 let prev_histories = s:yank_histories
130 0.006771 0.000778 call s:load()
130 0.004904 0.001035 call s:add_register('"')
130 0.000259 if g:unite_source_history_yank_save_clipboard
call s:add_register('+')
endif
130 0.000294 if prev_histories !=# s:yank_histories
" Updated.
call unite#util#uniq(s:yank_histories)
if g:unite_source_history_yank_limit < len(s:yank_histories)
let s:yank_histories = s:yank_histories[ : g:unite_source_history_yank_limit - 1]
endif
call s:save()
endif
FUNCTION airline#builder#new()
Called 257 times
Total time: 0.010792
Self time: 0.010792
count total (s) self (s)
257 0.002422 let builder = copy(s:prototype)
257 0.000909 let builder._context = a:context
257 0.000589 let builder._side = 1
257 0.000592 let builder._curgroup = ''
257 0.000532 let builder._line = ''
257 0.004446 call extend(builder._context, { 'left_sep': g:airline_left_sep, 'left_alt_sep': g:airline_left_alt_sep, 'right_sep': g:airline_right_sep, 'right_alt_sep': g:airline_right_alt_sep, }, 'keep')
257 0.000444 return builder
FUNCTIONS SORTED ON TOTAL TIME
count total (s) self (s) function
255 0.739116 0.006209 airline#extensions#tabline#get()
255 0.732907 0.052299 <SNR>111_get_tabs()
1286 0.670408 0.133701 94()
1029 0.536707 0.023816 airline#highlighter#add_separator()
1049 0.522551 0.047753 <SNR>113_exec_separator()
2098 0.379662 0.021526 airline#themes#get_highlight()
2098 0.358136 0.107071 airline#highlighter#get_highlight()
4196 0.219012 <SNR>113_get_syn()
1131 0.102831 airline#highlighter#exec()
636 0.073783 0.051090 airline#check_mode()
130 0.073473 <SNR>111_get_buffer_list()
510 0.050676 0.008944 airline#extensions#tabline#title()
510 0.041732 0.006925 airline#extensions#tabline#get_buffer_name()
510 0.034807 0.024580 airline#extensions#tabline#formatters#default()
2098 0.032053 <SNR>113_get_array()
1 0.022525 0.005302 airline#highlighter#highlight()
130 0.017258 <SNR>93_Highlight_Matching_Pair()
130 0.015874 0.006012 unite#sources#history_yank#_append()
636 0.012945 airline#statusline()
1 0.011561 0.000882 signature#SignRefresh()
FUNCTIONS SORTED ON SELF TIME
count total (s) self (s) function
4196 0.219012 <SNR>113_get_syn()
1286 0.670408 0.133701 94()
2098 0.358136 0.107071 airline#highlighter#get_highlight()
1131 0.102831 airline#highlighter#exec()
130 0.073473 <SNR>111_get_buffer_list()
255 0.732907 0.052299 <SNR>111_get_tabs()
636 0.073783 0.051090 airline#check_mode()
1049 0.522551 0.047753 <SNR>113_exec_separator()
2098 0.032053 <SNR>113_get_array()
510 0.034807 0.024580 airline#extensions#tabline#formatters#default()
1029 0.536707 0.023816 airline#highlighter#add_separator()
2098 0.379662 0.021526 airline#themes#get_highlight()
130 0.017258 <SNR>93_Highlight_Matching_Pair()
636 0.012945 airline#statusline()
257 0.010792 airline#builder#new()
762 0.010436 airline#util#append()
510 0.010227 <SNR>122_wrap_name()
1398 0.009374 airline#util#wrap()
510 0.050676 0.008944 airline#extensions#tabline#title()
510 0.041732 0.006925 airline#extensions#tabline#get_buffer_name()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment