-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.log
More file actions
184 lines (168 loc) · 10.7 KB
/
profile.log
File metadata and controls
184 lines (168 loc) · 10.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
FUNCTION <SNR>15_Highlight_Matching_Pair()
Defined: /nix/store/96cx6hc0i81ihw32g9zpssjw34rwajzq-neovim-unwrapped-0.10.2/share/nvim/runtime/plugin/matchparen.vim:44
Called 206 times
Total time: 0.036937
Self time: 0.031067
count total (s) self (s)
206 0.002793 if !exists("w:matchparen_ids")
let w:matchparen_ids = []
206 0.000383 endif
" Remove any previous match.
206 0.009060 0.003191 call s:Remove_Matches()
" Avoid that we remove the popup menu.
" Return when there are no colors (looks like the cursor jumps).
206 0.001822 if pumvisible() || (&t_Co < 8 && !has("gui_running"))
return
206 0.000166 endif
" Get the character under the cursor and check if it's in 'matchpairs'.
206 0.001241 let c_lnum = line('.')
206 0.000865 let c_col = col('.')
206 0.000390 let before = 0
206 0.001025 let text = getline(c_lnum)
206 0.002290 let c_before = text->strpart(0, c_col - 1)->slice(-1)
206 0.001398 let c = text->strpart(c_col - 1)->slice(0, 1)
206 0.006149 let plist = split(&matchpairs, '.\zs[:,]')
206 0.001324 let i = index(plist, c)
206 0.000448 if i < 0
" not found, in Insert mode try character before the cursor
206 0.000966 if c_col > 1 && (mode() == 'i' || mode() == 'R')
let before = strlen(c_before)
let c = c_before
let i = index(plist, c)
206 0.000223 endif
206 0.000320 if i < 0
" not found, nothing to do
206 0.000398 return
endif
endif
" Figure out the arguments for searchpairpos().
if i % 2 == 0
let s_flags = 'nW'
let 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 has_getcurpos = exists("*getcurpos")
if has_getcurpos
" getcurpos() is more efficient but doesn't exist before 7.4.313.
let save_cursor = getcurpos()
else
let save_cursor = winsaveview()
endif
call cursor(c_lnum, c_col - before)
endif
if !has("syntax") || !exists("g:syntax_on")
let s_skip = "0"
else
" Build an expression that detects whether the current cursor position is
" in certain syntax types (string, comment, etc.), for use as
" searchpairpos()'s skip argument.
" We match "escape" for special items, such as lispEscapeSpecial, and
" match "symbol" for lispBarSymbol.
let s_skip = 'synstack(".", col("."))' . '->indexof({_, id -> synIDattr(id, "name") =~? ' . '"string\\|character\\|singlequote\\|escape\\|symbol\\|comment"}) >= 0'
" If executing the expression determines that the cursor is currently in
" one of the syntax types, then we want searchpairpos() to find the pair
" within those syntax types (i.e., not skip). Otherwise, the cursor is
" outside of the syntax types and s_skip should keep its value so we skip
" any matching pair inside the syntax types.
" Catch if this throws E363: pattern uses more memory than 'maxmempattern'.
try
execute 'if ' . s_skip . ' | let s_skip = "0" | endif'
catch /^Vim\%((\a\+)\)\=:E363/
" We won't find anything, so skip searching, should keep Vim responsive.
return
endtry
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
if has_getcurpos
call setpos('.', save_cursor)
else
call winrestview(save_cursor)
endif
endif
" If a match is found setup match highlighting.
if m_lnum > 0 && m_lnum >= stoplinetop && m_lnum <= stoplinebottom
if s:has_matchaddpos
call add(w:matchparen_ids, matchaddpos('MatchParen', [[c_lnum, c_col - before], [m_lnum, m_col]], 10))
else
exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) . 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/'
call add(w:matchparen_ids, 3)
endif
let w:paren_hl_on = 1
endif
FUNCTION <SNR>15_Remove_Matches()
Defined: /nix/store/96cx6hc0i81ihw32g9zpssjw34rwajzq-neovim-unwrapped-0.10.2/share/nvim/runtime/plugin/matchparen.vim:202
Called 206 times
Total time: 0.005870
Self time: 0.005870
count total (s) self (s)
206 0.001185 if exists('w:paren_hl_on') && w:paren_hl_on
while !empty(w:matchparen_ids)
silent! call remove(w:matchparen_ids, 0)->matchdelete()
endwhile
let w:paren_hl_on = 0
206 0.000200 endif
FUNCTIONS SORTED ON TOTAL TIME
count total (s) self (s) function
206 0.036937 0.031067 <SNR>15_Highlight_Matching_Pair()
206 0.005870 <SNR>15_Remove_Matches()
FUNCTIONS SORTED ON SELF TIME
count total (s) self (s) function
206 0.036937 0.031067 <SNR>15_Highlight_Matching_Pair()
206 0.005870 <SNR>15_Remove_Matches()