Created
March 25, 2017 12:36
-
-
Save HenryHu/ddd7389d926d4030a4bd20b751f7064d to your computer and use it in GitHub Desktop.
incsearch profile log
This file contains 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 characters
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/incsearch.vim | |
Sourced 1 time | |
Total time: 0.001984 | |
Self time: 0.001110 | |
count total (s) self (s) | |
"============================================================================= | |
" FILE: autoload/incsearch.vim | |
" AUTHOR: haya14busa | |
" License: MIT license {{{ | |
" Permission is hereby granted, free of charge, to any person obtaining | |
" a copy of this software and associated documentation files (the | |
" "Software"), to deal in the Software without restriction, including | |
" without limitation the rights to use, copy, modify, merge, publish, | |
" distribute, sublicense, and/or sell copies of the Software, and to | |
" permit persons to whom the Software is furnished to do so, subject to | |
" the following conditions: | |
" | |
" The above copyright notice and this permission notice shall be included | |
" in all copies or substantial portions of the Software. | |
" | |
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
" }}} | |
" | |
" vimlint: | |
" @vimlint(EVL103, 1, a:cmdline) | |
" @vimlint(EVL102, 1, v:errmsg) | |
" @vimlint(EVL102, 1, v:warningmsg) | |
" @vimlint(EVL102, 1, v:searchforward) | |
"============================================================================= | |
1 0.000009 scriptencoding utf-8 | |
" Saving 'cpoptions' {{{ | |
1 0.000039 let s:save_cpo = &cpo | |
1 0.000012 set cpo&vim | |
" }}} | |
1 0.000004 let s:TRUE = !0 | |
1 0.000003 let s:FALSE = 0 | |
1 0.000008 let s:DIRECTION = { 'forward': 1, 'backward': 0 } " see :h v:searchforward | |
" based on: https://github.com/deris/vim-magicalize/blob/433e38c1e83b1bdea4f83ab99dc19d070932380c/autoload/magicalize.vim#L52-L53 | |
" improve to work with repetitive espaced slash like \V\V | |
" NOTE: \@1<= doesn't work to detect \v\v\v\v | |
1 0.000004 let s:escaped_backslash = '\m\%(^\|[^\\]\)\%(\\\\\)*' | |
1 0.000003 let s:non_escaped_backslash = '\m\%(\%(^\|[^\\]\)\%(\\\\\)*\)\@<=\\' | |
" Option: | |
1 0.000010 let g:incsearch#emacs_like_keymap = get(g: , 'incsearch#emacs_like_keymap' , s:FALSE) | |
1 0.000006 let g:incsearch#highlight = get(g: , 'incsearch#highlight' , {}) | |
1 0.000005 let g:incsearch#separate_highlight = get(g: , 'incsearch#separate_highlight' , s:FALSE) | |
1 0.000006 let g:incsearch#consistent_n_direction = get(g: , 'incsearch#consistent_n_direction' , s:FALSE) | |
1 0.000004 let g:incsearch#vim_cmdline_keymap = get(g: , 'incsearch#vim_cmdline_keymap' , s:TRUE) | |
1 0.000005 let g:incsearch#smart_backward_word = get(g: , 'incsearch#smart_backward_word' , s:TRUE) | |
1 0.000004 let g:incsearch#no_inc_hlsearch = get(g: , 'incsearch#no_inc_hlsearch' , s:FALSE) | |
" This changes error and warning emulation way slightly | |
1 0.000007 let g:incsearch#do_not_save_error_message_history = | |
\ get(g:, 'incsearch#do_not_save_error_message_history', s:FALSE) | |
1 0.000005 let g:incsearch#auto_nohlsearch = get(g: , 'incsearch#auto_nohlsearch' , s:FALSE) | |
" assert g:incsearch#magic =~# \\[mMvV] | |
1 0.000005 let g:incsearch#magic = get(g: , 'incsearch#magic' , '') | |
" Debug: | |
1 0.000005 let g:incsearch#debug = get(g:, 'incsearch#debug', s:FALSE) | |
" Utility: | |
1 0.000173 let s:U = incsearch#util#import() | |
" Main: {{{ | |
" @return vital-over command-line interface object. [experimental] | |
1 0.000004 function! incsearch#cli() abort | |
return incsearch#cli#get() | |
endfunction | |
"" Make vital-over command-line interface object and return it [experimental] | |
1 0.000004 function! incsearch#make(...) abort | |
return incsearch#cli#make(incsearch#config#make(get(a:, 1, {}))) | |
endfunction | |
"" NOTE: this global variable is only for handling config from go_wrap func | |
" It avoids to make config string temporarily | |
1 0.000003 let g:incsearch#_go_config = {} | |
"" This is main API assuming used by <expr> mappings | |
" ARGS: | |
" @config See autoload/incsearch/config.vim | |
" RETURN: | |
" Return primitive search commands (like `3/pattern<CR>`) if config.is_expr | |
" is TRUE, return excute command to call incsearch.vim's inner API. | |
" To handle dot repeat, make sure that config.is_expr is true. If you do not | |
" specify config.is_expr, it automatically set config.is_expr TRUE for | |
" operator-pending mode | |
" USAGE: | |
" :noremap <silent><expr> <Plug>(incsearch-forward) incsearch#go({'command': '/'}) | |
" " FIXME?: Calling this with feedkeys() is ugly... Reason: incsearch#go() | |
" is optimize the situation which calling from <expr> mappings, and do not | |
" take care from calling directly or some defined command. | |
" :call feedkeys(incsearch#go(), 'n') | |
" @api | |
1 0.000003 function! incsearch#go(...) abort | |
let config = incsearch#config#make(get(a:, 1, {})) | |
" FIXME?: this condition should not be config.is_expr? | |
if config.is_expr | |
return incsearch#_go(config) | |
else | |
let g:incsearch#_go_config = config | |
let esc = s:U.is_visual(g:incsearch#_go_config.mode) ? "\<ESC>" : '' | |
return printf("%s:\<C-u>call incsearch#_go(g:incsearch#_go_config)\<CR>", esc) | |
endif | |
endfunction | |
"" Debuggin incsearch.vim interface for calling from function call | |
" USAGE: | |
" :call incsearch#call({'pattern': @/}) | |
" @api for debugging | |
1 0.000003 function! incsearch#call(...) abort | |
return incsearch#_go(incsearch#config#make(get(a:, 1, {}))) | |
endfunction | |
" IMPORTANT NOTE: | |
" Calling `incsearch#go()` and executing command which returned from | |
" `incsearch#go()` have to result in the same cursor move. | |
" @return command: String to search | |
1 0.000003 function! incsearch#_go(config) abort | |
if s:U.is_visual(a:config.mode) && !a:config.is_expr | |
normal! gv | |
endif | |
let cli = incsearch#cli#make(a:config) | |
let input = s:get_input(cli) | |
if cli._does_exit_from_incsearch | |
" Outer incsearch-plugin handle it so do not something in paticular | |
return cli._return_cmd | |
else | |
" After getting input, generate command, take aftercare, and return | |
" command. | |
let l:F = function(cli._flag is# 'n' ? 's:stay' : 's:search') | |
let cmd = l:F(cli, input) | |
if !a:config.is_expr | |
let should_set_jumplist = (cli._flag !=# 'n') | |
call s:set_search_related_stuff(cli, cmd, should_set_jumplist) | |
if a:config.mode is# 'no' | |
call s:set_vimrepeat(cmd) | |
endif | |
endif | |
return cmd | |
endif | |
endfunction | |
"" To handle recursive mapping, map command to <Plug>(_incsearch-dotrepeat) | |
" temporarily | |
" https://github.com/tpope/vim-repeat | |
" https://github.com/kana/vim-repeat | |
1 0.000003 function! s:set_vimrepeat(cmd) abort | |
execute 'noremap' '<Plug>(_incsearch-dotrepeat)' a:cmd | |
silent! call repeat#set("\<Plug>(_incsearch-dotrepeat)") | |
endfunction | |
1 0.000006 let g:incsearch#_view = get(g:, 'incsearch#_view', {}) | |
1 0.000024 noremap <silent> <Plug>(_incsearch-winrestview) <Nop> | |
1 0.000014 noremap! <silent> <Plug>(_incsearch-winrestview) <Nop> | |
1 0.000024 nnoremap <silent> <Plug>(_incsearch-winrestview) :<C-u>call winrestview(g:incsearch#_view)<CR> | |
1 0.000022 xnoremap <silent> <Plug>(_incsearch-winrestview) :<C-u>call winrestview(g:incsearch#_view)<CR>gv | |
1 0.000004 function! s:stay(cli, input) abort | |
let [raw_pattern, offset] = a:cli._parse_pattern() | |
let pattern = a:cli._convert(raw_pattern) | |
" NOTE: do not move cursor but need to handle {offset} for n & N ...! {{{ | |
" FIXME: cannot set {offset} if in operator-pending mode because this | |
" have to use feedkeys() | |
let is_cancel = a:cli.exit_code() | |
if is_cancel | |
call s:cleanup_cmdline() | |
elseif !empty(offset) && mode(1) !=# 'no' | |
let cmd = incsearch#with_ignore_foldopen( | |
\ s:U.dictfunction(a:cli._generate_command, a:cli), a:input) | |
call feedkeys(cmd, 'n') | |
let g:incsearch#_view = a:cli._w | |
call feedkeys("\<Plug>(_incsearch-winrestview)", 'm') | |
call incsearch#autocmd#auto_nohlsearch(2) | |
else | |
" Handle last-pattern | |
if a:input isnot# '' | |
call histadd('/', a:input) | |
call s:set_search_reg(pattern, a:cli._base_key) | |
endif | |
call incsearch#autocmd#auto_nohlsearch(0) | |
endif | |
" }}} | |
return s:U.is_visual(a:cli._mode) ? "\<ESC>gv" : "\<ESC>" " just exit | |
endfunction | |
1 0.000004 function! s:search(cli, input) abort | |
call incsearch#autocmd#auto_nohlsearch(1) " NOTE: `.` repeat doesn't handle this | |
return a:cli._generate_command(a:input) | |
endfunction | |
1 0.000003 function! s:get_input(cli) abort | |
" Handle visual mode highlight | |
if s:U.is_visual(a:cli._mode) | |
let visual_hl = incsearch#highlight#get_visual_hlobj() | |
try | |
call incsearch#highlight#turn_off(visual_hl) | |
call incsearch#highlight#emulate_visual_highlight(a:cli._mode, visual_hl) | |
let input = a:cli.get(a:cli._pattern) | |
finally | |
call incsearch#highlight#turn_on(visual_hl) | |
endtry | |
else | |
let input = a:cli.get(a:cli._pattern) | |
endif | |
return input | |
endfunction | |
" Assume the cursor move is already done. | |
" This function handle search related stuff which doesn't be set by :execute | |
" in function like @/, hisory, jumplist, offset, error & warning emulation. | |
1 0.000004 function! s:set_search_related_stuff(cli, cmd, ...) abort | |
" For stay motion | |
let should_set_jumplist = get(a:, 1, s:TRUE) | |
let is_cancel = a:cli.exit_code() | |
if is_cancel | |
" Restore cursor position and return | |
" NOTE: Should I request on_cancel event to vital-over and use it? | |
call winrestview(a:cli._w) | |
call s:cleanup_cmdline() | |
return | |
endif | |
let [raw_pattern, offset] = a:cli._parse_pattern() | |
let should_execute = !empty(offset) || empty(raw_pattern) | |
if should_execute | |
" Execute with feedkeys() to work with | |
" 1. :h {offset} for `n` and `N` | |
" 2. empty input (:h last-pattern) | |
" NOTE: Don't use feedkeys() as much as possible to avoid flickering | |
call winrestview(a:cli._w) | |
call feedkeys(a:cmd, 'n') | |
if g:incsearch#consistent_n_direction | |
call feedkeys("\<Plug>(_incsearch-searchforward)", 'm') | |
endif | |
else | |
" Add history if necessary | |
" Do not save converted pattern to history | |
let pattern = a:cli._convert(raw_pattern) | |
let input = a:cli._combine_pattern(raw_pattern, offset) | |
call histadd(a:cli._base_key, input) | |
call s:set_search_reg(pattern, a:cli._base_key) | |
let target_view = winsaveview() | |
call winrestview(a:cli._w) " Get back start position temporarily for emulation | |
" Set jump list | |
if should_set_jumplist | |
normal! m` | |
endif | |
" Emulate errors, and handling `n` and `N` preparation | |
call s:emulate_search_error(a:cli._direction, a:cli._w) | |
" winrestview() between error and wraning emulation to avoid flickering | |
call winrestview(target_view) | |
" Emulate warning | |
call s:emulate_search_warning(a:cli._direction, a:cli._w, target_view) | |
call s:silent_after_search() | |
" Open fold | |
if &foldopen =~# '\vsearch|all' | |
normal! zv | |
endif | |
endif | |
endfunction | |
"}}} | |
" Helper: {{{ | |
" @return [pattern, offset] | |
1 0.000005 function! incsearch#parse_pattern(expr, search_key) abort | |
" search_key : '/' or '?' | |
" expr : {pattern\/pattern}/{offset} | |
" expr : {pattern}/;/{newpattern} :h //; | |
" return : [{pattern\/pattern}, {offset}] | |
let very_magic = '\v' | |
let pattern = '(%(\\.|.){-})' | |
let slash = '(\' . a:search_key . '&[^\\"|[:alnum:][:blank:]])' | |
let offset = '(.*)' | |
let parse_pattern = very_magic . pattern . '%(' . slash . offset . ')?$' | |
let result = matchlist(a:expr, parse_pattern)[1:3] | |
if type(result) == type(0) || empty(result) | |
return [] | |
endif | |
unlet result[1] | |
return result | |
endfunction | |
1 0.000003 function! incsearch#detect_case(pattern) abort | |
" Ignore \%C, \%U, \%V for smartcase detection | |
let p = substitute(a:pattern, s:non_escaped_backslash . '%[CUV]', '', 'g') | |
" Explicit \c has highest priority | |
if p =~# s:non_escaped_backslash . 'c' | |
return '\c' | |
endif | |
if p =~# s:non_escaped_backslash . 'C' || &ignorecase == s:FALSE | |
return '\C' " noignorecase or explicit \C | |
endif | |
if &smartcase == s:FALSE | |
return '\c' " ignorecase & nosmartcase | |
endif | |
" Find uppercase letter which isn't escaped | |
if p =~# s:escaped_backslash . '[A-Z]' | |
return '\C' " smartcase with [A-Z] | |
else | |
return '\c' " smartcase without [A-Z] | |
endif | |
endfunction | |
1 0.000003 function! s:silent_after_search(...) abort " arg: mode(1) | |
" :h function-search-undo | |
let m = get(a:, 1, mode(1)) | |
if m !=# 'no' " guard for operator-mapping | |
let cmd = join([ | |
\ (s:U.is_visual(m) ? "\<Plug>(_incsearch-esc)" : ''), | |
\ "\<Plug>(_incsearch-hlsearch)", | |
\ "\<Plug>(_incsearch-searchforward)", | |
\ (s:U.is_visual(m) ? "\<Plug>(_incsearch-gv)" : '') | |
\ ], '') | |
call feedkeys(cmd, 'm') | |
endif | |
endfunction | |
1 0.000013 noremap <silent> <Plug>(_incsearch-gv) <Nop> | |
1 0.000011 noremap! <silent> <Plug>(_incsearch-gv) <Nop> | |
1 0.000012 nnoremap <silent> <Plug>(_incsearch-gv) gv | |
1 0.000011 noremap <silent> <Plug>(_incsearch-esc) <Nop> | |
1 0.000010 noremap! <silent> <Plug>(_incsearch-esc) <Nop> | |
1 0.000012 xnoremap <silent> <Plug>(_incsearch-esc) <Esc> | |
1 0.000011 noremap <silent> <Plug>(_incsearch-hlsearch) <Nop> | |
1 0.000019 noremap! <silent> <Plug>(_incsearch-hlsearch) <Nop> | |
1 0.000018 nnoremap <silent> <Plug>(_incsearch-hlsearch) :<C-u>let &hlsearch=&hlsearch<CR> | |
1 0.000017 xnoremap <silent> <Plug>(_incsearch-hlsearch) :<C-u>let &hlsearch=&hlsearch<CR>gv | |
1 0.000012 noremap <silent> <Plug>(_incsearch-searchforward) <Nop> | |
1 0.000011 noremap! <silent> <Plug>(_incsearch-searchforward) <Nop> | |
1 0.000019 nnoremap <silent><expr> <Plug>(_incsearch-searchforward) <SID>_searchforward_cmd() | |
1 0.000018 xnoremap <silent><expr> <Plug>(_incsearch-searchforward) <SID>_searchforward_cmd() | |
1 0.000004 function! s:_searchforward_cmd() abort | |
let d = (g:incsearch#consistent_n_direction ? s:DIRECTION.forward : (incsearch#cli()._base_key is# '/' ? 1 : 0)) | |
return printf(":\<C-u>let v:searchforward=%d\<CR>", d) | |
endfunction | |
1 0.000004 function! s:emulate_search_error(direction, ...) abort | |
let from = get(a:, 1, winsaveview()) | |
let keyseq = (a:direction == s:DIRECTION.forward ? '/' : '?') | |
let old_errmsg = v:errmsg | |
let v:errmsg = '' | |
" NOTE: | |
" - XXX: Handle `n` and `N` preparation with s:silent_after_search() | |
" - silent!: Do not show error and warning message, because it also | |
" echo v:throwpoint for error and save messages in message-history | |
" - Unlike v:errmsg, v:warningmsg doesn't set if it use :silent! | |
" Get first error | |
silent! call incsearch#execute_search(keyseq . "\<CR>") | |
call winrestview(from) | |
if g:incsearch#do_not_save_error_message_history | |
if v:errmsg !=# '' | |
call s:Error(v:errmsg) | |
else | |
let v:errmsg = old_errmsg | |
endif | |
else | |
" NOTE: show more than two errors e.g. `/\za` | |
let last_error = v:errmsg | |
try | |
" Do not use silent! to show warning | |
call incsearch#execute_search(keyseq . "\<CR>") | |
catch /^Vim\%((\a\+)\)\=:E/ | |
let first_error = matchlist(v:exception, '\v^Vim%(\(\a+\))=:(E.*)$')[1] | |
call s:Error(first_error, 'echom') | |
if last_error !=# '' && last_error !=# first_error | |
call s:Error(last_error, 'echom') | |
endif | |
finally | |
call winrestview(from) | |
endtry | |
if v:errmsg ==# '' | |
let v:errmsg = old_errmsg | |
endif | |
endif | |
endfunction | |
1 0.000004 function! s:emulate_search_warning(direction, from, to) abort | |
" NOTE: | |
" - It should use :h echomsg considering emulation of default | |
" warning messages remain in the :h message-history, but it'll mess | |
" up the message-history unnecessary, so it use :h echo | |
" - See :h shortmess | |
" if &shortmess !~# 's' && g:incsearch#do_not_save_error_message_history | |
if &shortmess !~# 's' && g:incsearch#do_not_save_error_message_history | |
let from = [a:from.lnum, a:from.col] | |
let to = [a:to.lnum, a:to.col] | |
let old_warningmsg = v:warningmsg | |
let v:warningmsg = | |
\ ( a:direction == s:DIRECTION.forward && !s:U.is_pos_less_equal(from, to) | |
\ ? 'search hit BOTTOM, continuing at TOP' | |
\ : a:direction == s:DIRECTION.backward && s:U.is_pos_less_equal(from, to) | |
\ ? 'search hit TOP, continuing at BOTTOM' | |
\ : '' ) | |
if v:warningmsg !=# '' | |
call s:Warning(v:warningmsg) | |
else | |
let v:warningmsg = old_warningmsg | |
endif | |
endif | |
endfunction | |
1 0.000002 function! s:cleanup_cmdline() abort | |
redraw | echo '' | |
endfunction | |
" Should I use :h echoerr ? But it save the messages in message-history | |
1 0.000003 function! s:Error(msg, ...) abort | |
return call(function('s:_echohl'), [a:msg, 'ErrorMsg'] + a:000) | |
endfunction | |
1 0.000002 function! s:Warning(msg, ...) abort | |
return call(function('s:_echohl'), [a:msg, 'WarningMsg'] + a:000) | |
endfunction | |
1 0.000003 function! s:_echohl(msg, hlgroup, ...) abort | |
let echocmd = get(a:, 1, 'echo') | |
redraw | echo '' | |
exec 'echohl' a:hlgroup | |
exec echocmd string(a:msg) | |
echohl None | |
endfunction | |
" Not to generate command with zv | |
1 0.000005 function! incsearch#with_ignore_foldopen(F, ...) abort | |
let foldopen_save = &foldopen | |
let &foldopen='' | |
try | |
return call(a:F, a:000) | |
finally | |
let &foldopen = foldopen_save | |
endtry | |
endfunction | |
" Try to avoid side-effect as much as possible except cursor movement | |
1 0.000008 let s:has_keeppattern = v:version > 704 || v:version == 704 && has('patch083') | |
1 0.000005 let s:keeppattern = (s:has_keeppattern ? 'keeppattern' : '') | |
1 0.000004 function! s:_execute_search(cmd) abort | |
" :nohlsearch | |
" Please do not highlight at the first place if you set back | |
" info! I'll handle it myself :h function-search-undo | |
execute s:keeppattern 'keepjumps' 'normal!' a:cmd | nohlsearch | |
endfunction | |
1 0.000003 if s:has_keeppattern | |
1 0.000004 function! incsearch#execute_search(...) abort | |
return call(function('s:_execute_search'), a:000) | |
endfunction | |
1 0.000001 else | |
function! incsearch#execute_search(...) abort | |
" keeppattern emulation | |
let p = @/ | |
let r = call(function('s:_execute_search'), a:000) | |
" NOTE: `let @/ = p` reset v:searchforward | |
let d = v:searchforward | |
let @/ = p | |
let v:searchforward = d | |
return r | |
endfunction | |
endif | |
1 0.000002 function! incsearch#magic() abort | |
let m = g:incsearch#magic | |
return (len(m) == 2 && m =~# '\\[mMvV]' ? m : '') | |
endfunction | |
" s:set_search_reg() set pattern to @/ with ?\? handling | |
" @command '/' or '?' | |
1 0.000003 function! s:set_search_reg(pattern, command) abort | |
let @/ = a:command is# '?' | |
\ ? substitute(a:pattern, '\\?', '?', 'g') : a:pattern | |
endfunction | |
"}}} | |
" Restore 'cpoptions' {{{ | |
1 0.000010 let &cpo = s:save_cpo | |
1 0.000003 unlet s:save_cpo | |
" }}} | |
" __END__ {{{ | |
" vim: expandtab softtabstop=2 shiftwidth=2 | |
" vim: foldmethod=marker | |
" }}} | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/incsearch/util.vim | |
Sourced 1 time | |
Total time: 0.000700 | |
Self time: 0.000700 | |
count total (s) self (s) | |
"============================================================================= | |
" FILE: autoload/incsearch/util.vim | |
" AUTHOR: haya14busa | |
" License: MIT license {{{ | |
" Permission is hereby granted, free of charge, to any person obtaining | |
" a copy of this software and associated documentation files (the | |
" "Software"), to deal in the Software without restriction, including | |
" without limitation the rights to use, copy, modify, merge, publish, | |
" distribute, sublicense, and/or sell copies of the Software, and to | |
" permit persons to whom the Software is furnished to do so, subject to | |
" the following conditions: | |
" | |
" The above copyright notice and this permission notice shall be included | |
" in all copies or substantial portions of the Software. | |
" | |
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
" }}} | |
"============================================================================= | |
1 0.000004 scriptencoding utf-8 | |
" Saving 'cpoptions' {{{ | |
1 0.000008 let s:save_cpo = &cpo | |
1 0.000008 set cpo&vim | |
" }}} | |
1 0.000003 let s:TRUE = !0 | |
1 0.000003 let s:FALSE = 0 | |
" Public Utilities: | |
1 0.000006 function! incsearch#util#deepextend(...) abort | |
return call(function('s:deepextend'), a:000) | |
endfunction | |
" Utilities: | |
1 0.000005 function! incsearch#util#import() abort | |
let prefix = '<SNR>' . s:SID() . '_' | |
let module = {} | |
for func in s:functions | |
let module[func] = function(prefix . func) | |
endfor | |
return copy(module) | |
endfunction | |
1 0.000005 function! s:SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$') | |
endfunction | |
1 0.000013 let s:functions = [ | |
\ 'is_visual' | |
\ , 'get_max_col' | |
\ , 'is_pos_less_equal' | |
\ , 'is_pos_more_equal' | |
\ , 'sort_num' | |
\ , 'sort_pos' | |
\ , 'count_pattern' | |
\ , 'silent_feedkeys' | |
\ , 'deepextend' | |
\ , 'dictfunction' | |
\ , 'regexp_join' | |
\ ] | |
1 0.000004 function! s:is_visual(mode) abort | |
return a:mode =~# "[vV\<C-v>]" | |
endfunction | |
" Return max column number of given line expression | |
" expr: similar to line(), col() | |
1 0.000004 function! s:get_max_col(expr) abort | |
return strlen(getline(a:expr)) + 1 | |
endfunction | |
" return (x <= y) | |
1 0.000003 function! s:is_pos_less_equal(x, y) abort | |
return (a:x[0] == a:y[0]) ? a:x[1] <= a:y[1] : a:x[0] < a:y[0] | |
endfunction | |
" return (x > y) | |
1 0.000003 function! s:is_pos_more_equal(x, y) abort | |
return ! s:is_pos_less_equal(a:x, a:y) | |
endfunction | |
" x < y -> -1 | |
" x = y -> 0 | |
" x > y -> 1 | |
1 0.000003 function! s:compare_pos(x, y) abort | |
return max([-1, min([1,(a:x[0] == a:y[0]) ? a:x[1] - a:y[1] : a:x[0] - a:y[0]])]) | |
endfunction | |
1 0.000003 function! s:sort_num(xs) abort | |
" 7.4.341 | |
" http://ftp.vim.org/vim/patches/7.4/7.4.341 | |
if v:version > 704 || v:version == 704 && has('patch341') | |
return sort(a:xs, 'n') | |
else | |
return sort(a:xs, 's:_sort_num_func') | |
endif | |
endfunction | |
1 0.000004 function! s:_sort_num_func(x, y) abort | |
return a:x - a:y | |
endfunction | |
1 0.000003 function! s:sort_pos(pos_list) abort | |
" pos_list: [ [x1, y1], [x2, y2] ] | |
return sort(a:pos_list, 's:compare_pos') | |
endfunction | |
" Return the number of matched patterns in the current buffer or the specified | |
" region with `from` and `to` positions | |
" parameter: pattern, from, to | |
1 0.000003 function! s:count_pattern(pattern, ...) abort | |
let w = winsaveview() | |
let [from, to] = [ | |
\ get(a:, 1, [1, 1]), | |
\ get(a:, 2, [line('$'), s:get_max_col('$')]) | |
\ ] | |
let ignore_at_cursor_pos = get(a:, 3, 0) | |
" direction flag | |
let d_flag = s:compare_pos(from, to) > 0 ? 'b' : '' | |
call cursor(from) | |
let cnt = 0 | |
let base_flag = d_flag . 'W' | |
try | |
" first: accept a match at the cursor position | |
let pos = searchpos(a:pattern, (ignore_at_cursor_pos ? '' : 'c' ) . base_flag) | |
while (pos != [0, 0] && s:compare_pos(pos, to) isnot# (d_flag is# 'b' ? -1 : 1)) | |
let cnt += 1 | |
let pos = searchpos(a:pattern, base_flag) | |
endwhile | |
finally | |
call winrestview(w) | |
endtry | |
return cnt | |
endfunction | |
" NOTE: support vmap? | |
" It doesn't handle feedkeys() on incsert or command-line mode | |
1 0.000004 function! s:silent_feedkeys(expr, name, ...) abort | |
" Ref: | |
" https://github.com/osyo-manga/vim-over/blob/d51b028c29661d4a5f5b79438ad6d69266753711/autoload/over.vim#L6 | |
let mode = get(a:, 1, 'm') | |
let name = 'incsearch-' . a:name | |
let map = printf('<Plug>(%s)', name) | |
if mode ==# 'n' | |
let command = 'nnoremap' | |
else | |
let command = 'nmap' | |
endif | |
execute command '<silent>' map printf('%s:nunmap %s<CR>', a:expr, map) | |
if mode(1) !=# 'ce' | |
" FIXME: mode(1) !=# 'ce' exists only for the test | |
" :h feedkeys() doesn't work while runnning a test script | |
" https://github.com/kana/vim-vspec/issues/27 | |
call feedkeys(printf("\<Plug>(%s)", name)) | |
endif | |
endfunction | |
" deepextend (nest: 1) | |
1 0.000004 function! s:deepextend(expr1, expr2) abort | |
let expr2 = copy(a:expr2) | |
for [k, V] in items(a:expr1) | |
if (type(V) is type({}) || type(V) is type([])) && has_key(expr2, k) | |
let a:expr1[k] = extend(a:expr1[k], expr2[k]) | |
unlet expr2[k] | |
endif | |
unlet V | |
endfor | |
return extend(a:expr1, expr2) | |
endfunction | |
1 0.000004 let s:funcmanage = {} | |
1 0.000003 function! s:funcmanage() abort | |
return s:funcmanage | |
endfunction | |
1 0.000003 function! s:dictfunction(dictfunc, dict) abort | |
let funcname = '_' . matchstr(string(a:dictfunc), '\d\+') | |
let s:funcmanage[funcname] = { | |
\ 'func': a:dictfunc, | |
\ 'dict': a:dict | |
\ } | |
let prefix = '<SNR>' . s:SID() . '_' | |
let fm = printf("%sfuncmanage()['%s']", prefix, funcname) | |
execute join([ | |
\ printf('function! s:%s(...) abort', funcname), | |
\ printf(" return call(%s['func'], a:000, %s['dict'])", fm, fm), | |
\ 'endfunction' | |
\ ], "\n") | |
return function(printf('%s%s', prefix, funcname)) | |
endfunction | |
"--- regexp | |
1 0.000004 let s:escaped_backslash = '\m\%(^\|[^\\]\)\%(\\\\\)*\zs' | |
1 0.000003 function! s:regexp_join(ps) abort | |
let rs = map(filter(copy(a:ps), 's:_is_valid_regexp(v:val)'), 's:escape_unbalanced_left_r(v:val)') | |
return printf('\m\%%(%s\m\)', join(rs, '\m\|')) | |
endfunction | |
1 0.000003 function! s:_is_valid_regexp(pattern) abort | |
try | |
if '' =~# a:pattern | |
endif | |
return s:TRUE | |
catch | |
return s:FALSE | |
endtry | |
endfunction | |
" \m,\v: [ -> \[ | |
" \M,\V: \[ -> [ | |
1 0.000004 function! s:escape_unbalanced_left_r(pattern) abort | |
let rs = [] | |
let cs = split(a:pattern, '\zs') | |
" escape backslash (\, \\\, \\\\\, ...) | |
let escape_bs = s:FALSE | |
let flag = &magic ? 'm' : 'M' | |
let i = 0 | |
while i < len(cs) | |
let c = cs[i] | |
" characters to add to rs | |
let addcs = [c] | |
if escape_bs && s:_is_flag(c) | |
let flag = c | |
elseif c is# '[' && s:_may_replace_left_r_cond(escape_bs, flag) | |
let idx = s:_find_right_r(cs, i) | |
if idx is# -1 | |
if s:_is_flag(flag, 'MV') | |
" Remove `\` before unbalanced `[` | |
let rs = rs[:-2] | |
else | |
" Escape unbalanced `[` | |
let addcs = ['\' . c] | |
endif | |
else | |
let addcs = cs[(i):(i+idx)] | |
let i += idx | |
endif | |
endif | |
let escape_bs = (escape_bs || c isnot# '\') ? s:FALSE : s:TRUE | |
let rs += addcs | |
let i += 1 | |
endwhile | |
return join(rs, '') | |
endfunction | |
" @ return boolean | |
1 0.000004 function! s:_is_flag(flag, ...) abort | |
let chars = get(a:, 1, 'mMvV') | |
return a:flag =~# printf('\m[%s]', chars) | |
endfunction | |
" @ return boolean | |
1 0.000004 function! s:_may_replace_left_r_cond(escape_bs, flag) abort | |
return (a:escape_bs && s:_is_flag(a:flag, 'MV')) || (!a:escape_bs && s:_is_flag(a:flag, 'mv')) | |
endfunction | |
" @return index | |
1 0.000004 function! s:_find_right_r(cs, i) abort | |
return match(join(a:cs[(a:i+1):], ''), s:escaped_backslash . ']') | |
endfunction | |
"--- end of regexp | |
" Restore 'cpoptions' {{{ | |
1 0.000012 let &cpo = s:save_cpo | |
1 0.000003 unlet s:save_cpo | |
" }}} | |
" __END__ {{{ | |
" vim: expandtab softtabstop=2 shiftwidth=2 | |
" vim: foldmethod=marker | |
" }}} | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/incsearch/config.vim | |
Sourced 1 time | |
Total time: 0.000328 | |
Self time: 0.000186 | |
count total (s) self (s) | |
"============================================================================= | |
" FILE: autoload/incsearch/config.vim | |
" AUTHOR: haya14busa | |
" License: MIT license | |
"============================================================================= | |
1 0.000004 scriptencoding utf-8 | |
1 0.000009 let s:save_cpo = &cpo | |
1 0.000009 set cpo&vim | |
1 0.000004 let s:TRUE = !0 | |
1 0.000002 let s:FALSE = 0 | |
1 0.000004 lockvar s:TRUE s:FALSE | |
1 0.000151 0.000009 let s:U = incsearch#util#import() | |
"" incsearch config | |
" TODO: more detail documentation | |
" @command is equivalent with base_key TODO: fix this inconsistence | |
" @count default: v:count secret | |
" @mode default: mode(1) secret | |
1 0.000014 let s:config = { | |
\ 'command': '/', | |
\ 'is_stay': s:FALSE, | |
\ 'is_expr': s:FALSE, | |
\ 'pattern': '', | |
\ 'mode': 'n', | |
\ 'count': 0, | |
\ 'prompt': '', | |
\ 'modules': [], | |
\ 'converters': [], | |
\ 'keymap': {} | |
\ } | |
" @return config for lazy value | |
1 0.000004 function! s:lazy_config() abort | |
let m = mode(1) | |
return { | |
\ 'count': v:count, | |
\ 'mode': m, | |
\ 'is_expr': (m is# 'no'), | |
\ 'keymap': s:keymap() | |
\ } | |
endfunction | |
" @return config with default value | |
1 0.000005 function! incsearch#config#make(additional) abort | |
let default = extend(deepcopy(s:config), s:lazy_config()) | |
let c = s:U.deepextend(default, a:additional) | |
if c.prompt is# '' | |
let c.prompt = c.command | |
endif | |
return c | |
endfunction | |
1 0.000048 let s:default_keymappings = { | |
\ "\<Tab>" : { | |
\ 'key' : '<Over>(incsearch-next)', | |
\ 'noremap' : 1, | |
\ }, | |
\ "\<S-Tab>" : { | |
\ 'key' : '<Over>(incsearch-prev)', | |
\ 'noremap' : 1, | |
\ }, | |
\ "\<C-j>" : { | |
\ 'key' : '<Over>(incsearch-scroll-f)', | |
\ 'noremap' : 1, | |
\ }, | |
\ "\<C-k>" : { | |
\ 'key' : '<Over>(incsearch-scroll-b)', | |
\ 'noremap' : 1, | |
\ }, | |
\ "\<C-l>" : { | |
\ 'key' : '<Over>(buffer-complete)', | |
\ 'noremap' : 1, | |
\ }, | |
\ "\<CR>" : { | |
\ 'key': "\<CR>", | |
\ 'noremap': 1 | |
\ }, | |
\ } | |
" https://github.com/haya14busa/incsearch.vim/issues/35 | |
1 0.000008 if has('mac') | |
call extend(s:default_keymappings, { | |
\ '"+gP' : { | |
\ 'key': "\<C-r>+", | |
\ 'noremap': 1 | |
\ }, | |
\ }) | |
endif | |
1 0.000004 function! s:keymap() abort | |
return extend(copy(s:default_keymappings), g:incsearch_cli_key_mappings) | |
endfunction | |
1 0.000011 let &cpo = s:save_cpo | |
1 0.000003 unlet s:save_cpo | |
" __END__ | |
" vim: expandtab softtabstop=2 shiftwidth=2 foldmethod=marker | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/incsearch/cli.vim | |
Sourced 1 time | |
Total time: 0.047454 | |
Self time: 0.001568 | |
count total (s) self (s) | |
"============================================================================= | |
" FILE: autoload/incsearch/cli.vim | |
" AUTHOR: haya14busa | |
" License: MIT license | |
"============================================================================= | |
1 0.000004 scriptencoding utf-8 | |
1 0.000009 let s:save_cpo = &cpo | |
1 0.000017 set cpo&vim | |
1 0.000006 let s:DIRECTION = { 'forward': 1, 'backward': 0 } " see :h v:searchforward | |
1 0.000004 function! incsearch#cli#get() abort | |
try | |
" It returns current cli object | |
return s:Doautocmd.get_cmdline() | |
catch /vital-over(_incsearch) Exception/ | |
" If there are no current cli object, return default one | |
return incsearch#cli#make(incsearch#config#make({})) | |
endtry | |
endfunction | |
" @config: whole configuration | |
1 0.000004 function! incsearch#cli#make(config) abort | |
let cli = deepcopy(s:cli) | |
call incsearch#cli#set(cli, a:config) | |
return cli | |
endfunction | |
" To reuse cli object, you should re-set configuration | |
" @config: whole configuration | |
1 0.000004 function! incsearch#cli#set(cli, config) abort | |
let a:cli._base_key = a:config.command | |
let a:cli._vcount1 = max([1, a:config.count]) | |
let a:cli._has_count = a:config.count > 0 | |
let a:cli._is_expr = a:config.is_expr | |
let a:cli._mode = a:config.mode | |
let a:cli._pattern = a:config.pattern | |
let a:cli._prompt = a:config.prompt | |
let a:cli._keymap = a:config.keymap | |
let a:cli._converters = a:config.converters | |
let a:cli._flag = a:config.is_stay ? 'n' | |
\ : a:config.command is# '/' ? '' | |
\ : a:config.command is# '?' ? 'b' | |
\ : '' | |
let a:cli._direction = | |
\ (a:cli._base_key is# '/' ? s:DIRECTION.forward : s:DIRECTION.backward) | |
" TODO: provide config? but it may conflict with <expr> mapping | |
" NOTE: _w: default cursor view | |
let a:cli._w = winsaveview() | |
for module in a:config.modules | |
call a:cli.connect(module) | |
endfor | |
call a:cli.set_prompt(a:cli._prompt) | |
return a:cli | |
endfunction | |
1 0.000133 let s:cli = vital#incsearch#import('Over.Commandline').make_default('/') | |
1 0.000079 0.000008 let s:modules = vital#incsearch#import('Over.Commandline.Modules') | |
" Add modules | |
1 0.001187 0.000006 call s:cli.connect('BufferComplete') | |
1 0.000886 0.000006 call s:cli.connect('Cancel') | |
1 0.000929 0.000006 call s:cli.connect('CursorMove') | |
1 0.001236 0.000006 call s:cli.connect('Digraphs') | |
1 0.000941 0.000006 call s:cli.connect('Delete') | |
1 0.001133 0.000006 call s:cli.connect('DrawCommandline') | |
1 0.000935 0.000005 call s:cli.connect('ExceptionExit') | |
1 0.000888 0.000005 call s:cli.connect('LiteralInsert') | |
1 0.000124 call s:cli.connect(incsearch#over#modules#exit#make()) | |
1 0.000133 call s:cli.connect(incsearch#over#modules#insert_register#make()) | |
1 0.000882 0.000005 call s:cli.connect('Paste') | |
1 0.002089 0.000007 let s:Doautocmd = s:modules.get('Doautocmd') | |
1 0.000361 0.000013 call s:cli.connect(s:Doautocmd.make('IncSearch')) | |
1 0.000980 0.000018 call s:cli.connect(s:modules.get('ExceptionMessage').make('incsearch.vim: ', 'echom')) | |
1 0.000933 0.000015 call s:cli.connect(s:modules.get('History').make('/')) | |
1 0.000924 0.000016 call s:cli.connect(s:modules.get('NoInsert').make_special_chars()) | |
" Dynamic Module Loading Management | |
1 0.002615 0.000007 let s:KeyMapping = s:modules.get('KeyMapping') | |
1 0.000017 0.000012 let s:emacs_like = s:KeyMapping.make_emacs() | |
1 0.000015 0.000009 let s:vim_cmap = s:KeyMapping.make_vim_cmdline_mapping() | |
1 0.000862 0.000013 let s:smartbackword = s:modules.get('IgnoreRegexpBackwardWord').make() | |
1 0.000003 function! s:emacs_like._condition() abort | |
return g:incsearch#emacs_like_keymap | |
endfunction | |
1 0.000003 function! s:vim_cmap._condition() abort | |
return g:incsearch#vim_cmdline_keymap | |
endfunction | |
1 0.000002 function! s:smartbackword._condition() abort | |
return g:incsearch#smart_backward_word | |
endfunction | |
1 0.000143 call s:cli.connect(incsearch#over#modules#module_management#make([s:emacs_like, s:vim_cmap, s:smartbackword])) | |
1 0.000004 unlet s:KeyMapping s:emacs_like s:vim_cmap s:smartbackword | |
1 0.000170 call s:cli.connect(incsearch#over#modules#pattern_saver#make()) | |
1 0.000136 call s:cli.connect(incsearch#over#modules#bulk_input_char#make()) | |
1 0.000128 call s:cli.connect(incsearch#over#modules#incsearch#make()) | |
1 0.000003 function! s:cli.__keymapping__() abort | |
return copy(self._keymap) | |
endfunction | |
1 0.000129 call incsearch#over#extend#enrich(s:cli) | |
1 0.000009 let &cpo = s:save_cpo | |
1 0.000002 unlet s:save_cpo | |
" __END__ | |
" vim: expandtab softtabstop=2 shiftwidth=2 foldmethod=marker | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/incsearch.vim | |
Sourced 1 time | |
Total time: 0.000632 | |
Self time: 0.000577 | |
count total (s) self (s) | |
let s:plugin_name = expand('<sfile>:t:r') | |
1 0.000006 let s:vital_base_dir = expand('<sfile>:h') | |
1 0.000005 let s:project_root = expand('<sfile>:h:h:h') | |
1 0.000004 let s:is_vital_vim = s:plugin_name is# 'vital' | |
1 0.000002 let s:loaded = {} | |
1 0.000002 let s:cache_sid = {} | |
" function() wrapper | |
1 0.000004 if v:version > 703 || v:version == 703 && has('patch1170') | |
1 0.000013 function! s:_function(fstr) abort | |
return function(a:fstr) | |
endfunction | |
1 0.000002 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
let s:_s = '<SNR>' . s:_SID() . '_' | |
function! s:_function(fstr) abort | |
return function(substitute(a:fstr, 's:', s:_s, 'g')) | |
endfunction | |
endif | |
1 0.000007 function! vital#{s:plugin_name}#of() abort | |
return s:new(s:plugin_name) | |
endfunction | |
1 0.000005 function! vital#{s:plugin_name}#import(...) abort | |
if !exists('s:V') | |
let s:V = s:new(s:plugin_name) | |
endif | |
return call(s:V.import, a:000, s:V) | |
endfunction | |
1 0.000003 let s:Vital = {} | |
1 0.000004 function! s:new(plugin_name) abort | |
let base = deepcopy(s:Vital) | |
let base._plugin_name = a:plugin_name | |
return base | |
endfunction | |
1 0.000003 function! s:vital_files() abort | |
if !exists('s:vital_files') | |
let s:vital_files = map( | |
\ s:is_vital_vim ? s:_global_vital_files() : s:_self_vital_files(), | |
\ 'fnamemodify(v:val, ":p:gs?[\\\\/]?/?")') | |
endif | |
return copy(s:vital_files) | |
endfunction | |
1 0.000021 0.000013 let s:Vital.vital_files = s:_function('s:vital_files') | |
1 0.000004 function! s:import(name, ...) abort dict | |
let target = {} | |
let functions = [] | |
for a in a:000 | |
if type(a) == type({}) | |
let target = a | |
elseif type(a) == type([]) | |
let functions = a | |
endif | |
unlet a | |
endfor | |
let module = self._import(a:name) | |
if empty(functions) | |
call extend(target, module, 'keep') | |
else | |
for f in functions | |
if has_key(module, f) && !has_key(target, f) | |
let target[f] = module[f] | |
endif | |
endfor | |
endif | |
return target | |
endfunction | |
1 0.000013 0.000007 let s:Vital.import = s:_function('s:import') | |
1 0.000003 function! s:load(...) abort dict | |
for arg in a:000 | |
let [name; as] = type(arg) == type([]) ? arg[: 1] : [arg, arg] | |
let target = split(join(as, ''), '\W\+') | |
let dict = self | |
let dict_type = type({}) | |
while !empty(target) | |
let ns = remove(target, 0) | |
if !has_key(dict, ns) | |
let dict[ns] = {} | |
endif | |
if type(dict[ns]) == dict_type | |
let dict = dict[ns] | |
else | |
unlet dict | |
break | |
endif | |
endwhile | |
if exists('dict') | |
call extend(dict, self._import(name)) | |
endif | |
unlet arg | |
endfor | |
return self | |
endfunction | |
1 0.000025 0.000018 let s:Vital.load = s:_function('s:load') | |
1 0.000003 function! s:unload() abort dict | |
let s:loaded = {} | |
let s:cache_sid = {} | |
unlet! s:vital_files | |
endfunction | |
1 0.000012 0.000006 let s:Vital.unload = s:_function('s:unload') | |
1 0.000003 function! s:exists(name) abort dict | |
if a:name !~# '\v^\u\w*%(\.\u\w*)*$' | |
throw 'vital: Invalid module name: ' . a:name | |
endif | |
return s:_module_path(a:name) isnot# '' | |
endfunction | |
1 0.000010 0.000005 let s:Vital.exists = s:_function('s:exists') | |
1 0.000003 function! s:search(pattern) abort dict | |
let paths = s:_extract_files(a:pattern, self.vital_files()) | |
let modules = sort(map(paths, 's:_file2module(v:val)')) | |
return s:_uniq(modules) | |
endfunction | |
1 0.000011 0.000006 let s:Vital.search = s:_function('s:search') | |
1 0.000003 function! s:plugin_name() abort dict | |
return self._plugin_name | |
endfunction | |
1 0.000011 0.000005 let s:Vital.plugin_name = s:_function('s:plugin_name') | |
1 0.000003 function! s:_self_vital_files() abort | |
let builtin = printf('%s/__%s__/', s:vital_base_dir, s:plugin_name) | |
let installed = printf('%s/_%s/', s:vital_base_dir, s:plugin_name) | |
let base = builtin . ',' . installed | |
return split(globpath(base, '**/*.vim', 1), "\n") | |
endfunction | |
1 0.000003 function! s:_global_vital_files() abort | |
let pattern = 'autoload/vital/__*__/**/*.vim' | |
return split(globpath(&runtimepath, pattern, 1), "\n") | |
endfunction | |
1 0.000003 function! s:_extract_files(pattern, files) abort | |
let tr = {'.': '/', '*': '[^/]*', '**': '.*'} | |
let target = substitute(a:pattern, '\.\|\*\*\?', '\=tr[submatch(0)]', 'g') | |
let regexp = printf('autoload/vital/[^/]\+/%s.vim$', target) | |
return filter(a:files, 'v:val =~# regexp') | |
endfunction | |
1 0.000006 function! s:_file2module(file) abort | |
let filename = fnamemodify(a:file, ':p:gs?[\\/]?/?') | |
let tail = matchstr(filename, 'autoload/vital/_\w\+/\zs.*\ze\.vim$') | |
return join(split(tail, '[\\/]\+'), '.') | |
endfunction | |
" @param {string} name e.g. Data.List | |
1 0.000003 function! s:_import(name) abort dict | |
if has_key(s:loaded, a:name) | |
return copy(s:loaded[a:name]) | |
endif | |
let module = self._get_module(a:name) | |
if has_key(module, '_vital_created') | |
call module._vital_created(module) | |
endif | |
let export_module = filter(copy(module), 'v:key =~# "^\\a"') | |
" Cache module before calling module.vital_loaded() to avoid cyclic | |
" dependences but remove the cache if module._vital_loaded() fails. | |
" let s:loaded[a:name] = export_module | |
let s:loaded[a:name] = export_module | |
if has_key(module, '_vital_loaded') | |
try | |
call module._vital_loaded(vital#{s:plugin_name}#of()) | |
catch | |
unlet s:loaded[a:name] | |
throw 'vital: fail to call ._vital_loaded(): ' . v:exception | |
endtry | |
endif | |
return copy(s:loaded[a:name]) | |
endfunction | |
1 0.000012 0.000006 let s:Vital._import = s:_function('s:_import') | |
" s:_get_module() returns module object wihch has all script local functions. | |
1 0.000003 function! s:_get_module(name) abort dict | |
let funcname = s:_import_func_name(self.plugin_name(), a:name) | |
if s:_exists_autoload_func_with_source(funcname) | |
return call(funcname, []) | |
else | |
return s:_get_builtin_module(a:name) | |
endif | |
endfunction | |
1 0.000004 function! s:_get_builtin_module(name) abort | |
return s:sid2sfuncs(s:_module_sid(a:name)) | |
endfunction | |
1 0.000002 if s:is_vital_vim | |
" For vital.vim, we can use s:_get_builtin_module directly | |
let s:Vital._get_module = s:_function('s:_get_builtin_module') | |
else | |
1 0.000012 0.000006 let s:Vital._get_module = s:_function('s:_get_module') | |
1 0.000002 endif | |
1 0.000004 function! s:_import_func_name(plugin_name, module_name) abort | |
return printf('vital#_%s#%s#import', a:plugin_name, s:_dot_to_sharp(a:module_name)) | |
endfunction | |
1 0.000003 function! s:_module_sid(name) abort | |
let path = s:_module_path(a:name) | |
if !filereadable(path) | |
throw 'vital: module not found: ' . a:name | |
endif | |
let vital_dir = s:is_vital_vim ? '__\w\+__' : printf('_\{1,2}%s\%%(__\)\?', s:plugin_name) | |
let base = join([vital_dir, ''], '[/\\]\+') | |
let p = base . substitute('' . a:name, '\.', '[/\\\\]\\+', 'g') | |
let sid = s:_sid(path, p) | |
if !sid | |
call s:_source(path) | |
let sid = s:_sid(path, p) | |
if !sid | |
throw printf('vital: cannot get <SID> from path: %s', path) | |
endif | |
endif | |
return sid | |
endfunction | |
1 0.000003 function! s:_module_path(name) abort | |
return get(s:_extract_files(a:name, s:vital_files()), 0, '') | |
endfunction | |
1 0.000003 function! s:_module_sid_base_dir() abort | |
return s:is_vital_vim ? &rtp : s:project_root | |
endfunction | |
1 0.000002 function! s:_dot_to_sharp(name) abort | |
return substitute(a:name, '\.', '#', 'g') | |
endfunction | |
" It will sources autoload file if a given func is not already defined. | |
1 0.000004 function! s:_exists_autoload_func_with_source(funcname) abort | |
if exists('*' . a:funcname) | |
" Return true if a given func is already defined | |
return 1 | |
endif | |
" source a file which may include a given func definition and try again. | |
let path = 'autoload/' . substitute(substitute(a:funcname, '#[^#]*$', '.vim', ''), '#', '/', 'g') | |
call s:_runtime(path) | |
return exists('*' . a:funcname) | |
endfunction | |
1 0.000002 function! s:_runtime(path) abort | |
execute 'runtime' fnameescape(a:path) | |
endfunction | |
1 0.000002 function! s:_source(path) abort | |
execute 'source' fnameescape(a:path) | |
endfunction | |
" @vimlint(EVL102, 1, l:_) | |
" @vimlint(EVL102, 1, l:__) | |
1 0.000002 function! s:_sid(path, filter_pattern) abort | |
let unified_path = s:_unify_path(a:path) | |
if has_key(s:cache_sid, unified_path) | |
return s:cache_sid[unified_path] | |
endif | |
for line in filter(split(s:_redir(':scriptnames'), "\n"), 'v:val =~# a:filter_pattern') | |
let [_, sid, path; __] = matchlist(line, '^\s*\(\d\+\):\s\+\(.\+\)\s*$') | |
if s:_unify_path(path) is# unified_path | |
let s:cache_sid[unified_path] = sid | |
return s:cache_sid[unified_path] | |
endif | |
endfor | |
return 0 | |
endfunction | |
1 0.000003 function! s:_redir(cmd) abort | |
let [save_verbose, save_verbosefile] = [&verbose, &verbosefile] | |
set verbose=0 verbosefile= | |
redir => res | |
silent! execute a:cmd | |
redir END | |
let [&verbose, &verbosefile] = [save_verbose, save_verbosefile] | |
return res | |
endfunction | |
1 0.000013 if filereadable(expand('<sfile>:r') . '.VIM') " is case-insensitive or not | |
let s:_unify_path_cache = {} | |
" resolve() is slow, so we cache results. | |
" Note: On windows, vim can't expand path names from 8.3 formats. | |
" So if getting full path via <sfile> and $HOME was set as 8.3 format, | |
" vital load duplicated scripts. Below's :~ avoid this issue. | |
function! s:_unify_path(path) abort | |
if has_key(s:_unify_path_cache, a:path) | |
return s:_unify_path_cache[a:path] | |
endif | |
let value = tolower(fnamemodify(resolve(fnamemodify( | |
\ a:path, ':p')), ':~:gs?[\\/]?/?')) | |
let s:_unify_path_cache[a:path] = value | |
return value | |
endfunction | |
else | |
1 0.000003 function! s:_unify_path(path) abort | |
return resolve(fnamemodify(a:path, ':p:gs?[\\/]?/?')) | |
endfunction | |
1 0.000001 endif | |
" copied and modified from Vim.ScriptLocal | |
1 0.000038 let s:SNR = join(map(range(len("\<SNR>")), '"[\\x" . printf("%0x", char2nr("\<SNR>"[v:val])) . "]"'), '') | |
1 0.000004 function! s:sid2sfuncs(sid) abort | |
let fs = split(s:_redir(printf(':function /^%s%s_', s:SNR, a:sid)), "\n") | |
let r = {} | |
let pattern = printf('\m^function\s<SNR>%d_\zs\w\{-}\ze(', a:sid) | |
for fname in map(fs, 'matchstr(v:val, pattern)') | |
let r[fname] = function(s:_sfuncname(a:sid, fname)) | |
endfor | |
return r | |
endfunction | |
"" Return funcname of script local functions with SID | |
1 0.000003 function! s:_sfuncname(sid, funcname) abort | |
return printf('<SNR>%s_%s', a:sid, a:funcname) | |
endfunction | |
1 0.000005 if exists('*uniq') | |
1 0.000003 function! s:_uniq(list) abort | |
return uniq(a:list) | |
endfunction | |
1 0.000001 else | |
function! s:_uniq(list) abort | |
let i = len(a:list) - 1 | |
while 0 < i | |
if a:list[i] ==# a:list[i - 1] | |
call remove(a:list, i) | |
endif | |
let i -= 1 | |
endwhile | |
return a:list | |
endfunction | |
endif | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline.vim | |
Sourced 2 times | |
Total time: 1490407872.197652 | |
Self time: 1490407872.197501 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000142 function! vital#_incsearch#Over#Commandline#import() abort | |
return map({'_vital_depends': '', 'make_standard_search_back': '', 'get_module': '', 'make_standard_search': '', 'make_standard': '', 'make_module': '', 'make_default': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000004 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#import() abort', printf("return map({'_vital_depends': '', 'make_standard_search_back': '', 'get_module': '', 'make_standard_search': '', 'make_standard': '', 'make_module': '', 'make_default': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000006 scriptencoding utf-8 | |
2 0.000014 let s:save_cpo = &cpo | |
2 0.000015 set cpo&vim | |
2 0.000010 function! s:_vital_loaded(V) | |
let s:V = a:V | |
let s:Maker = s:V.import("Over.Commandline.Maker") | |
let s:Modules = s:V.import("Over.Commandline.Modules") | |
endfunction | |
2 0.000007 function! s:_vital_depends() | |
return [ | |
\ "Over.Commandline.Maker", | |
\ "Over.Commandline.Modules", | |
\ "Over.Commandline.Modules.All", | |
\ ] | |
endfunction | |
2 0.000006 function! s:make_module(...) | |
return call(s:Modules.make, a:000, s:Modules) | |
endfunction | |
2 0.000007 function! s:get_module(...) | |
return call(s:Modules.get, a:000, s:Modules) | |
endfunction | |
2 0.000007 function! s:make_default(...) | |
return call(s:Maker.default, a:000, s:Maker) | |
endfunction | |
2 0.000007 function! s:make_standard(...) | |
return call(s:Maker.standard, a:000, s:Maker) | |
endfunction | |
2 0.000006 function! s:make_standard_search(...) | |
return call(s:Maker.standard_search, a:000, s:Maker) | |
endfunction | |
2 0.000006 function! s:make_standard_search_back(...) | |
return call(s:Maker.standard_search_back, a:000, s:Maker) | |
endfunction | |
2 0.000017 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Maker.vim | |
Sourced 2 times | |
Total time: 1490407872.198573 | |
Self time: 1490407872.198423 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000148 function! vital#_incsearch#Over#Commandline#Maker#import() abort | |
return map({'plain': '', '_vital_depends': '', 'standard_search': '', 'standard': '', 'standard_search_back': '', 'default': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000004 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Maker#import() abort', printf("return map({'plain': '', '_vital_depends': '', 'standard_search': '', 'standard': '', 'standard_search_back': '', 'default': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000005 scriptencoding utf-8 | |
2 0.000012 let s:save_cpo = &cpo | |
2 0.000013 set cpo&vim | |
2 0.000024 let s:modules = [ | |
\ "Scroll", | |
\ "CursorMove", | |
\ "Delete", | |
\ "HistAdd", | |
\ "History", | |
\ "Cancel", | |
\ "Execute", | |
\ "NoInsert", | |
\ "InsertRegister", | |
\ "Redraw", | |
\ "DrawCommandline", | |
\ "ExceptionExit", | |
\ "ExceptionMessage", | |
\] | |
2 0.000006 function! s:_vital_loaded(V) | |
let s:V = a:V | |
let s:Cmdline = s:V.import("Over.Commandline.Base") | |
let s:Modules = s:V.import("Over.Commandline.Modules") | |
endfunction | |
2 0.000006 function! s:_vital_depends() | |
return [ | |
\ "Over.Commandline.Base", | |
\ "Over.Commandline.Modules", | |
\ ] + map(copy(s:modules), "'Over.Commandline.Modules.' . v:val") | |
endfunction | |
2 0.000005 function! s:default(...) | |
return call(s:Cmdline.make, a:000, s:Cmdline) | |
endfunction | |
2 0.000004 function! s:plain() | |
return s:Cmdline.plain() | |
endfunction | |
2 0.000004 function! s:standard(...) | |
let result = call(s:Cmdline.make, a:000, s:Cmdline) | |
call result.connect("Execute") | |
call result.connect("Cancel") | |
call result.connect("Delete") | |
call result.connect("CursorMove") | |
call result.connect("HistAdd") | |
call result.connect("History") | |
call result.connect("InsertRegister") | |
call result.connect(s:Modules.get("NoInsert").make_special_chars()) | |
call result.connect("Redraw") | |
call result.connect("DrawCommandline") | |
call result.connect("ExceptionExit") | |
call result.connect("ExceptionMessage") | |
call result.connect(s:Modules.get("KeyMapping").make_vim_cmdline_mapping()) | |
call result.connect("Digraphs") | |
call result.connect("LiteralInsert") | |
return result | |
endfunction | |
2 0.000005 function! s:standard_search(...) | |
let result = s:standard(get(a:, 1, "/")) | |
call result.connect(s:Modules.get("Execute").make_search("/")) | |
call result.connect(s:Modules.make("HistAdd", "/")) | |
call result.connect(s:Modules.make("History", "/")) | |
return result | |
endfunction | |
2 0.000005 function! s:standard_search_back(...) | |
let result = s:standard(get(a:, 1, "?")) | |
call result.connect(s:Modules.get("Execute").make_search("?")) | |
call result.connect(s:Modules.make("HistAdd", "/")) | |
call result.connect(s:Modules.make("History", "/")) | |
return result | |
endfunction | |
2 0.000017 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Base.vim | |
Sourced 2 times | |
Total time: 1490407872.200554 | |
Self time: 1490407872.199875 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000014 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000150 function! vital#_incsearch#Over#Commandline#Base#import() abort | |
return map({'_vital_depends': '', 'make_plain': '', 'is_input_waiting': '', 'make': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000004 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Base#import() abort', printf("return map({'_vital_depends': '', 'make_plain': '', 'is_input_waiting': '', 'make': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000005 scriptencoding utf-8 | |
2 0.000015 let s:save_cpo = &cpo | |
2 0.000013 set cpo&vim | |
2 0.000008 function! s:_vital_loaded(V) | |
let s:V = a:V | |
let s:String = s:V.import("Over.String") | |
let s:Signals = s:V.import("Over.Signals") | |
let s:Input = s:V.import("Over.Input") | |
let s:Keymapping = s:V.import("Over.Keymapping") | |
let s:Module = s:V.import("Over.Commandline.Modules") | |
let s:base.variables.modules = s:Signals.make() | |
function! s:base.variables.modules.get_slot(val) | |
return a:val.slot.module | |
endfunction | |
let s:Highlight = s:V.import("Palette.Highlight") | |
endfunction | |
2 0.000004 function! s:_vital_depends() | |
return [ | |
\ "Over.String", | |
\ "Over.Signals", | |
\ "Over.Input", | |
\ "Over.Keymapping", | |
\ "Over.Commandline.Modules", | |
\ "Palette.Highlight", | |
\ ] | |
endfunction | |
2 0.000005 function! s:make(...) | |
let result = deepcopy(s:base) | |
call result.set_prompt(get(a:, 1, ":")) | |
call result.connect(result, "_") | |
return result | |
endfunction | |
2 0.000005 function! s:make_plain() | |
return deepcopy(s:base) | |
endfunction | |
2 0.000073 let s:base = { | |
\ "line" : {}, | |
\ "variables" : { | |
\ "prompt" : "", | |
\ "char" : "", | |
\ "input" : "", | |
\ "tap_key" : "", | |
\ "exit" : 0, | |
\ "keymapping" : {}, | |
\ "suffix" : "", | |
\ "is_setted" : 0, | |
\ }, | |
\ "highlights" : { | |
\ "prompt" : "NONE", | |
\ "cursor" : "VitalOverCommandLineCursor", | |
\ "cursor_on" : "VitalOverCommandLineCursorOn", | |
\ "cursor_insert" : "VitalOverCommandLineOnCursor", | |
\ }, | |
\} | |
2 0.000009 if exists("s:Signals") | |
let s:base.variables.modules = s:Signals.make() | |
function! s:base.variables.modules.get_slot(val) | |
return a:val.slot.module | |
endfunction | |
endif | |
2 0.000005 function! s:base.getline() | |
return self.line.str() | |
endfunction | |
2 0.000004 function! s:base.setline(line) | |
return self.line.set(a:line) | |
endfunction | |
2 0.000004 function! s:base.char() | |
return self.variables.char | |
endfunction | |
2 0.000004 function! s:base.setchar(char, ...) | |
" 1 の場合は既に設定されていても上書きする | |
" 0 の場合は既に設定されていれば上書きしない | |
let overwrite = get(a:, 1, 1) | |
if overwrite || self.variables.is_setted == 0 | |
let self.variables.input = a:char | |
let self.variables.is_setted = 1 | |
endif | |
endfunction | |
2 0.000003 function! s:base.getpos() | |
return self.line.pos() | |
endfunction | |
2 0.000004 function! s:base.setpos(pos) | |
return self.line.set_pos(a:pos) | |
endfunction | |
2 0.000004 function! s:base.tap_keyinput(key) | |
let self.variables.tap_key = a:key | |
endfunction | |
2 0.000004 function! s:base.untap_keyinput(key) | |
if self.variables.tap_key == a:key | |
let self.variables.tap_key = "" | |
return 1 | |
endif | |
endfunction | |
2 0.000004 function! s:base.get_tap_key() | |
return self.variables.tap_key | |
endfunction | |
2 0.000005 function! s:base.is_input(key, ...) | |
let prekey = get(a:, 1, "") | |
return self.get_tap_key() ==# prekey | |
\ && self.char() ==# a:key | |
" \ && self.char() == (prekey . a:key) | |
endfunction | |
2 0.000004 function! s:base.input_key() | |
return self.variables.input_key | |
endfunction | |
2 0.000004 function! s:base.set_prompt(prompt) | |
let self.variables.prompt = a:prompt | |
endfunction | |
2 0.000004 function! s:base.get_prompt() | |
return self.variables.prompt | |
endfunction | |
2 0.000004 function! s:base.set_suffix(str) | |
let self.variables.suffix = a:str | |
endfunction | |
2 0.000004 function! s:base.get_suffix() | |
return self.variables.suffix | |
endfunction | |
2 0.000004 function! s:base.insert(word, ...) | |
if a:0 | |
call self.line.set(a:1) | |
endif | |
call self.line.input(a:word) | |
endfunction | |
2 0.000004 function! s:base.forward() | |
return self.line.forward() | |
endfunction | |
2 0.000004 function! s:base.backward() | |
return self.line.backward() | |
endfunction | |
2 0.000004 function! s:base.backward_word(...) | |
let pat = get(a:, 1, '\k\+\s*\|.') | |
return matchstr(self.backward(), '\%(' . pat . '\)$') | |
endfunction | |
2 0.000006 function! s:base.connect(module, ...) | |
if type(a:module) == type("") | |
return call(self.connect, [s:Module.make(a:module)] + a:000, self) | |
endif | |
if empty(a:module) | |
return | |
endif | |
let name = a:0 > 0 ? a:1 : a:module.name | |
let slot = self.variables.modules.find_first_by("get(v:val.slot, 'name', '') == " . string(name)) | |
if empty(slot) | |
call self.variables.modules.connect({ "name" : name, "module" : a:module }) | |
else | |
let slot.slot.module = a:module | |
endif | |
" let self.variables.modules[name] = a:module | |
endfunction | |
2 0.000004 function! s:base.disconnect(name) | |
return self.variables.modules.disconnect_by( | |
\ "get(v:val.slot, 'name', '') == " . string(a:name) | |
\ ) | |
" unlet self.variables.modules[a:name] | |
endfunction | |
2 0.000005 function! s:base.get_module(name) | |
let slot = self.variables.modules.find_first_by("get(v:val.slot, 'name', '') == " . string(a:name)) | |
return empty(slot) ? {} : slot.slot.module | |
endfunction | |
2 0.000006 function! s:base.callevent(event) | |
call self.variables.modules.sort_by("has_key(v:val.slot.module, 'priority') ? v:val.slot.module.priority('" . a:event . "') : 0") | |
return self.variables.modules.call(a:event, [self]) | |
" call map(filter(copy(self.variables.modules), "has_key(v:val, a:event)"), "v:val." . a:event . "(self)") | |
endfunction | |
2 0.000004 function! s:base.cmap(lhs, rhs) | |
let self.variables.keymapping[a:lhs] = a:rhs | |
endfunction | |
2 0.000006 function! s:base.cnoremap(lhs, rhs) | |
let key = s:Keymapping.as_key_config(a:rhs) | |
let key.noremap = 1 | |
let self.variables.keymapping[a:lhs] = key | |
endfunction | |
2 0.000004 function! s:base.cunmap(lhs) | |
unlet self.variables.keymapping[a:lhs] | |
endfunction | |
2 0.000004 function! s:base.keymapping() | |
return self.__keymapping__() | |
endfunction | |
2 0.000004 function! s:base.__keymapping__() | |
return {} | |
endfunction | |
2 0.000003 function! s:base.execute(...) | |
let command = get(a:, 1, self.getline()) | |
call self.__execute(command) | |
endfunction | |
2 0.000004 function! s:base.draw() | |
call self.callevent("on_draw_pre") | |
call self.callevent("on_draw") | |
endfunction | |
2 0.000005 function! s:base.exit(...) | |
let self.variables.exit = 1 | |
let self.variables.exit_code = get(a:, 1, 0) | |
endfunction | |
2 0.000004 function! s:base.enable_keymapping() | |
let self.variables.enable_keymapping = 1 | |
endfunction | |
2 0.000004 function! s:base.disable_keymapping() | |
let self.variables.enable_keymapping = 0 | |
endfunction | |
2 0.000004 function! s:base.is_enable_keymapping() | |
return self.variables.enable_keymapping | |
endfunction | |
" function! s:base.cancel() | |
" call self.exit(1) | |
" call self.__on_cancel() | |
" endfunction | |
2 0.000003 function! s:base.exit_code() | |
return self.variables.exit_code | |
endfunction | |
2 0.000004 function! s:base.hl_cursor_on() | |
if exists("self.variables.old_guicursor") | |
set guicursor& | |
let &guicursor = self.variables.old_guicursor | |
unlet self.variables.old_guicursor | |
endif | |
if exists("self.variables.old_t_ve") | |
let &t_ve = self.variables.old_t_ve | |
unlet self.variables.old_t_ve | |
endif | |
endfunction | |
2 0.000004 function! s:base.hl_cursor_off() | |
if exists("self.variables.old_t_ve") | |
return | |
endif | |
let self.variables.old_guicursor = &guicursor | |
set guicursor=n:block-NONE | |
let self.variables.old_t_ve = &t_ve | |
set t_ve= | |
endfunction | |
2 0.000004 function! s:base.start(...) | |
let exit_code = call(self.__main, a:000, self) | |
return exit_code | |
endfunction | |
2 0.000009 function! s:base.__empty(...) | |
endfunction | |
2 0.000004 function! s:base.get(...) | |
let Old_execute = self.execute | |
let self.execute = self.__empty | |
try | |
let exit_code = call(self.start, a:000, self) | |
if exit_code == 0 | |
return self.getline() | |
endif | |
finally | |
let self.execute = Old_execute | |
endtry | |
return "" | |
endfunction | |
2 0.000005 function! s:base.input_key_stack() | |
return self.variables.input_key_stack | |
endfunction | |
2 0.000004 function! s:base.input_key_stack_string() | |
return join(self.variables.input_key_stack, "") | |
endfunction | |
2 0.000005 function! s:base.set_input_key_stack(stack) | |
let self.variables.input_key_stack = a:stack | |
return self.variables.input_key_stack | |
endfunction | |
2 0.000009 function! s:base.input_key_stack_pop() | |
return remove(self.input_key_stack(), 0) | |
endfunction | |
2 0.000003 function! s:base.getchar(...) | |
if empty(self.input_key_stack()) | |
return call(s:Input.getchar, a:000, s:Input) | |
endif | |
return self.input_key_stack_pop() | |
endfunction | |
2 0.000004 function! s:base.__init_variables() | |
let self.variables.tap_key = "" | |
let self.variables.char = "" | |
let self.variables.input = "" | |
let self.variables.exit = 0 | |
let self.variables.exit_code = 1 | |
let self.variables.enable_keymapping = 1 | |
let self.variables.input_key_stack = [] | |
let self.line = deepcopy(s:String.make()) | |
endfunction | |
2 0.000006 function! s:_is_valid_highlight(name) | |
let highlight = s:Highlight.get(a:name) | |
if empty(highlight) | |
return 0 | |
endif | |
if has("gui_running") | |
\ && (has_key(highlight, "guifg") || has_key(highlight, "guibg")) | |
return 1 | |
elseif (has_key(highlight, "ctermfg") || has_key(highlight, "ctermbg")) | |
return 1 | |
endif | |
return 0 | |
endfunction | |
2 0.000004 function! s:base.__init() | |
call self.__init_variables() | |
call self.hl_cursor_off() | |
if !hlexists(self.highlights.cursor) | |
if s:_is_valid_highlight("Cursor") | |
execute "highlight link " . self.highlights.cursor . " Cursor" | |
else | |
" Workaround by CUI Vim Cursor Highlight | |
" issues #92 | |
" https://github.com/osyo-manga/vital-over/issues/92 | |
execute "highlight " . self.highlights.cursor . " term=reverse cterm=reverse gui=reverse" | |
endif | |
endif | |
if !hlexists(self.highlights.cursor_on) | |
execute "highlight link " . self.highlights.cursor_on . " " . self.highlights.cursor | |
endif | |
if !hlexists(self.highlights.cursor_insert) | |
execute "highlight " . self.highlights.cursor_insert . " cterm=underline term=underline gui=underline" | |
endif | |
endfunction | |
2 0.000004 function! s:base.__execute(command) | |
call self.callevent("on_execute_pre") | |
try | |
call self.__execute__(a:command) | |
catch | |
echohl ErrorMsg | |
echom matchstr(v:exception, 'Vim\((\w*)\)\?:\zs.*\ze') | |
echohl None | |
call self.callevent("on_execute_failed") | |
finally | |
call self.callevent("on_execute") | |
endtry | |
endfunction | |
2 0.000005 function! s:base.__execute__(cmd) | |
execute a:cmd | |
endfunction | |
2 0.000007 function! s:base.__input_char(char) | |
let char = a:char | |
let self.variables.input_key = char | |
let self.variables.char = char | |
call self.setchar(self.variables.char) | |
let self.variables.is_setted = 0 | |
call self.callevent("on_char_pre") | |
call self.insert(self.variables.input) | |
call self.callevent("on_char") | |
endfunction | |
2 0.000005 function! s:base.__input(input, ...) | |
if a:input == "" | |
return | |
endif | |
let self.variables.input_key = a:input | |
if a:0 == 0 | |
let keymapping = self.__get_keymapping() | |
else | |
let keymapping = a:1 | |
endif | |
if self.is_enable_keymapping() | |
let key = s:Keymapping.unmapping(keymapping, a:input) | |
else | |
let key = a:input | |
endif | |
if key == "" | |
return | |
endif | |
call self.set_input_key_stack(s:String.split_by_keys(key)) | |
while !(empty(self.input_key_stack()) || self.is_exit()) | |
call self.__input_char(self.input_key_stack_pop()) | |
endwhile | |
endfunction | |
2 0.000008 function! s:is_input_waiting(keymapping, input) | |
let num = len(filter(copy(a:keymapping), 'stridx(v:key, a:input) == 0')) | |
return num > 1 || (num == 1 && !has_key(a:keymapping, a:input)) | |
endfunction | |
2 0.000004 function! s:base.__inputting() | |
if !self.is_enable_keymapping() | |
return self.__input(s:Input.getchar()) | |
endif | |
let input = s:Input.getchar() | |
let old_line = self.getline() | |
let old_pos = self.getpos() | |
let keymapping = self.__get_keymapping() | |
try | |
let t = reltime() | |
while s:is_input_waiting(keymapping, input) | |
\ && str2nr(reltimestr(reltime(t))) * 1000 < &timeoutlen | |
call self.setline(old_line) | |
call self.insert(input) | |
call self.setpos(old_pos) | |
call self.draw() | |
let input .= s:Input.getchar(0) | |
endwhile | |
finally | |
call self.setline(old_line) | |
call self.setpos(old_pos) | |
endtry | |
call self.__input(input, keymapping) | |
endfunction | |
2 0.000004 function! s:base.__update() | |
" call self.callevent("on_update") | |
" if !getchar(1) | |
" continue | |
" endif | |
" | |
" call self.__input(s:getchar(0)) | |
" call self.draw() | |
call self.callevent("on_update") | |
call self.__inputting() | |
" call self.__input(s:Input.getchar()) | |
if self.is_exit() | |
return -1 | |
endif | |
call self.draw() | |
endfunction | |
2 0.000008 function! s:base.__main(...) | |
try | |
call self.__init() | |
call self.callevent("on_enter") | |
call self.__input(get(a:, 1, "")) | |
call self.draw() | |
while !self.is_exit() | |
try | |
if self.__update() | |
break | |
endif | |
catch | |
call self.callevent("on_exception") | |
endtry | |
endwhile | |
catch | |
echohl ErrorMsg | echom v:throwpoint . " " . v:exception | echohl None | |
let self.variables.exit_code = -1 | |
finally | |
call self.__finish() | |
call self.callevent("on_leave") | |
endtry | |
return self.exit_code() | |
endfunction | |
2 0.000004 function! s:base.__finish() | |
call self.hl_cursor_on() | |
endfunction | |
2 0.000004 function! s:base.__is_exit() | |
return self.is_exit() | |
endfunction | |
2 0.000004 function! s:base.is_exit() | |
return self.variables.exit | |
endfunction | |
2 0.000004 function! s:base.__get_keymapping() | |
let result = {} | |
" for module in values(self.variables.modules) | |
for module in self.variables.modules.slots() | |
if has_key(module, "keymapping") | |
if module isnot self | |
call extend(result, module.keymapping(self)) | |
endif | |
endif | |
endfor | |
return extend(extend(result, self.variables.keymapping), self.keymapping()) | |
endfunction | |
2 0.000020 let &cpo = s:save_cpo | |
2 0.000006 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/String.vim | |
Sourced 2 times | |
Total time: 1490407872.201616 | |
Self time: 1490407872.201377 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000012 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000145 function! vital#_incsearch#Over#String#import() abort | |
return map({'_vital_depends': '', 'length': '', 'index': '', 'split_by_keys': '', 'make': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000004 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#String#import() abort', printf("return map({'_vital_depends': '', 'length': '', 'index': '', 'split_by_keys': '', 'make': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000005 scriptencoding utf-8 | |
2 0.000015 let s:save_cpo = &cpo | |
2 0.000013 set cpo&vim | |
2 0.000008 function! s:_vital_loaded(V) | |
let s:V = a:V | |
let s:List = s:V.import("Data.List") | |
endfunction | |
2 0.000005 function! s:_vital_depends() | |
return [ | |
\ "Data.List", | |
\ ] | |
endfunction | |
2 0.000005 function! s:_clamp(x, max, min) | |
return min([max([a:x, a:max]), a:min]) | |
endfunction | |
2 0.000012 let s:base = {} | |
2 0.000006 function! s:base.set(item) | |
return type(a:item) == type("") ? self.set_str(a:item) | |
\ : type(a:item) == type(0) ? self.set_pos(a:item) | |
\ : self | |
endfunction | |
2 0.000004 function! s:base.str() | |
return join(self.list, "") | |
endfunction | |
2 0.000004 function! s:base.set_pos(pos) | |
let self.col = s:_clamp(a:pos, 0, self.length()) | |
return self | |
endfunction | |
2 0.000004 function! s:base.backward() | |
return self.col > 0 ? join(self.list[ : self.col-1], '') : "" | |
endfunction | |
2 0.000004 function! s:base.forward() | |
return join(self.list[self.col+1 : ], '') | |
endfunction | |
2 0.000004 function! s:base.pos_char() | |
return get(self.list, self.col, "") | |
endfunction | |
2 0.000004 function! s:base.set_str(str) | |
let self.list = split(a:str, '\zs') | |
let self.col = strchars(a:str) | |
return self | |
endfunction | |
2 0.000004 function! s:base.pos() | |
return self.col | |
endfunction | |
2 0.000004 function! s:base.input(str) | |
call extend(self.list, split(a:str, '\zs'), self.col) | |
let self.col += len(split(a:str, '\zs')) | |
return self | |
endfunction | |
2 0.000004 function! s:base.length() | |
return len(self.list) | |
endfunction | |
2 0.000004 function! s:base.next() | |
return self.set_pos(self.col + 1) | |
endfunction | |
2 0.000002 function! s:base.prev() | |
return self.set_pos(self.col - 1) | |
endfunction | |
2 0.000003 function! s:base.remove(index) | |
if a:index < 0 || self.length() <= a:index | |
return "" | |
endif | |
let result = self.list[a:index] | |
unlet self.list[a:index] | |
if a:index < self.col | |
call self.set(self.col - 1) | |
endif | |
return result | |
endfunction | |
2 0.000004 function! s:base.remove_pos() | |
return self.remove(self.col) | |
endfunction | |
2 0.000003 function! s:base.remove_prev() | |
return self.remove(self.col - 1) | |
endfunction | |
2 0.000003 function! s:base.remove_next() | |
return self.remove(self.col + 1) | |
endfunction | |
2 0.000004 function! s:make(...) | |
let default = get(a:, 1, "") | |
let result = deepcopy(s:base) | |
call result.set(default) | |
return result | |
endfunction | |
" NOTE: old regexpengine has a bug with string which contains binary | |
" :echo "\x80" =~ "\\%#=1\x80" | " => 0 | |
" But it matches correctly with :h /collection | |
" :echo "\x80" =~ "\\%#=1[\x80]" | " => 1 | |
" http://lingr.com/room/vim/archives/2015/02/13#message-21261450 | |
2 0.000012 let s:_engine = exists("+regexpengine") ? '\%#=2' : '' | |
" \<A-]> => Û\xfdQ | |
" \<A-@> => À\xfeX | |
2 0.000016 let s:_regex = exists("+regexpengine") | |
\ ? "\\%(Û\xfdQ\\|À\xfeX\\|\x80\xfc.\\%(\x80..\\|.\\)\\|\x80..\\|.\\)\\zs" | |
\ : "\\%(Û[\xfd]Q\\|À[\xfe]X\\|[\x80][\xfc].\\%([\x80]..\\|.\\)\\|[\x80]..\\|.\\)\\zs" | |
2 0.000008 function! s:_split_keystring(str, ...) | |
return split(a:str, s:_engine . '\m\%(' . get(a:, 1, '') . s:_regex . '\)') | |
endfunction | |
2 0.000006 function! s:split_by_keys(str) | |
return s:_split_keystring(a:str, "\\%(\<Plug>\\|<Over>\\)(.\\{-})\\zs\\|") | |
endfunction | |
2 0.000007 function! s:index(haystack, needle, ...) | |
let start = get(a:, 1, 0) | |
let ignorecase = get(a:, 2, &ignorecase) | |
if ignorecase | |
return stridx(tolower(a:haystack), tolower(a:needle), start) | |
else | |
return stridx(a:haystack, a:needle, start) | |
endif | |
endfunction | |
2 0.000005 function! s:length(str) | |
return len(s:split_by_keys(a:str)) | |
endfunction | |
2 0.000020 let &cpo = s:save_cpo | |
2 0.000006 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Data/List.vim | |
Sourced 2 times | |
Total time: 1490407872.203215 | |
Self time: 1490407872.202685 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000015 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000143 function! vital#_incsearch#Data#List#import() abort | |
return map({'combinations': '', 'and': '', 'sort_by': '', 'foldr1': '', 'sort': '', 'flatten': '', 'has_index': '', 'find_indices': '', 'any': '', 'unshift': '', 'span': '', 'pop': '', 'binary_search': '', 'uniq_by': '', 'or': '', 'all': '', 'zip': '', 'find_last_index': '', 'find': '', 'partition': '', 'map_accum': '', 'permutations': '', 'break': '', 'max_by': '', 'foldl': '', 'foldr': '', 'find_index': '', 'group_by': '', 'take_while': '', 'conj': '', 'push': '', 'char_range': '', 'cons': '', 'foldl1': '', 'intersect': '', 'concat': '', 'shift': '', 'clear': '', 'has_common_items': '', 'product': '', 'zip_fill': '', 'uniq': '', 'has': '', 'min_by': '', 'with_index': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000004 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Data#List#import() abort', printf("return map({'combinations': '', 'and': '', 'sort_by': '', 'foldr1': '', 'sort': '', 'flatten': '', 'has_index': '', 'find_indices': '', 'any': '', 'unshift': '', 'span': '', 'pop': '', 'binary_search': '', 'uniq_by': '', 'or': '', 'all': '', 'zip': '', 'find_last_index': '', 'find': '', 'partition': '', 'map_accum': '', 'permutations': '', 'break': '', 'max_by': '', 'foldl': '', 'foldr': '', 'find_index': '', 'group_by': '', 'take_while': '', 'conj': '', 'push': '', 'char_range': '', 'cons': '', 'foldl1': '', 'intersect': '', 'concat': '', 'shift': '', 'clear': '', 'has_common_items': '', 'product': '', 'zip_fill': '', 'uniq': '', 'has': '', 'min_by': '', 'with_index': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
" Utilities for list. | |
2 0.000013 let s:save_cpo = &cpo | |
2 0.000016 set cpo&vim | |
2 0.000008 function! s:pop(list) abort | |
return remove(a:list, -1) | |
endfunction | |
2 0.000006 function! s:push(list, val) abort | |
call add(a:list, a:val) | |
return a:list | |
endfunction | |
2 0.000004 function! s:shift(list) abort | |
return remove(a:list, 0) | |
endfunction | |
2 0.000006 function! s:unshift(list, val) abort | |
return insert(a:list, a:val) | |
endfunction | |
2 0.000004 function! s:cons(x, xs) abort | |
return [a:x] + a:xs | |
endfunction | |
2 0.000004 function! s:conj(xs, x) abort | |
return a:xs + [a:x] | |
endfunction | |
" Removes duplicates from a list. | |
2 0.000004 function! s:uniq(list) abort | |
return s:uniq_by(a:list, 'v:val') | |
endfunction | |
" Removes duplicates from a list. | |
2 0.000006 function! s:uniq_by(list, f) abort | |
let list = map(copy(a:list), printf('[v:val, %s]', a:f)) | |
let i = 0 | |
let seen = {} | |
while i < len(list) | |
let key = string(list[i][1]) | |
if has_key(seen, key) | |
call remove(list, i) | |
else | |
let seen[key] = 1 | |
let i += 1 | |
endif | |
endwhile | |
return map(list, 'v:val[0]') | |
endfunction | |
2 0.000005 function! s:clear(list) abort | |
if !empty(a:list) | |
unlet! a:list[0 : len(a:list) - 1] | |
endif | |
return a:list | |
endfunction | |
" Concatenates a list of lists. | |
" XXX: Should we verify the input? | |
2 0.000005 function! s:concat(list) abort | |
let memo = [] | |
for Value in a:list | |
let memo += Value | |
endfor | |
return memo | |
endfunction | |
" Take each elements from lists to a new list. | |
2 0.000004 function! s:flatten(list, ...) abort | |
let limit = a:0 > 0 ? a:1 : -1 | |
let memo = [] | |
if limit == 0 | |
return a:list | |
endif | |
let limit -= 1 | |
for Value in a:list | |
let memo += | |
\ type(Value) == type([]) ? | |
\ s:flatten(Value, limit) : | |
\ [Value] | |
unlet! Value | |
endfor | |
return memo | |
endfunction | |
" Sorts a list with expression to compare each two values. | |
" a:a and a:b can be used in {expr}. | |
2 0.000004 function! s:sort(list, expr) abort | |
if type(a:expr) == type(function('function')) | |
return sort(a:list, a:expr) | |
endif | |
let s:expr = a:expr | |
return sort(a:list, 's:_compare') | |
endfunction | |
2 0.000005 function! s:_compare(a, b) abort | |
return eval(s:expr) | |
endfunction | |
" Sorts a list using a set of keys generated by mapping the values in the list | |
" through the given expr. | |
" v:val is used in {expr} | |
2 0.000014 function! s:sort_by(list, expr) abort | |
let pairs = map(a:list, printf('[v:val, %s]', a:expr)) | |
return map(s:sort(pairs, | |
\ 'a:a[1] ==# a:b[1] ? 0 : a:a[1] ># a:b[1] ? 1 : -1'), 'v:val[0]') | |
endfunction | |
" Returns a maximum value in {list} through given {expr}. | |
" Returns 0 if {list} is empty. | |
" v:val is used in {expr} | |
2 0.000006 function! s:max_by(list, expr) abort | |
if empty(a:list) | |
return 0 | |
endif | |
let list = map(copy(a:list), a:expr) | |
return a:list[index(list, max(list))] | |
endfunction | |
" Returns a minimum value in {list} through given {expr}. | |
" Returns 0 if {list} is empty. | |
" v:val is used in {expr} | |
" FIXME: -0x80000000 == 0x80000000 | |
2 0.000005 function! s:min_by(list, expr) abort | |
return s:max_by(a:list, '-(' . a:expr . ')') | |
endfunction | |
" Returns List of character sequence between [a:from, a:to] | |
" e.g.: s:char_range('a', 'c') returns ['a', 'b', 'c'] | |
2 0.000005 function! s:char_range(from, to) abort | |
return map( | |
\ range(char2nr(a:from), char2nr(a:to)), | |
\ 'nr2char(v:val)' | |
\) | |
endfunction | |
" Returns true if a:list has a:value. | |
" Returns false otherwise. | |
2 0.000006 function! s:has(list, value) abort | |
return index(a:list, a:value) isnot -1 | |
endfunction | |
" Returns true if a:list[a:index] exists. | |
" Returns false otherwise. | |
" NOTE: Returns false when a:index is negative number. | |
2 0.000005 function! s:has_index(list, index) abort | |
" Return true when negative index? | |
" let index = a:index >= 0 ? a:index : len(a:list) + a:index | |
return 0 <= a:index && a:index < len(a:list) | |
endfunction | |
" similar to Haskell's Data.List.span | |
2 0.000004 function! s:span(f, xs) abort | |
let border = len(a:xs) | |
for i in range(len(a:xs)) | |
if !eval(substitute(a:f, 'v:val', string(a:xs[i]), 'g')) | |
let border = i | |
break | |
endif | |
endfor | |
return border == 0 ? [[], copy(a:xs)] : [a:xs[: border - 1], a:xs[border :]] | |
endfunction | |
" similar to Haskell's Data.List.break | |
2 0.000006 function! s:break(f, xs) abort | |
return s:span(printf('!(%s)', a:f), a:xs) | |
endfunction | |
" similar to Haskell's Data.List.takeWhile | |
2 0.000006 function! s:take_while(f, xs) abort | |
return s:span(a:f, a:xs)[0] | |
endfunction | |
" similar to Haskell's Data.List.partition | |
2 0.000006 function! s:partition(f, xs) abort | |
return [filter(copy(a:xs), a:f), filter(copy(a:xs), '!(' . a:f . ')')] | |
endfunction | |
" similar to Haskell's Prelude.all | |
2 0.000004 function! s:all(f, xs) abort | |
return !s:any(printf('!(%s)', a:f), a:xs) | |
endfunction | |
" similar to Haskell's Prelude.any | |
2 0.000006 function! s:any(f, xs) abort | |
return !empty(filter(map(copy(a:xs), a:f), 'v:val')) | |
endfunction | |
" similar to Haskell's Prelude.and | |
2 0.000004 function! s:and(xs) abort | |
return s:all('v:val', a:xs) | |
endfunction | |
" similar to Haskell's Prelude.or | |
2 0.000004 function! s:or(xs) abort | |
return s:any('v:val', a:xs) | |
endfunction | |
2 0.000006 function! s:map_accum(expr, xs, init) abort | |
let memo = [] | |
let init = a:init | |
for x in a:xs | |
let expr = substitute(a:expr, 'v:memo', init, 'g') | |
let expr = substitute(expr, 'v:val', x, 'g') | |
let [tmp, init] = eval(expr) | |
call add(memo, tmp) | |
endfor | |
return memo | |
endfunction | |
" similar to Haskell's Prelude.foldl | |
2 0.000005 function! s:foldl(f, init, xs) abort | |
let memo = a:init | |
for x in a:xs | |
let expr = substitute(a:f, 'v:val', string(x), 'g') | |
let expr = substitute(expr, 'v:memo', string(memo), 'g') | |
unlet memo | |
let memo = eval(expr) | |
endfor | |
return memo | |
endfunction | |
" similar to Haskell's Prelude.foldl1 | |
2 0.000006 function! s:foldl1(f, xs) abort | |
if len(a:xs) == 0 | |
throw 'vital: Data.List: foldl1' | |
endif | |
return s:foldl(a:f, a:xs[0], a:xs[1:]) | |
endfunction | |
" similar to Haskell's Prelude.foldr | |
2 0.000005 function! s:foldr(f, init, xs) abort | |
return s:foldl(a:f, a:init, reverse(copy(a:xs))) | |
endfunction | |
" similar to Haskell's Prelude.fold11 | |
2 0.000005 function! s:foldr1(f, xs) abort | |
if len(a:xs) == 0 | |
throw 'vital: Data.List: foldr1' | |
endif | |
return s:foldr(a:f, a:xs[-1], a:xs[0:-2]) | |
endfunction | |
" similar to python's zip() | |
2 0.000004 function! s:zip(...) abort | |
return map(range(min(map(copy(a:000), 'len(v:val)'))), "map(copy(a:000), 'v:val['.v:val.']')") | |
endfunction | |
" similar to zip(), but goes until the longer one. | |
2 0.000006 function! s:zip_fill(xs, ys, filler) abort | |
if empty(a:xs) && empty(a:ys) | |
return [] | |
elseif empty(a:ys) | |
return s:cons([a:xs[0], a:filler], s:zip_fill(a:xs[1 :], [], a:filler)) | |
elseif empty(a:xs) | |
return s:cons([a:filler, a:ys[0]], s:zip_fill([], a:ys[1 :], a:filler)) | |
else | |
return s:cons([a:xs[0], a:ys[0]], s:zip_fill(a:xs[1 :], a:ys[1: ], a:filler)) | |
endif | |
endfunction | |
" Inspired by Ruby's with_index method. | |
2 0.000006 function! s:with_index(list, ...) abort | |
let base = a:0 > 0 ? a:1 : 0 | |
return map(copy(a:list), '[v:val, v:key + base]') | |
endfunction | |
" similar to Ruby's detect or Haskell's find. | |
2 0.000005 function! s:find(list, default, f) abort | |
for x in a:list | |
if eval(substitute(a:f, 'v:val', string(x), 'g')) | |
return x | |
endif | |
endfor | |
return a:default | |
endfunction | |
" Returns the index of the first element which satisfies the given expr. | |
2 0.000005 function! s:find_index(xs, f, ...) abort | |
let len = len(a:xs) | |
let start = a:0 > 0 ? (a:1 < 0 ? len + a:1 : a:1) : 0 | |
let default = a:0 > 1 ? a:2 : -1 | |
if start >=# len || start < 0 | |
return default | |
endif | |
for i in range(start, len - 1) | |
if eval(substitute(a:f, 'v:val', string(a:xs[i]), 'g')) | |
return i | |
endif | |
endfor | |
return default | |
endfunction | |
" Returns the index of the last element which satisfies the given expr. | |
2 0.000005 function! s:find_last_index(xs, f, ...) abort | |
let len = len(a:xs) | |
let start = a:0 > 0 ? (a:1 < 0 ? len + a:1 : a:1) : len - 1 | |
let default = a:0 > 1 ? a:2 : -1 | |
if start >=# len || start < 0 | |
return default | |
endif | |
for i in range(start, 0, -1) | |
if eval(substitute(a:f, 'v:val', string(a:xs[i]), 'g')) | |
return i | |
endif | |
endfor | |
return default | |
endfunction | |
" Similar to find_index but returns the list of indices satisfying the given expr. | |
2 0.000007 function! s:find_indices(xs, f, ...) abort | |
let len = len(a:xs) | |
let start = a:0 > 0 ? (a:1 < 0 ? len + a:1 : a:1) : 0 | |
let result = [] | |
if start >=# len || start < 0 | |
return result | |
endif | |
for i in range(start, len - 1) | |
if eval(substitute(a:f, 'v:val', string(a:xs[i]), 'g')) | |
call add(result, i) | |
endif | |
endfor | |
return result | |
endfunction | |
" Return non-zero if a:list1 and a:list2 have any common item(s). | |
" Return zero otherwise. | |
2 0.000009 function! s:has_common_items(list1, list2) abort | |
return !empty(filter(copy(a:list1), 'index(a:list2, v:val) isnot -1')) | |
endfunction | |
2 0.000006 function! s:intersect(list1, list2) abort | |
let items = [] | |
" for funcref | |
for X in a:list1 | |
if index(a:list2, X) != -1 && index(items, X) == -1 | |
let items += [X] | |
endif | |
endfor | |
return items | |
endfunction | |
" similar to Ruby's group_by. | |
2 0.000005 function! s:group_by(xs, f) abort | |
let result = {} | |
let list = map(copy(a:xs), printf('[v:val, %s]', a:f)) | |
for x in list | |
let Val = x[0] | |
let key = type(x[1]) !=# type('') ? string(x[1]) : x[1] | |
if has_key(result, key) | |
call add(result[key], Val) | |
else | |
let result[key] = [Val] | |
endif | |
unlet Val | |
endfor | |
return result | |
endfunction | |
2 0.000009 function! s:_default_compare(a, b) abort | |
return a:a <# a:b ? -1 : a:a ># a:b ? 1 : 0 | |
endfunction | |
2 0.000007 function! s:binary_search(list, value, ...) abort | |
let Predicate = a:0 >= 1 ? a:1 : 's:_default_compare' | |
let dic = a:0 >= 2 ? a:2 : {} | |
let start = 0 | |
let end = len(a:list) - 1 | |
while 1 | |
if start > end | |
return -1 | |
endif | |
let middle = (start + end) / 2 | |
let compared = call(Predicate, [a:value, a:list[middle]], dic) | |
if compared < 0 | |
let end = middle - 1 | |
elseif compared > 0 | |
let start = middle + 1 | |
else | |
return middle | |
endif | |
endwhile | |
endfunction | |
2 0.000005 function! s:product(lists) abort | |
let result = [[]] | |
for pool in a:lists | |
let tmp = [] | |
for x in result | |
let tmp += map(copy(pool), 'x + [v:val]') | |
endfor | |
let result = tmp | |
endfor | |
return result | |
endfunction | |
2 0.000008 function! s:permutations(list, ...) abort | |
if a:0 > 1 | |
throw 'vital: Data.List: too many arguments' | |
endif | |
let r = a:0 == 1 ? a:1 : len(a:list) | |
if r > len(a:list) | |
return [] | |
elseif r < 0 | |
throw 'vital: Data.List: {r} must be non-negative integer' | |
endif | |
let n = len(a:list) | |
let result = [] | |
for indices in s:product(map(range(r), 'range(n)')) | |
if len(s:uniq(indices)) == r | |
call add(result, map(indices, 'a:list[v:val]')) | |
endif | |
endfor | |
return result | |
endfunction | |
2 0.000009 function! s:combinations(list, r) abort | |
if a:r > len(a:list) | |
return [] | |
elseif a:r < 0 | |
throw 'vital: Data:List: {r} must be non-negative integer' | |
endif | |
let n = len(a:list) | |
let result = [] | |
for indices in s:permutations(range(n), a:r) | |
if s:sort(copy(indices), 'a:a - a:b') == indices | |
call add(result, map(indices, 'a:list[v:val]')) | |
endif | |
endfor | |
return result | |
endfunction | |
2 0.000022 let &cpo = s:save_cpo | |
2 0.000005 unlet s:save_cpo | |
" vim:set et ts=2 sts=2 sw=2 tw=0: | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Signals.vim | |
Sourced 2 times | |
Total time: 1490407872.204507 | |
Self time: 1490407872.204332 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000012 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000139 function! vital#_incsearch#Over#Signals#import() abort | |
return map({'_vital_depends': '', 'call': '', 'make': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Signals#import() abort', printf("return map({'_vital_depends': '', 'call': '', 'make': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000005 scriptencoding utf-8 | |
2 0.000014 let s:save_cpo = &cpo | |
2 0.000014 set cpo&vim | |
2 0.000008 function! s:_vital_loaded(V) | |
let s:V = a:V | |
let s:L = s:V.import("Data.List") | |
endfunction | |
2 0.000006 function! s:_vital_depends() | |
return ["Data.List"] | |
endfunction | |
2 0.000020 let s:base = { | |
\ "variables" : { | |
\ "slots" : [], | |
\ "counter" : 0, | |
\ } | |
\} | |
2 0.000006 function! s:base.connect(slot) | |
let self.variables.counter += 1 | |
let slot = { "id" : self.variables.counter, "slot" : a:slot } | |
call add(self.variables.slots, slot) | |
return slot | |
endfunction | |
2 0.000005 function! s:base.disconnect(slot) | |
if empty(a:slot) | |
return -1 | |
endif | |
for i in range(len(self.variables.slots)) | |
if self.variables.slots[i].id == a:slot.id | |
unlet self.variables.slots[i] | |
return | |
endif | |
endfor | |
return -1 | |
endfunction | |
2 0.000004 function! s:base.disconnect_by(expr) | |
return self.disconnect(self.find_first_by(a:expr)) | |
endfunction | |
2 0.000006 function! s:call(list, func, ...) | |
let args = get(a:, 1, []) | |
let def = get(a:, 2, 0) | |
return map(copy(a:list), "has_key(v:val, a:func) ? call(v:val.".a:func.", args, v:val) : def") | |
endfunction | |
2 0.000004 function! s:base.call(func, ...) | |
return call("s:call", [self.slots(), a:func] + a:000) | |
endfunction | |
2 0.000004 function! s:base.find_by(expr) | |
return filter(copy(self.variables.slots), a:expr) | |
endfunction | |
2 0.000004 function! s:base.find_first_by(expr) | |
return get(self.find_by(a:expr), 0, {}) | |
endfunction | |
2 0.000003 function! s:base.sort_by(expr) | |
let self.variables.slots = s:L.sort_by(self.variables.slots, a:expr) | |
endfunction | |
2 0.000004 function! s:base.get_slot(val) | |
return a:val.slot | |
endfunction | |
2 0.000003 function! s:base.slots() | |
return map(copy(self.variables.slots), "self.get_slot(v:val)") | |
endfunction | |
" function! s:base.dict() | |
" let result = {} | |
" for _ in self.variables.slots | |
" let result[_.id] = _.value | |
" endfor | |
" return result | |
" endfunction | |
2 0.000004 function! s:make() | |
let result = deepcopy(s:base) | |
return result | |
endfunction | |
2 0.000024 let &cpo = s:save_cpo | |
2 0.000008 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Input.vim | |
Sourced 2 times | |
Total time: 1490407872.205380 | |
Self time: 1490407872.205295 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000142 function! vital#_incsearch#Over#Input#import() abort | |
return map({'getchar': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Input#import() abort', printf("return map({'getchar': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000015 let s:save_cpo = &cpo | |
2 0.000013 set cpo&vim | |
2 0.000007 function! s:getchar(...) | |
let mode = get(a:, 1, 0) | |
while 1 | |
" Workaround for https://github.com/osyo-manga/vital-over/issues/53 | |
try | |
let char = call("getchar", a:000) | |
catch /^Vim:Interrupt$/ | |
let char = 3 " <C-c> | |
endtry | |
" Workaround for the <expr> mappings | |
if string(char) !=# "\x80\xfd`" | |
return mode == 1 ? !!char | |
\ : type(char) == type(0) ? nr2char(char) : char | |
endif | |
endwhile | |
endfunction | |
2 0.000015 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Keymapping.vim | |
Sourced 2 times | |
Total time: 1490407872.206199 | |
Self time: 1490407872.206053 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000139 function! vital#_incsearch#Over#Keymapping#import() abort | |
return map({'_vital_depends': '', 'unmapping': '', 'as_key_config': '', 'match_key': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000004 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Keymapping#import() abort', printf("return map({'_vital_depends': '', 'unmapping': '', 'as_key_config': '', 'match_key': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000005 scriptencoding utf-8 | |
2 0.000014 let s:save_cpo = &cpo | |
2 0.000014 set cpo&vim | |
2 0.000007 function! s:_vital_loaded(V) | |
let s:V = a:V | |
let s:String = s:V.import("Over.String") | |
endfunction | |
2 0.000005 function! s:_vital_depends() | |
return [ | |
\ "Over.String", | |
\ ] | |
endfunction | |
2 0.000005 function! s:as_key_config(config) | |
let base = { | |
\ "noremap" : 0, | |
\ "lock" : 0, | |
\ "expr" : 0, | |
\ } | |
return type(a:config) == type({}) ? extend(base, a:config) | |
\ : extend(base, { | |
\ "key" : a:config, | |
\ }) | |
endfunction | |
2 0.000006 function! s:match_key(keymapping, key) | |
let keys = sort(keys(a:keymapping)) | |
return get(filter(keys, 'stridx(a:key, v:val) == 0'), -1, '') | |
endfunction | |
2 0.000012 function! s:_safe_eval(expr, ...) | |
call extend(l:, get(a:, 1, {})) | |
let result = get(a:, 2, "") | |
try | |
let result = eval(a:expr) | |
catch | |
echohl ErrorMsg | echom v:exception | echohl None | |
endtry | |
return result | |
endfunction | |
2 0.000004 function! s:_get_key(conf) | |
" call extend(l:, a:conf) | |
let self = a:conf | |
return get(a:conf, "expr", 0) ? s:_safe_eval(a:conf.key, l:) : a:conf.key | |
endfunction | |
2 0.000006 function! s:unmapping(keymapping, key, ...) | |
let is_locking = get(a:, 1, 0) | |
let key = s:match_key(a:keymapping, a:key) | |
if key == "" | |
return s:String.length(a:key) <= 1 ? a:key : s:unmapping(a:keymapping, a:key[0], is_locking) . s:unmapping(a:keymapping, a:key[1:], is_locking) | |
endif | |
let map_conf = s:as_key_config(a:keymapping[key]) | |
let next_input = s:unmapping(a:keymapping, a:key[len(key) : ], is_locking) | |
if map_conf.lock == 0 && is_locking | |
return key . next_input | |
elseif map_conf.lock | |
return s:unmapping(a:keymapping, s:_get_key(map_conf), is_locking) . next_input | |
else | |
return s:unmapping(a:keymapping, s:_get_key(map_conf), map_conf.noremap) . next_input | |
endif | |
endfunction | |
2 0.000017 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Modules.vim | |
Sourced 2 times | |
Total time: 1490407872.207087 | |
Self time: 1490407872.206998 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000146 function! vital#_incsearch#Over#Commandline#Modules#import() abort | |
return map({'get': '', 'make': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000002 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Modules#import() abort', printf("return map({'get': '', 'make': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000005 scriptencoding utf-8 | |
2 0.000013 let s:save_cpo = &cpo | |
2 0.000013 set cpo&vim | |
2 0.000006 function! s:_vital_loaded(V) | |
let s:V = a:V | |
endfunction | |
2 0.000005 function! s:get(name) | |
if exists("s:" . a:name) | |
return s:{a:name} | |
endif | |
let s:{a:name} = s:V.import('Over.Commandline.Modules.' . a:name) | |
return s:{a:name} | |
endfunction | |
2 0.000005 function! s:make(name, ...) | |
let module = s:get(a:name) | |
return call(module.make, a:000, module) | |
endfunction | |
2 0.000016 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Palette/Highlight.vim | |
Sourced 2 times | |
Total time: 1490407872.208024 | |
Self time: 1490407872.207862 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000138 function! vital#_incsearch#Palette#Highlight#import() abort | |
return map({'capture': '', '_vital_depends': '', 'parse': '', 'group_list': '', 'set': '', 'parse_to_name': '', 'links_to': '', 'get': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000002 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Palette#Highlight#import() abort', printf("return map({'capture': '', '_vital_depends': '', 'parse': '', 'group_list': '', 'set': '', 'parse_to_name': '', 'links_to': '', 'get': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000015 let s:save_cpo = &cpo | |
2 0.000012 set cpo&vim | |
2 0.000006 function! s:_vital_loaded(V) | |
let s:V = a:V | |
let s:Message = s:V.import("Vim.Message") | |
endfunction | |
2 0.000005 function! s:_vital_depends() | |
return [ | |
\ "Vim.Message", | |
\ ] | |
endfunction | |
2 0.000005 function! s:_execute(cmd) | |
execute a:cmd | |
endfunction | |
2 0.000004 function! s:capture(name) | |
if hlexists(a:name) == 0 | |
return "" | |
endif | |
return s:Message.capture("highlight " . a:name) | |
endfunction | |
2 0.000006 function! s:links_to(highlight) | |
return matchstr(a:highlight, '^\S\+\s\+xxx links to \zs.*\ze$') | |
endfunction | |
2 0.000006 function! s:parse_to_name(highlight) | |
return matchstr(a:highlight, '^\zs\w\+\ze') | |
endfunction | |
2 0.000005 function! s:parse(highlight) | |
let highlight = a:highlight | |
if highlight !~# '^\w\+\s\+xxx\s' | |
return {} | |
endif | |
let name = s:parse_to_name(a:highlight) | |
let result = { "_name" : name } | |
if highlight =~# '^\w\+\s\+xxx cleared' | |
let result.cleared = 1 | |
return result | |
endif | |
let link = s:links_to(highlight) | |
if link != "" | |
let result.link = link | |
return result | |
endif | |
let attrs = [ | |
\ "term", | |
\ "cterm", | |
\ "ctermfg", | |
\ "ctermbg", | |
\ "gui", | |
\ "font", | |
\ "guifg", | |
\ "guibg", | |
\ "guisp", | |
\ ] | |
for attr in attrs | |
let item = matchstr(highlight, '\s' . attr . '=\zs#\?\w\+\ze') | |
if item != "" | |
let result[attr] = item | |
endif | |
endfor | |
return result | |
endfunction | |
2 0.000004 function! s:get(name, ...) | |
if !hlexists(a:name) | |
return {} | |
endif | |
let result = s:parse(substitute(s:capture(a:name), "\n", "", "g")) | |
if has_key(result, "link") && get(a:, 1, 0) | |
return s:get(result.link, get(a:, 1, 0)) | |
else | |
return result | |
endif | |
endfunction | |
2 0.000004 function! s:set(name, config) | |
if type(a:config) == type("") | |
return s:set(a:config, s:get(a:config)) | |
endif | |
if has_key(a:config, "cleared") | |
return s:_execute("highlight clear " . a:name) | |
endif | |
if has_key(a:config, "link") | |
return s:_execute("highlight link " . a:name . " " . a:config.link) | |
endif | |
return s:_execute("highlight " . a:name . " " . join(map(items(filter(a:config, "v:key !=# '_name'")), "v:val[0] . '=' . v:val[1]"), " ")) | |
endfunction | |
2 0.000005 function! s:group_list() | |
let highlights = split(s:Message.capture("highlight"), "\n") | |
return filter(map(highlights, "s:parse_to_name(v:val)"), "v:val != ''") | |
endfunction | |
2 0.000016 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Vim/Message.vim | |
Sourced 2 times | |
Total time: 1490407872.208828 | |
Self time: 1490407872.208708 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000137 function! vital#_incsearch#Vim#Message#import() abort | |
return map({'capture': '', 'echomsg': '', 'echo': '', 'warn': '', 'get_hit_enter_max_length': '', 'error': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000002 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Vim#Message#import() abort', printf("return map({'capture': '', 'echomsg': '', 'echo': '', 'warn': '', 'get_hit_enter_max_length': '', 'error': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000014 let s:save_cpo = &cpo | |
2 0.000014 set cpo&vim | |
2 0.000007 function! s:echo(hl, msg) abort | |
execute 'echohl' a:hl | |
try | |
echo a:msg | |
finally | |
echohl None | |
endtry | |
endfunction | |
2 0.000005 function! s:echomsg(hl, msg) abort | |
execute 'echohl' a:hl | |
try | |
for m in split(a:msg, "\n") | |
echomsg m | |
endfor | |
finally | |
echohl None | |
endtry | |
endfunction | |
2 0.000004 function! s:error(msg) abort | |
call s:echomsg('ErrorMsg', a:msg) | |
endfunction | |
2 0.000005 function! s:warn(msg) abort | |
call s:echomsg('WarningMsg', a:msg) | |
endfunction | |
2 0.000005 function! s:capture(command) abort | |
try | |
redir => out | |
silent execute a:command | |
finally | |
redir END | |
endtry | |
return out | |
endfunction | |
" * Get max length of |hit-enter|. | |
" If a string length of a message is greater than the max length, | |
" Vim waits for user input according to |hit-enter|. | |
" XXX: Those fixed values may be different between different OSes? | |
" Currently tested on only Windows. | |
2 0.000005 function! s:get_hit_enter_max_length() abort | |
let maxlen = &columns * &cmdheight - 1 | |
if &ruler | |
" TODO | |
endif | |
if &showcmd | |
let maxlen -= 11 | |
endif | |
return maxlen | |
endfunction | |
2 0.000017 let &cpo = s:save_cpo | |
2 0.000006 unlet s:save_cpo | |
" vim:set et ts=2 sts=2 sw=2 tw=0: | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Modules/BufferComplete.vim | |
Sourced 2 times | |
Total time: 1490407872.210472 | |
Self time: 1490407872.210254 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000012 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000172 function! vital#_incsearch#Over#Commandline#Modules#BufferComplete#import() abort | |
return map({'make': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000004 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Modules#BufferComplete#import() abort', printf("return map({'make': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000013 let s:save_cpo = &cpo | |
2 0.000014 set cpo&vim | |
2 0.000007 function! s:_uniq(list) | |
let dict = {} | |
for _ in a:list | |
let dict[_] = 0 | |
endfor | |
return keys(dict) | |
endfunction | |
2 0.000014 let s:module = { | |
\ "name" : "BufferComplete", | |
\} | |
2 0.000006 function! s:_buffer_complete() | |
return sort(s:_uniq(filter(split(join(getline(1, '$')), '\W'), '!empty(v:val)')), 1) | |
endfunction | |
2 0.000004 function! s:_parse_line(line) | |
let keyword = matchstr(a:line, '\zs\w\+\ze$') | |
let pos = strchars(a:line) - strchars(keyword) | |
return [pos, keyword] | |
endfunction | |
2 0.000005 function! s:_as_statusline(list, count) | |
if empty(a:list) | |
return | |
endif | |
let hl_none = "%#StatusLine#" | |
let hl_select = "%#StatusLineNC#" | |
let tail = " > " | |
let result = a:list[0] | |
let pos = 0 | |
for i in range(1, len(a:list)-1) | |
if strdisplaywidth(result . " " . a:list[i]) > &columns - len(tail) | |
if a:count < i | |
break | |
else | |
let pos = -i | |
endif | |
let result = a:list[i] | |
else | |
let result .= (" " . a:list[i]) | |
endif | |
if a:count == i | |
let pos = pos + i | |
endif | |
endfor | |
return join(map(split(result, " "), 'v:key == pos ? hl_select . v:val . hl_none : v:val')) | |
endfunction | |
2 0.000005 function! s:module.get_complete_words() | |
return s:_buffer_complete() | |
endfunction | |
2 0.000004 function! s:module.complete(cmdline) | |
call s:_finish() | |
let s:old_statusline = &statusline | |
let backward = a:cmdline.backward() | |
let [pos, keyword] = s:_parse_line(backward) | |
if !exists("s:complete") | |
let s:complete = self.get_complete_words() | |
endif | |
let s:complete_list = filter(copy(s:complete), 'v:val =~ ''^''.keyword') | |
if empty(s:complete_list) | |
return -1 | |
endif | |
if pos == 0 | |
let backward = "" | |
else | |
let backward = join(split(backward, '\zs')[ : pos-1 ], "") | |
endif | |
let s:line = backward . a:cmdline.forward() | |
let s:pos = pos | |
call a:cmdline.setline(s:line) | |
let s:count = 0 | |
endfunction | |
2 0.000004 function! s:_finish() | |
if exists("s:old_statusline") | |
let &statusline = s:old_statusline | |
unlet s:old_statusline | |
redrawstatus | |
endif | |
endfunction | |
2 0.000004 function! s:module.on_char_pre(cmdline) | |
if a:cmdline.is_input("<Over>(buffer-complete)") | |
\ || a:cmdline.is_input("<Over>(buffer-complete-prev)") | |
if self.complete(a:cmdline) == -1 | |
call s:_finish() | |
call a:cmdline.setchar('') | |
return | |
endif | |
if a:cmdline.is_input("<Over>(buffer-complete-prev)") | |
let s:count = len(s:complete_list) - 1 | |
endif | |
call a:cmdline.setchar('') | |
call a:cmdline.tap_keyinput("Completion") | |
" elseif a:cmdline.is_input("\<Tab>", "Completion") | |
elseif a:cmdline.is_input("<Over>(buffer-complete)", "Completion") | |
\ || a:cmdline.is_input("\<Right>", "Completion") | |
call a:cmdline.setchar('') | |
let s:count += 1 | |
if s:count >= len(s:complete_list) | |
let s:count = 0 | |
endif | |
elseif a:cmdline.is_input("<Over>(buffer-complete-prev)", "Completion") | |
\ || a:cmdline.is_input("\<Left>", "Completion") | |
call a:cmdline.setchar('') | |
let s:count -= 1 | |
if s:count < 0 | |
let s:count = len(s:complete_list) - 1 | |
endif | |
else | |
if a:cmdline.untap_keyinput("Completion") | |
call a:cmdline.callevent("on_char_pre") | |
endif | |
call s:_finish() | |
return | |
endif | |
call a:cmdline.setline(s:line) | |
call a:cmdline.insert(s:complete_list[s:count], s:pos) | |
if len(s:complete_list) > 1 | |
let &statusline = s:_as_statusline(s:complete_list, s:count) | |
redrawstatus | |
endif | |
if len(s:complete_list) == 1 | |
call a:cmdline.untap_keyinput("Completion") | |
endif | |
endfunction | |
2 0.000008 function! s:module.on_draw_pre(...) | |
" redrawstatus | |
endfunction | |
2 0.000004 function! s:module.on_leave(cmdline) | |
call s:_finish() | |
unlet! s:complete | |
endfunction | |
2 0.000005 function! s:make() | |
return deepcopy(s:module) | |
endfunction | |
2 0.000017 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Modules/Cancel.vim | |
Sourced 2 times | |
Total time: 1490407872.211371 | |
Self time: 1490407872.211282 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000154 function! vital#_incsearch#Over#Commandline#Modules#Cancel#import() abort | |
return map({'make': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000004 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Modules#Cancel#import() abort', printf("return map({'make': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000013 let s:save_cpo = &cpo | |
2 0.000015 set cpo&vim | |
2 0.000011 let s:module = { | |
\ "name" : "Cancel" | |
\} | |
2 0.000006 function! s:module.on_char_pre(cmdline) | |
if a:cmdline.is_input("\<Esc>") | |
\ || a:cmdline.is_input("\<C-c>") | |
" call a:cmdline.cancel() | |
call a:cmdline.exit(1) | |
call a:cmdline.setchar("") | |
endif | |
endfunction | |
2 0.000006 function! s:make() | |
return deepcopy(s:module) | |
endfunction | |
2 0.000016 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Modules/CursorMove.vim | |
Sourced 2 times | |
Total time: 1490407872.212295 | |
Self time: 1490407872.212185 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000161 function! vital#_incsearch#Over#Commandline#Modules#CursorMove#import() abort | |
return map({'make': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Modules#CursorMove#import() abort', printf("return map({'make': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000005 scriptencoding utf-8 | |
2 0.000014 let s:save_cpo = &cpo | |
2 0.000013 set cpo&vim | |
2 0.000012 let s:module = { | |
\ "name" : "CursorMove" | |
\} | |
2 0.000006 function! s:module.on_char_pre(cmdline) | |
if a:cmdline.is_input("\<Right>") | |
call a:cmdline.line.next() | |
call a:cmdline.setchar('') | |
elseif a:cmdline.is_input("\<Left>") | |
call a:cmdline.line.prev() | |
call a:cmdline.setchar('') | |
elseif a:cmdline.is_input("\<C-b>") | |
\ || a:cmdline.is_input("\<Home>") | |
call a:cmdline.setline(0) | |
call a:cmdline.setchar('') | |
elseif a:cmdline.is_input("\<C-e>") | |
\ || a:cmdline.is_input("\<End>") | |
call a:cmdline.setline(a:cmdline.line.length()) | |
call a:cmdline.setchar('') | |
elseif a:cmdline.is_input("\<C-Left>") | |
\ || a:cmdline.is_input("\<S-Left>") | |
call a:cmdline.setline(strridx(a:cmdline.backward()[:-2], ' ') + 1) | |
call a:cmdline.setchar('') | |
elseif a:cmdline.is_input("\<C-Right>") | |
\ || a:cmdline.is_input("\<S-Right>") | |
let p = stridx(a:cmdline.forward()[1:], ' ') | |
call a:cmdline.setline(p != -1 ? a:cmdline.line.pos() + p + 2 : a:cmdline.line.length()) | |
call a:cmdline.setchar('') | |
endif | |
endfunction | |
2 0.000006 function! s:make() | |
return deepcopy(s:module) | |
endfunction | |
2 0.000015 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Modules/Digraphs.vim | |
Sourced 2 times | |
Total time: 1490407872.213368 | |
Self time: 1490407872.213193 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000012 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000165 function! vital#_incsearch#Over#Commandline#Modules#Digraphs#import() abort | |
return map({'capture': '', '_vital_depends': '', 'digraph': '', 'make': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Modules#Digraphs#import() abort', printf("return map({'capture': '', '_vital_depends': '', 'digraph': '', 'make': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000014 let s:save_cpo = &cpo | |
2 0.000013 set cpo&vim | |
2 0.000007 function! s:_vital_loaded(V) | |
let s:Input = a:V.import("Over.Input") | |
endfunction | |
2 0.000005 function! s:_vital_depends() | |
return [ | |
\ "Over.Input", | |
\ ] | |
endfunction | |
2 0.000016 let s:module = { | |
\ "name" : "Digraphs", | |
\ "digraphs" : {} | |
\} | |
2 0.000006 function! s:capture(cmd) | |
let verbose_save = &verbose | |
let &verbose = 0 | |
try | |
redir => result | |
execute "silent!" a:cmd | |
redir END | |
finally | |
let &verbose = verbose_save | |
endtry | |
return result | |
endfunction | |
2 0.000005 function! s:digraph() abort | |
let x = split(substitute(s:capture(':digraph'), "\n", ' ', 'g'), | |
\ '[[:graph:]]\{2}\s.\{1,4}\s\+\d\+\s*\zs') | |
let digraphs = map(x, "split(v:val, ' \\+')") | |
let r = {} | |
for d in digraphs | |
let r[d[0]] = len(d) is 3 && d[2] =~# '\d\+' ? nr2char(str2nr(d[2],10)) | |
\ : len(d) is 2 && d[1] =~# '32' ? nr2char(str2nr(d[1],10)) | |
\ : '' | |
endfor | |
return r | |
endfunction | |
2 0.000006 function! s:module.on_leave(cmdline) | |
" Delete cache to handle additional digraphs definition | |
let self.digraphs = {} | |
endfunction | |
2 0.000004 function! s:module.on_char_pre(cmdline) | |
if a:cmdline.is_input("\<C-k>") | |
if empty(self.digraphs) | |
" Get digraphs when inputting <C-k> instead of on_enter because it cause | |
" flicker in some environments #107 | |
let self.digraphs = s:digraph() | |
endif | |
call a:cmdline.setchar('?') | |
let self.prefix_key = a:cmdline.input_key() | |
let self.old_line = a:cmdline.getline() | |
let self.old_pos = a:cmdline.getpos() | |
return | |
elseif exists("self.prefix_key") | |
\ && a:cmdline.get_tap_key() == self.prefix_key | |
call a:cmdline.setline(self.old_line) | |
call a:cmdline.setpos(self.old_pos) | |
let x = a:cmdline.input_key() | |
let y = s:Input.getchar() | |
" For CTRL-K, there is one general digraph: CTRL-K <Space> {char} will | |
" enter {char} with the highest bit set. You can use this to enter | |
" meta-characters. | |
let char = x ==# "\<Space>" ? | |
\ nr2char(char2nr(y) + 128) : get(self.digraphs, x . y, y) | |
call a:cmdline.setchar(char) | |
endif | |
endfunction | |
2 0.000006 function! s:module.on_char(cmdline) | |
if a:cmdline.is_input("\<C-k>") | |
call a:cmdline.tap_keyinput(self.prefix_key) | |
call a:cmdline.disable_keymapping() | |
call a:cmdline.setpos(a:cmdline.getpos()-1) | |
else | |
if exists("self.prefix_key") | |
call a:cmdline.untap_keyinput(self.prefix_key) | |
call a:cmdline.enable_keymapping() | |
unlet! self.prefix_key | |
endif | |
endif | |
endfunction | |
2 0.000004 function! s:make() | |
return deepcopy(s:module) | |
endfunction | |
2 0.000016 let &cpo = s:save_cpo | |
2 0.000006 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Modules/Delete.vim | |
Sourced 2 times | |
Total time: 1490407872.214460 | |
Self time: 1490407872.214355 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000160 function! vital#_incsearch#Over#Commandline#Modules#Delete#import() abort | |
return map({'make': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000002 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Modules#Delete#import() abort', printf("return map({'make': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000012 let s:save_cpo = &cpo | |
2 0.000014 set cpo&vim | |
2 0.000012 let s:module = { | |
\ "name" : "Delete", | |
\} | |
2 0.000006 function! s:module.on_char_pre(cmdline) | |
if a:cmdline.is_input("\<C-h>") | |
\ || a:cmdline.is_input("\<BS>") | |
if a:cmdline.line.length() == 0 | |
return a:cmdline.exit(1) | |
else | |
call a:cmdline.line.remove_prev() | |
call a:cmdline.setchar('') | |
endif | |
elseif a:cmdline.is_input("\<Del>") | |
call a:cmdline.line.remove_pos() | |
call a:cmdline.setchar('') | |
elseif a:cmdline.is_input("\<C-w>") | |
let word = a:cmdline.backward_word() | |
let backward = a:cmdline.backward()[ : -strlen(word)-1 ] | |
call a:cmdline.setline(backward . a:cmdline.line.pos_char() . a:cmdline.forward()) | |
call a:cmdline.setline(strchars(backward)) | |
call a:cmdline.setchar('') | |
elseif a:cmdline.is_input("\<C-u>") | |
call a:cmdline.setline(a:cmdline.line.pos_char() . a:cmdline.forward()) | |
call a:cmdline.setline(0) | |
call a:cmdline.setchar('') | |
endif | |
endfunction | |
2 0.000008 function! s:make() | |
return deepcopy(s:module) | |
endfunction | |
2 0.000022 let &cpo = s:save_cpo | |
2 0.000008 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Modules/DrawCommandline.vim | |
Sourced 2 times | |
Total time: 1490407872.215581 | |
Self time: 1490407872.215384 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000164 function! vital#_incsearch#Over#Commandline#Modules#DrawCommandline#import() abort | |
return map({'suffix': '', 'make': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Modules#DrawCommandline#import() abort', printf("return map({'suffix': '', 'make': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000014 let s:save_cpo = &cpo | |
2 0.000013 set cpo&vim | |
2 0.000013 let s:module = { | |
\ "name" : "DrawCommandline" | |
\} | |
2 0.000006 let s:cmdheight = {} | |
2 0.000004 function! s:cmdheight.save() | |
if has_key(self, "value") | |
return | |
endif | |
let self.value = &cmdheight | |
endfunction | |
2 0.000004 function! s:cmdheight.restore() | |
if has_key(self, "value") | |
let &cmdheight = self.value | |
unlet self.value | |
endif | |
endfunction | |
2 0.000004 function! s:cmdheight.get() | |
return self.value | |
endfunction | |
2 0.000006 function! s:suffix(left, suffix) | |
let left_len = strdisplaywidth(a:left) | |
let len = &columns - left_len % &columns | |
let len = len + (&columns * (strdisplaywidth(a:suffix) > (len - 1))) - 1 | |
return repeat(" ", len - strdisplaywidth(a:suffix)) . a:suffix | |
" return printf("%" . len . "S", a:suffix) | |
endfunction | |
2 0.000006 let s:old_width = 0 | |
2 0.000004 function! s:_redraw(cmdline) | |
let left = a:cmdline.get_prompt() . a:cmdline.getline() . (empty(a:cmdline.line.pos_char()) ? " " : "") | |
let width = len(left) + 1 | |
if a:cmdline.get_suffix() != "" | |
let width += len(s:suffix(left, a:cmdline.get_suffix())) - 1 | |
endif | |
if &columns >= width && &columns <= s:old_width && s:old_width >= width | |
redraw | |
normal! : | |
elseif &columns <= width | |
normal! : | |
else | |
redraw | |
endif | |
let s:old_width = width | |
call s:cmdheight.save() | |
let height = max([(width - 1) / (&columns) + 1, s:cmdheight.get()]) | |
if height > &cmdheight || &cmdheight > height | |
let &cmdheight = height | |
redraw | |
endif | |
endfunction | |
2 0.000006 function! s:_as_echon(str) | |
return "echon " . strtrans(string(a:str)) | |
endfunction | |
2 0.000005 function! s:module.on_draw_pre(cmdline) | |
if empty(a:cmdline.line.pos_char()) | |
let cursor = "echohl " . a:cmdline.highlights.cursor . " | echon ' '" | |
else | |
let cursor = "echohl " . a:cmdline.highlights.cursor_on . " | " . s:_as_echon(a:cmdline.line.pos_char()) | |
endif | |
let suffix = "" | |
if a:cmdline.get_suffix() != "" | |
let suffix = s:_as_echon(s:suffix(a:cmdline.get_prompt() . a:cmdline.getline() . repeat(" ", empty(a:cmdline.line.pos_char())), a:cmdline.get_suffix())) | |
endif | |
let self.draw_command = join([ | |
\ "echohl " . a:cmdline.highlights.prompt, | |
\ s:_as_echon(a:cmdline.get_prompt()), | |
\ "echohl NONE", | |
\ s:_as_echon(a:cmdline.backward()), | |
\ cursor, | |
\ "echohl NONE", | |
\ s:_as_echon(a:cmdline.forward()), | |
\ suffix, | |
\ ], " | ") | |
call s:_redraw(a:cmdline) | |
endfunction | |
2 0.000004 function! s:_echon(expr) | |
echon strtrans(a:expr) | |
endfunction | |
2 0.000011 function! s:module.on_draw(cmdline) | |
execute self.draw_command | |
" execute "echohl" a:cmdline.highlights.prompt | |
" call s:echon(a:cmdline.get_prompt()) | |
" echohl NONE | |
" call s:echon(a:cmdline.backward()) | |
" if empty(a:cmdline.line.pos_char()) | |
" execute "echohl" a:cmdline.highlights.cursor | |
" call s:echon(' ') | |
" else | |
" execute "echohl" a:cmdline.highlights.cursor_on | |
" call s:echon(a:cmdline.line.pos_char()) | |
" endif | |
" echohl NONE | |
" call s:echon(a:cmdline.forward()) | |
" if a:cmdline.get_suffix() != "" | |
" call s:echon(s:suffix(a:cmdline.get_prompt() . a:cmdline.getline() . repeat(" ", empty(a:cmdline.line.pos_char())), a:cmdline.get_suffix())) | |
" endif | |
endfunction | |
2 0.000004 function! s:module.on_execute_pre(...) | |
call s:cmdheight.restore() | |
endfunction | |
2 0.000004 function! s:module.on_leave(...) | |
call s:cmdheight.restore() | |
endfunction | |
2 0.000004 function! s:make() | |
return deepcopy(s:module) | |
endfunction | |
2 0.000017 let &cpo = s:save_cpo | |
2 0.000006 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Modules/ExceptionExit.vim | |
Sourced 2 times | |
Total time: 1490407872.216535 | |
Self time: 1490407872.216421 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000010 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000165 function! vital#_incsearch#Over#Commandline#Modules#ExceptionExit#import() abort | |
return map({'make': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Modules#ExceptionExit#import() abort', printf("return map({'make': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000006 scriptencoding utf-8 | |
2 0.000019 let s:save_cpo = &cpo | |
2 0.000013 set cpo&vim | |
2 0.000012 let s:module = { | |
\ "name" : "ExceptionExit", | |
\} | |
2 0.000005 function! s:module.on_exception(cmdline) | |
call a:cmdline.exit(-1) | |
endfunction | |
2 0.000009 function! s:make(...) | |
let result = deepcopy(s:module) | |
let result.exit_code = get(a:, 1, 0) | |
return result | |
endfunction | |
2 0.000025 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Modules/LiteralInsert.vim | |
Sourced 2 times | |
Total time: 1490407872.217428 | |
Self time: 1490407872.217331 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000156 function! vital#_incsearch#Over#Commandline#Modules#LiteralInsert#import() abort | |
return map({'make': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Modules#LiteralInsert#import() abort', printf("return map({'make': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000013 let s:save_cpo = &cpo | |
2 0.000012 set cpo&vim | |
2 0.000012 let s:module = { | |
\ "name" : "LiteralInsert", | |
\} | |
2 0.000006 function! s:module.on_char_pre(cmdline) | |
if a:cmdline.is_input("\<C-v>") | |
\ || a:cmdline.is_input("\<C-q>") | |
let old_line = a:cmdline.getline() | |
let old_pos = a:cmdline.getpos() | |
call a:cmdline.insert('^') | |
call a:cmdline.setpos(old_pos) | |
call a:cmdline.draw() | |
let char = a:cmdline.getchar() | |
call a:cmdline.setline(old_line) | |
call a:cmdline.setpos(old_pos) | |
call a:cmdline.setchar(char) | |
endif | |
endfunction | |
2 0.000004 function! s:make() | |
return deepcopy(s:module) | |
endfunction | |
2 0.000015 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/incsearch/over/modules/exit.vim | |
Sourced 1 time | |
Total time: 0.000063 | |
Self time: 0.000063 | |
count total (s) self (s) | |
"============================================================================= | |
" FILE: autoload/incsearch/over/modules/exit.vim | |
" AUTHOR: haya14busa | |
" License: MIT license | |
"============================================================================= | |
1 0.000003 scriptencoding utf-8 | |
1 0.000008 let s:save_cpo = &cpo | |
1 0.000006 set cpo&vim | |
" NOTE: | |
" <CR> in {rhs} wil be remapped even after exiting vital-over command line | |
" interface, so do not use <Over>(exit) | |
" See also s:cli.keymapping() | |
1 0.000006 let s:incsearch_exit = { | |
\ 'name' : 'IncsearchExit', | |
\ 'exit_code' : 0 | |
\} | |
1 0.000003 function! s:incsearch_exit.on_char_pre(cmdline) abort | |
if a:cmdline.is_input("\<CR>") | |
\ || a:cmdline.is_input("\<NL>") | |
call a:cmdline.setchar('') | |
call a:cmdline.exit(self.exit_code) | |
endif | |
endfunction | |
1 0.000005 function! incsearch#over#modules#exit#make() abort | |
return deepcopy(s:incsearch_exit) | |
endfunction | |
1 0.000008 let &cpo = s:save_cpo | |
1 0.000002 unlet s:save_cpo | |
" __END__ | |
" vim: expandtab softtabstop=2 shiftwidth=2 foldmethod=marker | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/incsearch/over/modules/insert_register.vim | |
Sourced 1 time | |
Total time: 0.001285 | |
Self time: 0.000101 | |
count total (s) self (s) | |
"============================================================================= | |
" FILE: autoload/incsearch/over/modules/insert_register.vim | |
" AUTHOR: haya14busa | |
" License: MIT license | |
"============================================================================= | |
1 0.000003 scriptencoding utf-8 | |
1 0.000007 let s:save_cpo = &cpo | |
1 0.000008 set cpo&vim | |
1 0.000082 0.000009 let s:modules = vital#incsearch#import('Over.Commandline.Modules') | |
1 0.001125 0.000014 let s:InsertRegister = s:modules.get('InsertRegister').make() | |
1 0.000007 let s:InsertRegister_orig_on_char_pre = s:InsertRegister.on_char_pre | |
1 0.000004 let s:InsertRegister.search_register = '' | |
1 0.000003 function! s:InsertRegister.on_enter(...) abort | |
let self.search_register = @/ | |
endfunction | |
1 0.000002 function! s:InsertRegister.on_char_pre(cmdline) abort | |
if exists('self.prefix_key') && a:cmdline.get_tap_key() == self.prefix_key | |
call a:cmdline.setline(self.old_line) | |
call a:cmdline.setpos(self.old_pos) | |
let char = a:cmdline.input_key() | |
if char ==# '/' | |
let register = tr(self.search_register, "\n", "\r") | |
call a:cmdline.setchar(register) | |
return | |
endif | |
endif | |
return call(s:InsertRegister_orig_on_char_pre, [a:cmdline], self) | |
endfunction | |
1 0.000005 function! incsearch#over#modules#insert_register#make() abort | |
return deepcopy(s:InsertRegister) | |
endfunction | |
1 0.000009 let &cpo = s:save_cpo | |
1 0.000002 unlet s:save_cpo | |
" __END__ | |
" vim: expandtab softtabstop=2 shiftwidth=2 foldmethod=marker | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Modules/InsertRegister.vim | |
Sourced 2 times | |
Total time: 1490407872.219083 | |
Self time: 1490407872.218886 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000010 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000155 function! vital#_incsearch#Over#Commandline#Modules#InsertRegister#import() abort | |
return map({'_vital_depends': '', 'to_string': '', 'input': '', 'get_cmdline_cword': '', 'make': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Modules#InsertRegister#import() abort', printf("return map({'_vital_depends': '', 'to_string': '', 'input': '', 'get_cmdline_cword': '', 'make': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000013 let s:save_cpo = &cpo | |
2 0.000013 set cpo&vim | |
2 0.000013 function! s:_vital_loaded(V) | |
let s:V = a:V | |
let s:String = s:V.import("Over.String") | |
endfunction | |
2 0.000004 function! s:_vital_depends() | |
return [ | |
\ "Over.String", | |
\ ] | |
endfunction | |
2 0.000005 function! s:to_string(expr) | |
return type(a:expr) == type("") ? a:expr : string(a:expr) | |
endfunction | |
2 0.000004 function! s:input(cmdline) | |
let CR_index = index(a:cmdline.input_key_stack(), "\<CR>") | |
if CR_index != -1 | |
let input = a:cmdline.input_key_stack_string() | |
let input = input[ : CR_index-1] | |
call a:cmdline.set_input_key_stack(a:cmdline.input_key_stack()[CR_index+1 : ]) | |
return eval(input) | |
endif | |
let input_text = "" | |
if !empty(a:cmdline.input_key_stack()) | |
let input_text = a:cmdline.input_key_stack_string() | |
call a:cmdline.set_input_key_stack([]) | |
endif | |
call a:cmdline.hl_cursor_on() | |
try | |
redraw | |
let input = input("=", input_text, "expression") | |
if !empty(input) | |
let input = s:to_string(eval(input)) | |
endif | |
catch | |
return "" | |
finally | |
call a:cmdline.hl_cursor_off() | |
endtry | |
return input | |
endfunction | |
2 0.000014 let s:module = { | |
\ "name" : "InsertRegister" | |
\} | |
2 0.000004 function! s:module.reset() | |
let self.cword = expand("<cword>") | |
let self.cWORD = expand("<cWORD>") | |
let self.cfile = expand("<cfile>") | |
endfunction | |
2 0.000004 function! s:module.on_enter(...) | |
call self.reset() | |
" let self.prefix_key = "" | |
endfunction | |
2 0.000006 function! s:get_cmdline_cword(backward, cword) | |
" let backward = matchstr(a:backward, '.\{-}\zs\k\+$') | |
let backward = a:backward | |
if &incsearch == 0 || a:cword == "" || a:backward == "" || s:String.index(a:cword, backward) != 0 | |
return a:cword | |
endif | |
return a:cword[len(backward) : ] | |
endfunction | |
2 0.000004 function! s:module.on_char_pre(cmdline) | |
if a:cmdline.is_input("\<C-r>") | |
call a:cmdline.setchar('"') | |
let self.prefix_key = a:cmdline.input_key() | |
let self.old_line = a:cmdline.getline() | |
let self.old_pos = a:cmdline.getpos() | |
return | |
elseif exists("self.prefix_key") | |
\ && a:cmdline.get_tap_key() == self.prefix_key | |
call a:cmdline.setline(self.old_line) | |
call a:cmdline.setpos(self.old_pos) | |
let char = a:cmdline.input_key() | |
if char =~ '^[0-9a-zA-z.%#:/"\-*+]$' | |
let register = tr(getreg(char), "\n", "\r") | |
call a:cmdline.setchar(register) | |
elseif char == "=" | |
call a:cmdline.setchar(s:input(a:cmdline)) | |
elseif char == "\<C-w>" | |
call a:cmdline.setchar(s:get_cmdline_cword(a:cmdline.backward_word(), self.cword)) | |
elseif char == "\<C-a>" | |
call a:cmdline.setchar(self.cWORD) | |
elseif char == "\<C-f>" | |
call a:cmdline.setchar(self.cfile) | |
elseif char == "\<C-r>" | |
call a:cmdline.setchar('"') | |
else | |
call a:cmdline.setchar("") | |
endif | |
" elseif a:cmdline.is_input('=', self.prefix_key) | |
" call a:cmdline.setchar(s:input(a:cmdline)) | |
" elseif a:cmdline.is_input("\<C-w>", self.prefix_key) | |
" call a:cmdline.setchar(self.cword) | |
" elseif a:cmdline.is_input("\<C-a>", self.prefix_key) | |
" call a:cmdline.setchar(self.cWORD) | |
" elseif a:cmdline.is_input("\<C-f>", self.prefix_key) | |
" call a:cmdline.setchar(self.cfile) | |
" elseif a:cmdline.is_input("\<C-r>", self.prefix_key) | |
" call a:cmdline.setchar('"') | |
" else | |
" call a:cmdline.setchar("") | |
" endif | |
endif | |
endfunction | |
2 0.000005 function! s:module.on_char(cmdline) | |
if a:cmdline.is_input("\<C-r>") | |
call a:cmdline.tap_keyinput(self.prefix_key) | |
call a:cmdline.disable_keymapping() | |
call a:cmdline.setpos(a:cmdline.getpos()-1) | |
else | |
if exists("self.prefix_key") | |
call a:cmdline.untap_keyinput(self.prefix_key) | |
call a:cmdline.enable_keymapping() | |
unlet! self.prefix_key | |
endif | |
endif | |
endfunction | |
2 0.000004 function! s:make() | |
return deepcopy(s:module) | |
endfunction | |
2 0.000017 let &cpo = s:save_cpo | |
2 0.000006 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Modules/Paste.vim | |
Sourced 2 times | |
Total time: 1490407872.220177 | |
Self time: 1490407872.220084 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000150 function! vital#_incsearch#Over#Commandline#Modules#Paste#import() abort | |
return map({'make': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Modules#Paste#import() abort', printf("return map({'make': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000012 let s:save_cpo = &cpo | |
2 0.000013 set cpo&vim | |
2 0.000011 let s:module = { | |
\ "name" : "Paste" | |
\} | |
2 0.000006 function! s:module.on_char_pre(cmdline) | |
if a:cmdline.is_input("<Over>(paste)") | |
let register = v:register == "" ? '"' : v:register | |
call a:cmdline.insert(tr(getreg("*"), "\n", "\r")) | |
call a:cmdline.setchar('') | |
endif | |
endfunction | |
2 0.000004 function! s:make() | |
return deepcopy(s:module) | |
endfunction | |
2 0.000021 let &cpo = s:save_cpo | |
2 0.000006 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Modules/Doautocmd.vim | |
Sourced 2 times | |
Total time: 1490407872.221573 | |
Self time: 1490407872.221208 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000010 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000151 function! vital#_incsearch#Over#Commandline#Modules#Doautocmd#import() abort | |
return map({'_vital_depends': '', 'doautocmd_user': '', 'get_cmdline': '', 'make': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Modules#Doautocmd#import() abort', printf("return map({'_vital_depends': '', 'doautocmd_user': '', 'get_cmdline': '', 'make': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000011 scriptencoding utf-8 | |
2 0.000012 let s:save_cpo = &cpo | |
2 0.000015 set cpo&vim | |
2 0.000012 function! s:_vital_loaded(V) | |
let s:V = a:V | |
let s:E = s:V.import("Over.Exception") | |
endfunction | |
2 0.000005 function! s:_vital_depends() | |
return [ | |
\ "Over.Exception", | |
\ ] | |
endfunction | |
2 0.000006 let s:cache_command = {} | |
2 0.000007 function! s:doautocmd_user(prefix, command) | |
let group = a:prefix . "-vital-over-commandline-doautocmd-dummy" | |
if !has_key(s:cache_command, a:prefix) | |
let s:cache_command[a:prefix] = {} | |
endif | |
if !has_key(s:cache_command[a:prefix], a:command) | |
execute "autocmd " . group | |
\ . " User " . a:command." silent! execute ''" | |
if v:version > 703 || v:version == 703 && has("patch438") | |
let s:cache_command[a:prefix][a:command] = "doautocmd <nomodeline> User " . a:command | |
else | |
let s:cache_command[a:prefix][a:command] = "doautocmd User " . a:command | |
endif | |
endif | |
execute s:cache_command[a:prefix][a:command] | |
endfunction | |
2 0.000017 let s:hooks = [ | |
\ "enter", | |
\ "leave", | |
\ "char", | |
\ "char_pre", | |
\ "draw", | |
\ "draw_pre", | |
\ "execute_pre", | |
\ "execute_failed", | |
\ "execute", | |
\ "exception", | |
\] | |
2 0.000014 let s:hooks_camel = [ | |
\ "Enter", | |
\ "Leave", | |
\ "Char", | |
\ "CharPre", | |
\ "Draw", | |
\ "DrawPre", | |
\ "ExecutePre", | |
\ "ExecuteFailed", | |
\ "Execute", | |
\ "Exception", | |
\] | |
2 0.000012 let s:module = { | |
\ "name" : "Doautocmd", | |
\} | |
22 0.000036 for s:i in range(len(s:hooks)) | |
2 0.000043 execute join([ | |
\ "function! s:module.on_" . s:hooks[s:i] . "(cmdline, ...)", | |
\ " let s:cmdline = a:cmdline", | |
\ " call s:doautocmd_user(self.prefix, self.prefix . " . string(s:hooks_camel[s:i]) . ")", | |
\ "endfunction", | |
18 0.000283 \ ], "\n") | |
20 0.000022 endfor | |
2 0.000006 function! s:get_cmdline() | |
if !exists("s:cmdline") | |
execute s:E.throw_cmd("Undefined cmdline object.", "Over.Commandline.Modules.Doautocmd") | |
endif | |
return s:cmdline | |
endfunction | |
2 0.000005 function! s:make(prefix) | |
if has_key(s:cache_command, a:prefix) | |
unlet! s:cache_command[a:prefix] | |
endif | |
execute "augroup " a:prefix . "-vital-over-commandline-doautocmd-dummy" | |
autocmd! | |
augroup END | |
let module = deepcopy(s:module) | |
let module.prefix = a:prefix | |
return module | |
endfunction | |
2 0.000018 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Exception.vim | |
Sourced 2 times | |
Total time: 1490407872.222319 | |
Self time: 1490407872.222218 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000131 function! vital#_incsearch#Over#Exception#import() abort | |
return map({'throw': '', 'throw_cmd': '', 'set_prefix': '', 'error': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000002 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Exception#import() abort', printf("return map({'throw': '', 'throw_cmd': '', 'set_prefix': '', 'error': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000013 let s:save_cpo = &cpo | |
2 0.000012 set cpo&vim | |
2 0.000013 let s:vname = expand("<sfile>:h:h:t") | |
2 0.000010 let s:prefix = printf("vital-over(%s) Exception", s:vname) | |
2 0.000007 function! s:set_prefix(prefix) | |
let s:prefix = a:prefix | |
endfunction | |
2 0.000006 function! s:throw_cmd(exp, where) | |
return 'throw ' . string(s:prefix . " : " . a:exp . " in " . a:where) | |
endfunction | |
2 0.000005 function! s:throw(exp, where) | |
execute s:throw_cmd(a:exp, a:where) | |
endfunction | |
2 0.000004 function! s:error(text, where) | |
echohl ErrorMsg | |
echom s:prefix . " : " . a:text . " in " . a:where | |
echohl None | |
endfunction | |
2 0.000015 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Modules/ExceptionMessage.vim | |
Sourced 2 times | |
Total time: 1490407872.223592 | |
Self time: 1490407872.223470 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000012 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000160 function! vital#_incsearch#Over#Commandline#Modules#ExceptionMessage#import() abort | |
return map({'make': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Modules#ExceptionMessage#import() abort', printf("return map({'make': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000005 scriptencoding utf-8 | |
2 0.000012 let s:save_cpo = &cpo | |
2 0.000012 set cpo&vim | |
2 0.000013 let s:vname = expand("<sfile>:h:h:h:h:t") | |
2 0.000011 let s:module = { | |
\ "name" : "ExceptionMessage", | |
\} | |
2 0.000006 function! s:module.on_exception(cmdline) | |
let self.exception = v:exception | |
let self.throwpoint = v:throwpoint | |
endfunction | |
2 0.000005 function! s:module.on_draw_pre(cmdline) | |
if has_key(self, "exception") | |
call self.message(a:cmdline) | |
unlet self.exception | |
endif | |
endfunction | |
2 0.000004 function! s:module.message(...) | |
echohl ErrorMsg | |
execute self.command string(self.prefix . " : " . self.throwpoint . " " . self.exception) | |
echohl None | |
endfunction | |
2 0.000005 function! s:module.on_leave(cmdline) | |
if has_key(self, "exception") | |
call self.message(a:cmdline) | |
unlet self.exception | |
endif | |
endfunction | |
2 0.000004 function! s:make(...) | |
let result = deepcopy(s:module) | |
let result.prefix = get(a:, 1, "vital-over(".s:vname.") Exception") | |
let result.command = get(a:, 2, "echom") | |
return result | |
endfunction | |
2 0.000015 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Modules/History.vim | |
Sourced 2 times | |
Total time: 1490407872.224527 | |
Self time: 1490407872.224409 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000154 function! vital#_incsearch#Over#Commandline#Modules#History#import() abort | |
return map({'make': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Modules#History#import() abort', printf("return map({'make': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000011 let s:save_cpo = &cpo | |
2 0.000013 set cpo&vim | |
2 0.000015 let s:module = { | |
\ "name" : "History", | |
\ "mode" : "cmd", | |
\} | |
2 0.000005 function! s:module.histories() | |
return map(range(1, &history), 'histget(self.mode, v:val * -1)') | |
endfunction | |
2 0.000007 function! s:_should_match_cmdline(cmdline) | |
return a:cmdline.is_input("\<Up>") | |
\ || a:cmdline.is_input("\<Down>") | |
endfunction | |
2 0.000004 function! s:_reset() | |
let s:cmdhist = [] | |
let s:count = 0 | |
let s:is_match_mode = 0 " <Up>/<Down>: true, <C-n>/<C-p>: false | |
endfunction | |
2 0.000004 function! s:module.on_enter(...) | |
call s:_reset() | |
endfunction | |
2 0.000004 function! s:module.on_char_pre(cmdline) | |
if !a:cmdline.is_input("\<Up>") && !a:cmdline.is_input("\<Down>") | |
\ && !a:cmdline.is_input("\<C-p>") && !a:cmdline.is_input("\<C-n>") | |
call s:_reset() | |
return | |
else | |
if s:count == 0 && empty(s:cmdhist) | |
\ || s:is_match_mode != s:_should_match_cmdline(a:cmdline) | |
let cmdline = '^' . a:cmdline.getline() | |
let s:is_match_mode = s:_should_match_cmdline(a:cmdline) | |
let s:cmdhist = [a:cmdline.getline()] + (s:is_match_mode ? | |
\ filter(self.histories(), 'v:val =~ cmdline') : self.histories()) | |
endif | |
endif | |
call a:cmdline.setchar("") | |
if a:cmdline.is_input("\<Down>") || a:cmdline.is_input("\<C-n>") | |
let s:count = max([s:count - 1, 0]) | |
endif | |
if a:cmdline.is_input("\<Up>") || a:cmdline.is_input("\<C-p>") | |
let s:count = min([s:count + 1, len(s:cmdhist)]) | |
endif | |
call a:cmdline.setline(get(s:cmdhist, s:count, a:cmdline.getline())) | |
endfunction | |
2 0.000004 function! s:make(...) | |
let module = deepcopy(s:module) | |
let module.mode = get(a:, 1, "cmd") | |
return module | |
endfunction | |
2 0.000015 let &cpo = s:save_cpo | |
2 0.000005 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Modules/NoInsert.vim | |
Sourced 2 times | |
Total time: 1490407872.225429 | |
Self time: 1490407872.225330 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000010 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000151 function! vital#_incsearch#Over#Commandline#Modules#NoInsert#import() abort | |
return map({'make_special_chars': '', 'make': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Modules#NoInsert#import() abort', printf("return map({'make_special_chars': '', 'make': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000013 let s:save_cpo = &cpo | |
2 0.000013 set cpo&vim | |
2 0.000013 let s:module = { | |
\ "name" : "NoInsert", | |
\ "chars" : [] | |
\} | |
2 0.000006 function! s:module.is_no_insert(char) | |
return index(self.chars, a:char) >= 0 | |
endfunction | |
2 0.000005 function! s:module.on_char_pre(cmdline) | |
if self.is_no_insert(a:cmdline.char()) | |
call a:cmdline.setchar("", 0) | |
endif | |
endfunction | |
2 0.000005 function! s:make(chars) | |
let module = deepcopy(s:module) | |
let module.chars = type(a:chars) == type([]) ? a:chars : [a:chars] | |
return module | |
endfunction | |
2 0.000005 function! s:make_special_chars() | |
let module = s:make([]) | |
function! module.is_no_insert(char) | |
return char2nr(a:char) == 128 || char2nr(a:char) < 27 | |
endfunction | |
return module | |
endfunction | |
2 0.000014 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Modules/KeyMapping.vim | |
Sourced 2 times | |
Total time: 1490407872.226474 | |
Self time: 1490407872.226318 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000010 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000153 function! vital#_incsearch#Over#Commandline#Modules#KeyMapping#import() abort | |
return map({'_vital_depends': '', 'make_emacs': '', 'make_vim_cmdline_mapping': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000002 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Modules#KeyMapping#import() abort', printf("return map({'_vital_depends': '', 'make_emacs': '', 'make_vim_cmdline_mapping': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000005 scriptencoding utf-8 | |
2 0.000012 let s:save_cpo = &cpo | |
2 0.000011 set cpo&vim | |
2 0.000007 function! s:_vital_loaded(V) | |
let s:Keymapping = a:V.import("Palette.Keymapping") | |
endfunction | |
2 0.000005 function! s:_vital_depends() | |
return [ | |
\ "Palette.Keymapping", | |
\ ] | |
endfunction | |
2 0.000011 let s:emacs = { | |
\ "name" : "KeyMapping_emacs_like" | |
\} | |
2 0.000005 function! s:emacs.keymapping(cmdline) | |
return { | |
\ "\<C-f>" : { | |
\ "key" : "\<Right>", | |
\ "noremap" : 1, | |
\ "lock" : 1, | |
\ }, | |
\ "\<C-b>" : { | |
\ "key" : "\<Left>", | |
\ "noremap" : 1, | |
\ "lock" : 1, | |
\ }, | |
\ "\<C-n>" : { | |
\ "key" : "\<Down>", | |
\ "noremap" : 1, | |
\ "lock" : 1, | |
\ }, | |
\ "\<C-p>" : { | |
\ "key" : "\<Up>", | |
\ "noremap" : 1, | |
\ "lock" : 1, | |
\ }, | |
\ "\<C-a>" : { | |
\ "key" : "\<Home>", | |
\ "noremap" : 1, | |
\ "lock" : 1, | |
\ }, | |
\ "\<C-e>" : { | |
\ "key" : "\<End>", | |
\ "noremap" : 1, | |
\ "lock" : 1, | |
\ }, | |
\ "\<C-d>" : { | |
\ "key" : "\<Del>", | |
\ "noremap" : 1, | |
\ "lock" : 1, | |
\ }, | |
\ "\<A-d>" : { | |
\ "key" : "\<C-w>", | |
\ "noremap" : 1, | |
\ "lock" : 1, | |
\ }, | |
\ "\<A-b>" : { | |
\ "key" : "\<S-Left>", | |
\ "noremap" : 1, | |
\ "lock" : 1, | |
\ }, | |
\ "\<A-f>" : { | |
\ "key" : "\<S-Right>", | |
\ "noremap" : 1, | |
\ "lock" : 1, | |
\ }, | |
\ } | |
endfunction | |
2 0.000005 function! s:make_emacs() | |
return deepcopy(s:emacs) | |
endfunction | |
2 0.000022 let s:vim_cmdline_mapping = { | |
\ "name" : "KeyMapping_vim_cmdline_mapping", | |
\ "_cmaps" : {} | |
\} | |
2 0.000009 function! s:_convert_sid(rhs, sid) abort | |
return substitute(a:rhs, '<SID>', '<SNR>' . a:sid . '_', 'g') | |
endfunction | |
2 0.000005 function! s:_auto_cmap() | |
let cmaps = {} | |
let cmap_info = s:Keymapping.rhs_key_list("c", 0, 1) | |
" vital-over currently doesn't support <buffer> mappings | |
for c in filter(cmap_info, "v:val['buffer'] ==# 0") | |
let cmaps[s:Keymapping.escape_special_key(c['lhs'])] = { | |
\ 'noremap' : c['noremap'], | |
\ 'key' : s:Keymapping.escape_special_key(s:_convert_sid(c['rhs'], c['sid'])), | |
\ 'expr' : s:Keymapping.escape_special_key(c['expr']), | |
\ } | |
endfor | |
return cmaps | |
endfunction | |
2 0.000006 function! s:vim_cmdline_mapping.on_enter(cmdline) | |
let self._cmaps = s:_auto_cmap() | |
endfunction | |
2 0.000004 function! s:vim_cmdline_mapping.keymapping(cmdline) | |
return self._cmaps | |
endfunction | |
2 0.000005 function! s:make_vim_cmdline_mapping() | |
return deepcopy(s:vim_cmdline_mapping) | |
endfunction | |
2 0.000016 let &cpo = s:save_cpo | |
2 0.000008 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Palette/Keymapping.vim | |
Sourced 2 times | |
Total time: 1490407872.227339 | |
Self time: 1490407872.227166 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000010 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000139 function! vital#_incsearch#Palette#Keymapping#import() abort | |
return map({'capture': '', '_vital_depends': '', 'escape_special_key': '', 'rhs_key_list': '', 'parse_lhs_list': '', 'lhs_key_list': '', 'capture_list': '', 'parse_lhs': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000002 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Palette#Keymapping#import() abort', printf("return map({'capture': '', '_vital_depends': '', 'escape_special_key': '', 'rhs_key_list': '', 'parse_lhs_list': '', 'lhs_key_list': '', 'capture_list': '', 'parse_lhs': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000005 scriptencoding utf-8 | |
2 0.000013 let s:save_cpo = &cpo | |
2 0.000013 set cpo&vim | |
2 0.000006 let s:modep = "[nvoicsxl]" | |
2 0.000006 function! s:_vital_loaded(V) | |
let s:V = a:V | |
let s:Capture = s:V.import("Palette.Capture") | |
endfunction | |
2 0.000005 function! s:_vital_depends() | |
return [ | |
\ "Palette.Capture", | |
\ ] | |
endfunction | |
2 0.000005 function! s:_capture(mode) | |
let cmd = "map" | |
if a:mode ==# "!" | |
let cmd = cmd . "!" | |
elseif a:mode =~# "[nvoicsxl]" | |
let cmd = a:mode . cmd | |
endif | |
return s:Capture.command(cmd) | |
endfunction | |
2 0.000004 function! s:capture(...) | |
let mode = get(a:, 1, "") | |
let modes = split(mode, '\zs') | |
return join(map(modes, "s:_capture(v:val)"), "\n") | |
endfunction | |
2 0.000005 function! s:_keymapping(str) | |
return a:str =~ '^[!nvoicsxl]\s' | |
endfunction | |
2 0.000005 function! s:capture_list(...) | |
let mode = get(a:, 1, "") | |
return filter(split(s:capture(mode), "\n"), "s:_keymapping(v:val)") | |
endfunction | |
2 0.000005 function! s:escape_special_key(key) | |
" Workaround : <C-?> https://github.com/osyo-manga/vital-palette/issues/5 | |
if a:key ==# "<^?>" | |
return "\<C-?>" | |
endif | |
execute 'let result = "' . substitute(escape(a:key, '\"'), '\(<.\{-}>\)', '\\\1', 'g') . '"' | |
return result | |
endfunction | |
2 0.000005 function! s:parse_lhs(text, ...) | |
let mode = get(a:, 1, '[!nvoicsxl]') | |
" NOTE: :map! Surpport : https://github.com/osyo-manga/vital-palette/issues/4 | |
if get(a:, 1, "") =~# '[!ci]' | |
let mode = '[!ci]' | |
endif | |
return matchstr(a:text, mode . '\{1,3\}\s*\zs\S\{-}\ze\s\+') | |
endfunction | |
2 0.000005 function! s:parse_lhs_list(...) | |
let mode = get(a:, 1, "") | |
return map(s:capture_list(mode), "s:parse_lhs(v:val, mode)") | |
endfunction | |
2 0.000004 function! s:lhs_key_list(...) | |
let mode = get(a:, 1, "") | |
return map(s:parse_lhs_list(mode), "s:escape_special_key(v:val)") | |
endfunction | |
2 0.000007 function! s:_maparg(name, mode, abbr, dict) | |
" Workaround : <C-?> https://github.com/osyo-manga/vital-palette/issues/5 | |
if a:name ==# "<^?>" | |
return maparg("\<C-?>", a:mode, a:abbr, a:dict) | |
endif | |
return maparg(a:name, a:mode, a:abbr, a:dict) | |
endfunction | |
2 0.000005 function! s:rhs_key_list(...) | |
let mode = get(a:, 1, "") | |
let abbr = get(a:, 2, 0) | |
let dict = get(a:, 3, 0) | |
let result = [] | |
for m in split(mode, '\zs') | |
let result += map(s:parse_lhs_list(m), "s:_maparg(v:val, m, abbr, dict)") | |
endfor | |
return filter(result, "empty(v:val) == 0") | |
endfunction | |
2 0.000015 let &cpo = s:save_cpo | |
2 0.000006 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Palette/Capture.vim | |
Sourced 2 times | |
Total time: 1490407872.228111 | |
Self time: 1490407872.227995 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000129 function! vital#_incsearch#Palette#Capture#import() abort | |
return map({'extend': '', 'command': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Palette#Capture#import() abort', printf("return map({'extend': '', 'command': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000011 let s:save_cpo = &cpo | |
2 0.000013 set cpo&vim | |
2 0.000005 let s:verbosefiles = [] | |
2 0.000007 function! s:_verbosefile_push(file) | |
call add(s:verbosefiles, &verbosefile) | |
let &verbosefile = a:file | |
return a:file | |
endfunction | |
2 0.000005 function! s:_verbosefile_pop() | |
let filename = &verbosefile | |
let &verbosefile = get(s:verbosefiles, -1) | |
call remove(s:verbosefiles, -1) | |
return filename | |
endfunction | |
2 0.000004 function! s:_reset() | |
let s:verbosefiles = [] | |
endfunction | |
2 0.000004 function! s:extend(dict, src) | |
for [key, value] in items(a:src) | |
let a:dict[key] = value | |
unlet value | |
endfor | |
endfunction | |
2 0.000005 function! s:command(cmd, ...) | |
" Workaround : Vim 7.3.xxx in Travis and Ubuntu | |
" https://github.com/osyo-manga/vital-palette/issues/5 | |
" call extend(l:, get(a:, 1, {})) | |
if a:0 > 0 | |
call s:extend(l:, a:1) | |
endif | |
call s:_verbosefile_push(tempname()) | |
try | |
redir =>result | |
silent execute a:cmd | |
finally | |
redir END | |
endtry | |
call s:_verbosefile_pop() | |
" let result = substitute(result, "<SRN>", "\<SNR>", "g") | |
" let result = substitute(result, "<SID>", "\<SID>", "g") | |
return result | |
endfunction | |
2 0.000016 let &cpo = s:save_cpo | |
2 0.000006 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Over/Commandline/Modules/IgnoreRegexpBackwardWord.vim | |
Sourced 2 times | |
Total time: 1490407872.229056 | |
Self time: 1490407872.228954 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000010 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000168 function! vital#_incsearch#Over#Commandline#Modules#IgnoreRegexpBackwardWord#import() abort | |
return map({'backward_word': '', 'make': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Over#Commandline#Modules#IgnoreRegexpBackwardWord#import() abort', printf("return map({'backward_word': '', 'make': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000014 let s:save_cpo = &cpo | |
2 0.000011 set cpo&vim | |
" Improved backward word detection which ignore regular expression | |
2 0.000011 let s:module = { | |
\ "name" : "IgnoreRegexpBackwardWord" | |
\} | |
2 0.000007 function! s:backward_word(str, ...) | |
let pat = get(a:, 1, '\k\+\s*\|.') | |
let flags = s:non_escaped_backslash . | |
\ '\%(' . 'z[se]' . | |
\ '\|' . '[iIkKfFpPsSdDxXoOwWhHaAlLuUetrbncCZmMvV]' . | |
\ '\|' . '%[dxouUCVlcv]' . | |
\ '\|' . "%'[a-zA-Z]" . | |
\ '\|' . '%#=\d' . | |
\ '\|' . 'z\=\d' . | |
\ '\)' | |
return matchstr(get(split(a:str, flags . '\s*\zs'), -1, ""), | |
\ '\%(' . flags . '\s*\|' . pat . '\)$') | |
endfunction | |
2 0.000008 let s:non_escaped_backslash = '\m\%(\%(^\|[^\\]\)\%(\\\\\)*\)\@<=\\' | |
2 0.000004 function! s:module.on_enter(cmdline) | |
function! a:cmdline.backward_word(...) | |
return call("s:backward_word", [self.backward()] + a:000) | |
endfunction | |
endfunction | |
2 0.000004 function! s:make() | |
return deepcopy(s:module) | |
endfunction | |
2 0.000013 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/incsearch/over/modules/module_management.vim | |
Sourced 1 time | |
Total time: 0.000087 | |
Self time: 0.000087 | |
count total (s) self (s) | |
"============================================================================= | |
" FILE: autoload/incsearch/over/modules/module_management.vim | |
" AUTHOR: haya14busa | |
" License: MIT license | |
"============================================================================= | |
1 0.000003 scriptencoding utf-8 | |
1 0.000007 let s:save_cpo = &cpo | |
1 0.000007 set cpo&vim | |
1 0.000007 let s:module_management = { | |
\ 'name' : 'IncsearchModuleManagement', | |
\ 'modules' : [ ] | |
\} | |
1 0.000003 function! s:module_management.on_enter(cmdline) abort | |
if !exists('s:default_backward_word') | |
let s:default_backward_word = a:cmdline.backward_word | |
endif | |
for module in self.modules | |
if has_key(module, '_condition') && ! module._condition() | |
call a:cmdline.disconnect(module.name) | |
if module.name ==# 'IgnoreRegexpBackwardWord' | |
function! a:cmdline.backward_word(...) abort | |
return call(s:default_backward_word, a:000, self) | |
endfunction | |
endif | |
elseif empty(a:cmdline.get_module(module.name)) | |
call a:cmdline.connect(module) | |
if has_key(module, 'on_enter') | |
call module.on_enter(a:cmdline) | |
endif | |
endif | |
endfor | |
endfunction | |
1 0.000003 function! s:module_management.priority(event) abort | |
" NOTE: to overwrite backward_word() with default function | |
return a:event ==# 'on_enter' ? 5 : 0 | |
endfunction | |
1 0.000006 function! incsearch#over#modules#module_management#make(modules) abort | |
let m = deepcopy(s:module_management) | |
let m.modules = a:modules | |
return m | |
endfunction | |
1 0.000008 let &cpo = s:save_cpo | |
1 0.000002 unlet s:save_cpo | |
" __END__ | |
" vim: expandtab softtabstop=2 shiftwidth=2 foldmethod=marker | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/incsearch/over/modules/pattern_saver.vim | |
Sourced 1 time | |
Total time: 0.000075 | |
Self time: 0.000075 | |
count total (s) self (s) | |
"============================================================================= | |
" FILE: autoload/incsearch/over/modules/pattern_saver.vim | |
" AUTHOR: haya14busa | |
" License: MIT license | |
" @vimlint(EVL103, 1, a:cmdline) | |
"============================================================================= | |
1 0.000004 scriptencoding utf-8 | |
1 0.000007 let s:save_cpo = &cpo | |
1 0.000006 set cpo&vim | |
1 0.000007 let s:pattern_saver = { | |
\ 'name' : 'PatternSaver', | |
\ 'pattern' : '', | |
\ 'hlsearch' : &hlsearch | |
\} | |
1 0.000003 function! s:pattern_saver.on_enter(cmdline) abort | |
if ! g:incsearch#no_inc_hlsearch | |
let self.pattern = @/ | |
let self.hlsearch = &hlsearch | |
if exists('v:hlsearch') | |
let self.vhlsearch = v:hlsearch | |
endif | |
set hlsearch | nohlsearch | |
endif | |
endfunction | |
1 0.000002 function! s:pattern_saver.on_leave(cmdline) abort | |
if ! g:incsearch#no_inc_hlsearch | |
let is_cancel = a:cmdline.exit_code() | |
if is_cancel | |
let @/ = self.pattern | |
endif | |
let &hlsearch = self.hlsearch | |
if exists('v:hlsearch') | |
let v:hlsearch = self.vhlsearch | |
endif | |
endif | |
endfunction | |
1 0.000005 function! incsearch#over#modules#pattern_saver#make() abort | |
return deepcopy(s:pattern_saver) | |
endfunction | |
1 0.000008 let &cpo = s:save_cpo | |
1 0.000002 unlet s:save_cpo | |
" __END__ | |
" vim: expandtab softtabstop=2 shiftwidth=2 foldmethod=marker | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/incsearch/over/modules/bulk_input_char.vim | |
Sourced 1 time | |
Total time: 0.000063 | |
Self time: 0.000063 | |
count total (s) self (s) | |
"============================================================================= | |
" FILE: autoload/incsearch/over/modules/bulk_input_char.vim | |
" AUTHOR: haya14busa | |
" License: MIT license | |
"============================================================================= | |
1 0.000003 scriptencoding utf-8 | |
1 0.000007 let s:save_cpo = &cpo | |
1 0.000007 set cpo&vim | |
" IncsearchBulkInputChar bulk insert characters and avoid updating for each | |
" character input. It's useful while execution macro or pasting text clipboard. | |
" CAUTION: cannot test getchar(0) with themis.vim | |
1 0.000005 let s:bulk_input_char = { | |
\ 'name': 'IncsearchBulkInputChar' | |
\ } | |
1 0.000003 function! s:bulk_input_char.on_char_pre(cmdline) abort | |
let stack = [] | |
let c = 1 | |
while c | |
let c = getchar(0) | |
if c != 0 | |
let stack += [nr2char(c)] | |
elseif !empty(stack) | |
call a:cmdline.set_input_key_stack(stack) | |
endif | |
endwhile | |
endfunction | |
1 0.000005 function! incsearch#over#modules#bulk_input_char#make() abort | |
return deepcopy(s:bulk_input_char) | |
endfunction | |
1 0.000007 let &cpo = s:save_cpo | |
1 0.000002 unlet s:save_cpo | |
" __END__ | |
" vim: expandtab softtabstop=2 shiftwidth=2 foldmethod=marker | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/incsearch/over/modules/incsearch.vim | |
Sourced 1 time | |
Total time: 0.012290 | |
Self time: 0.000384 | |
count total (s) self (s) | |
"============================================================================= | |
" FILE: autoload/incsearch/over/modules/incsearch.vim | |
" AUTHOR: haya14busa | |
" License: MIT license | |
"============================================================================= | |
1 0.000003 scriptencoding utf-8 | |
1 0.000007 let s:save_cpo = &cpo | |
1 0.000007 set cpo&vim | |
1 0.000003 let s:TRUE = !0 | |
1 0.000002 let s:FALSE = 0 | |
1 0.000005 let s:DIRECTION = { 'forward': 1, 'backward': 0 } " see :h v:searchforward | |
1 0.000105 let s:hi = g:incsearch#highlight#_hi | |
1 0.000136 0.000008 let s:U = incsearch#util#import() | |
1 0.000004 let s:inc = { | |
\ 'name' : 'incsearch', | |
\} | |
" NOTE: for InsertRegister handling | |
1 0.000002 function! s:inc.priority(event) abort | |
return a:event is# 'on_char' ? 10 : 0 | |
endfunction | |
1 0.000002 function! s:inc.on_enter(cmdline) abort | |
nohlsearch " disable previous highlight | |
let a:cmdline._w = winsaveview() | |
let hgm = incsearch#highlight#hgm() | |
let c = hgm.cursor | |
call s:hi.add(c.group, c.group, '\%#', c.priority) | |
call incsearch#highlight#update() | |
" XXX: Manipulate search history for magic option | |
" In the first place, I want to omit magic flag when histadd(), but | |
" when returning cmd as expr mapping and feedkeys() cannot handle it, so | |
" remove no user intended magic flag at on_enter. | |
" Maybe I can also handle it with autocmd, should I use autocmd instead? | |
let hist = histget('/', -1) | |
if len(hist) > 2 && hist[:1] ==# incsearch#magic() | |
call histdel('/', -1) | |
call histadd('/', hist[2:]) | |
endif | |
endfunction | |
1 0.000002 function! s:inc.on_leave(cmdline) abort | |
call s:hi.disable_all() | |
call s:hi.delete_all() | |
" redraw: hide pseud-cursor | |
redraw " need to redraw for handling non-<expr> mappings | |
if a:cmdline.getline() ==# '' | |
echo '' | |
else | |
echo a:cmdline.get_prompt() . a:cmdline.getline() | |
endif | |
" NOTE: | |
" push rest of keymappings with feedkeys() | |
" FIXME: assume 'noremap' but it should take care wheter or not the | |
" mappings should be remapped or not | |
if a:cmdline.input_key_stack_string() !=# '' | |
call feedkeys(a:cmdline.input_key_stack_string(), 'n') | |
endif | |
endfunction | |
" Avoid search-related error while incremental searching | |
1 0.000003 function! s:on_searching(func, ...) abort | |
try | |
return call(a:func, a:000) | |
catch /E16:/ " E16: Invalid range (with /\_[a- ) | |
catch /E33:/ " E33: No previous substitute regular expression | |
catch /E53:/ " E53: Unmatched %( | |
catch /E54:/ | |
catch /E55:/ | |
catch /E62:/ " E62: Nested \= (with /a\=\=) | |
catch /E63:/ " E63: invalid use of \_ | |
catch /E64:/ " E64: \@ follows nothing | |
catch /E65:/ " E65: Illegal back reference | |
catch /E66:/ " E66: \z( not allowed here | |
catch /E67:/ " E67: \z1 et al. not allowed here | |
catch /E68:/ " E68: Invalid character after \z (with /\za & re=1) | |
catch /E69:/ " E69: Missing ] after \%[ | |
catch /E70:/ " E70: Empty \%[] | |
catch /E71:/ " E71: Invalid character after \% | |
catch /E554:/ | |
catch /E678:/ " E678: Invalid character after \%[dxouU] | |
catch /E864:/ " E864: \%#= can only be followed by 0, 1, or 2. The | |
" automatic engine will be used | |
catch /E865:/ " E865: (NFA) Regexp end encountered prematurely | |
catch /E866:/ " E866: (NFA regexp) Misplaced @ | |
catch /E867:/ " E867: (NFA) Unknown operator | |
catch /E869:/ " E869: (NFA) Unknown operator '\@m | |
catch /E870:/ " E870: (NFA regexp) Error reading repetition limits | |
catch /E871:/ " E871: (NFA regexp) Can't have a multi follow a multi ! | |
catch /E874:/ " E874: (NFA) Could not pop the stack ! (with \&) | |
catch /E877:/ " E877: (NFA regexp) Invalid character class: 109 | |
catch /E888:/ " E888: (NFA regexp) cannot repeat (with /\ze*) | |
call s:hi.disable_all() | |
catch | |
echohl ErrorMsg | echom v:throwpoint . ' ' . v:exception | echohl None | |
endtry | |
endfunction | |
1 0.000003 function! s:on_char_pre(cmdline) abort | |
" NOTE: | |
" `:call a:cmdline.setchar('')` as soon as possible! | |
let [raw_pattern, offset] = a:cmdline._parse_pattern() | |
let pattern = a:cmdline._convert(raw_pattern) | |
" Interactive :h last-pattern if pattern is empty | |
if ( a:cmdline.is_input('<Over>(incsearch-next)') | |
\ || a:cmdline.is_input('<Over>(incsearch-prev)') | |
\ ) && empty(pattern) | |
call a:cmdline.setchar('') | |
" Use history instead of @/ to work with magic option and converter | |
call a:cmdline.setline(histget('/', -1) . (empty(offset) ? '' : a:cmdline._base_key) . offset) | |
" Just insert last-pattern and do not count up, but the incsearch-prev | |
" should move the cursor to reversed directly, so do not return if the | |
" command is prev | |
if a:cmdline.is_input('<Over>(incsearch-next)') | return | endif | |
endif | |
if a:cmdline.is_input('<Over>(incsearch-next)') | |
call a:cmdline.setchar('') | |
if a:cmdline._flag ==# 'n' " exit stay mode | |
let a:cmdline._flag = '' | |
else | |
let a:cmdline._vcount1 += 1 | |
endif | |
elseif a:cmdline.is_input('<Over>(incsearch-prev)') | |
call a:cmdline.setchar('') | |
if a:cmdline._flag ==# 'n' " exit stay mode | |
let a:cmdline._flag = '' | |
endif | |
let a:cmdline._vcount1 -= 1 | |
elseif (a:cmdline.is_input('<Over>(incsearch-scroll-f)') | |
\ && (a:cmdline._flag ==# '' || a:cmdline._flag ==# 'n')) | |
\ || (a:cmdline.is_input('<Over>(incsearch-scroll-b)') && a:cmdline._flag ==# 'b') | |
call a:cmdline.setchar('') | |
if a:cmdline._flag ==# 'n' | let a:cmdline._flag = '' | endif | |
let pos_expr = a:cmdline.is_input('<Over>(incsearch-scroll-f)') ? 'w$' : 'w0' | |
let to_col = a:cmdline.is_input('<Over>(incsearch-scroll-f)') | |
\ ? s:U.get_max_col(pos_expr) : 1 | |
let [from, to] = [getpos('.')[1:2], [line(pos_expr), to_col]] | |
let cnt = s:U.count_pattern(pattern, from, to) | |
let a:cmdline._vcount1 += cnt | |
elseif (a:cmdline.is_input('<Over>(incsearch-scroll-b)') | |
\ && (a:cmdline._flag ==# '' || a:cmdline._flag ==# 'n')) | |
\ || (a:cmdline.is_input('<Over>(incsearch-scroll-f)') && a:cmdline._flag ==# 'b') | |
call a:cmdline.setchar('') | |
if a:cmdline._flag ==# 'n' | |
let a:cmdline._flag = '' | |
let a:cmdline._vcount1 -= 1 | |
endif | |
let pos_expr = a:cmdline.is_input('<Over>(incsearch-scroll-f)') ? 'w$' : 'w0' | |
let to_col = a:cmdline.is_input('<Over>(incsearch-scroll-f)') | |
\ ? s:U.get_max_col(pos_expr) : 1 | |
let [from, to] = [getpos('.')[1:2], [line(pos_expr), to_col]] | |
let cnt = s:U.count_pattern(pattern, from, to) | |
let a:cmdline._vcount1 -= cnt | |
endif | |
" Handle nowrapscan: | |
" if you `:set nowrapscan`, you can't move to the reversed direction | |
if !&wrapscan && ( | |
\ a:cmdline.is_input('<Over>(incsearch-next)') | |
\ || a:cmdline.is_input('<Over>(incsearch-prev)') | |
\ || a:cmdline.is_input('<Over>(incsearch-scroll-f)') | |
\ || a:cmdline.is_input('<Over>(incsearch-scroll-b)') | |
\ ) | |
if a:cmdline._vcount1 < 1 | |
let a:cmdline._vcount1 = 1 | |
else | |
call a:cmdline.setchar('') | |
let [from, to] = [[a:cmdline._w.lnum, a:cmdline._w.col + 1], | |
\ a:cmdline._flag !=# 'b' | |
\ ? [line('$'), s:U.get_max_col('$')] | |
\ : [1, 1] | |
\ ] | |
let max_cnt = s:U.count_pattern(pattern, from, to, s:TRUE) | |
let a:cmdline._vcount1 = min([max_cnt, a:cmdline._vcount1]) | |
endif | |
endif | |
if &wrapscan && a:cmdline._vcount1 < 1 | |
let a:cmdline._vcount1 += s:U.count_pattern(pattern) | |
endif | |
endfunction | |
1 0.000004 function! s:on_char(cmdline) abort | |
if a:cmdline._does_exit_from_incsearch | |
return | |
endif | |
let [raw_pattern, offset] = a:cmdline._parse_pattern() | |
if raw_pattern ==# '' | |
call s:hi.disable_all() | |
nohlsearch | |
return | |
endif | |
" For InsertRegister | |
if a:cmdline.get_tap_key() ==# "\<C-r>" | |
let p = a:cmdline.getpos() | |
" Remove `"` | |
let raw_pattern = raw_pattern[:p-1] . raw_pattern[p+1:] | |
let w = winsaveview() | |
call cursor(line('.'), col('.') + len(a:cmdline.backward_word())) | |
call a:cmdline.get_module('InsertRegister').reset() | |
call winrestview(w) | |
endif | |
let pattern = a:cmdline._convert(raw_pattern) | |
" Improved Incremental cursor move! | |
call s:move_cursor(a:cmdline, pattern, offset) | |
" Improved Incremental highlighing! | |
" case: because matchadd() doesn't handle 'ignorecase' nor 'smartcase' | |
let case = incsearch#detect_case(raw_pattern) | |
let should_separate = g:incsearch#separate_highlight && a:cmdline._flag !=# 'n' | |
let pattern_for_hi = | |
\ (a:cmdline._flag is# 'b' ? s:unescape_question_for_backward(pattern) : pattern) | |
\ . case | |
call incsearch#highlight#incremental_highlight( | |
\ pattern_for_hi, | |
\ should_separate, | |
\ a:cmdline._direction, | |
\ [a:cmdline._w.lnum, a:cmdline._w.col]) | |
" functional `normal! zz` after scroll for <expr> mappings | |
if ( a:cmdline.is_input('<Over>(incsearch-scroll-f)') | |
\ || a:cmdline.is_input('<Over>(incsearch-scroll-b)')) | |
call winrestview({'topline': max([1, line('.') - winheight(0) / 2])}) | |
endif | |
endfunction | |
" Caveat: It handle :h last-pattern, so be careful if you want to pass empty | |
" string as a pattern | |
1 0.000003 function! s:move_cursor(cli, pattern, ...) abort | |
let offset = get(a:, 1, '') | |
if a:cli._flag ==# 'n' " skip if stay mode | |
return | |
endif | |
call winrestview(a:cli._w) | |
" pseud-move cursor position: this is restored afterward if called by | |
" <expr> mappings | |
if a:cli._is_expr | |
for _ in range(a:cli._vcount1) | |
" NOTE: This cannot handle {offset} for cursor position | |
call search(a:pattern, a:cli._flag) | |
endfor | |
else | |
" More precise cursor position while searching | |
" Caveat: | |
" This block contains `normal`, please make sure <expr> mappings | |
" doesn't reach this block | |
let is_visual_mode = s:U.is_visual(mode(1)) | |
let cmd = incsearch#with_ignore_foldopen( | |
\ s:U.dictfunction(a:cli._build_search_cmd, a:cli), | |
\ a:cli._combine_pattern(a:pattern, offset), 'n') | |
" NOTE: | |
" :silent! | |
" Shut up errors! because this is just for the cursor emulation | |
" while searching | |
silent! call incsearch#execute_search(cmd) | |
if is_visual_mode | |
let w = winsaveview() | |
normal! gv | |
call winrestview(w) | |
call incsearch#highlight#emulate_visual_highlight() | |
endif | |
endif | |
endfunction | |
1 0.000002 function! s:inc.on_char_pre(cmdline) abort | |
call s:on_searching(function('s:on_char_pre'), a:cmdline) | |
endfunction | |
1 0.000002 function! s:inc.on_char(cmdline) abort | |
call s:on_searching(function('s:on_char'), a:cmdline) | |
endfunction | |
1 0.000003 function! s:unescape_question_for_backward(pattern) abort | |
return substitute(a:pattern, '\\?', '?', 'g') | |
endfunction | |
1 0.000004 function! incsearch#over#modules#incsearch#make() abort | |
return deepcopy(s:inc) | |
endfunction | |
1 0.000009 let &cpo = s:save_cpo | |
1 0.000002 unlet s:save_cpo | |
" __END__ | |
" vim: expandtab softtabstop=2 shiftwidth=2 foldmethod=marker | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/incsearch/highlight.vim | |
Sourced 1 time | |
Total time: 0.011758 | |
Self time: 0.000478 | |
count total (s) self (s) | |
"============================================================================= | |
" FILE: autoload/incsearch/highlight.vim | |
" AUTHOR: haya14busa | |
" License: MIT license {{{ | |
" Permission is hereby granted, free of charge, to any person obtaining | |
" a copy of this software and associated documentation files (the | |
" "Software"), to deal in the Software without restriction, including | |
" without limitation the rights to use, copy, modify, merge, publish, | |
" distribute, sublicense, and/or sell copies of the Software, and to | |
" permit persons to whom the Software is furnished to do so, subject to | |
" the following conditions: | |
" | |
" The above copyright notice and this permission notice shall be included | |
" in all copies or substantial portions of the Software. | |
" | |
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
" }}} | |
"============================================================================= | |
1 0.000003 scriptencoding utf-8 | |
" Saving 'cpoptions' {{{ | |
1 0.000006 let s:save_cpo = &cpo | |
1 0.000006 set cpo&vim | |
" }}} | |
1 0.000003 let s:TRUE = !0 | |
1 0.000002 let s:FALSE = 0 | |
1 0.000004 let s:DIRECTION = { 'forward': 1, 'backward': 0 } " see :h v:searchforward | |
" Utility Helper: | |
1 0.000130 0.000008 let s:U = incsearch#util#import() | |
" Management: | |
1 0.000023 0.000005 let s:V = vital#incsearch#of() | |
1 0.011118 0.000018 let s:hi = s:V.import('Coaster.Highlight').make() | |
1 0.000004 let g:incsearch#highlight#_hi = s:hi | |
1 0.000004 function! incsearch#highlight#update() abort | |
" it's intuiive to call incsearch#highlight#on() & off() but there are no | |
" need to execute `:nohlsearch` when updating. | |
call s:hi.disable_all() | |
call s:hi.enable_all() | |
endfunction | |
1 0.000003 function! incsearch#highlight#on() abort | |
call s:hi.enable_all() | |
if ! g:incsearch#no_inc_hlsearch | |
let &hlsearch = &hlsearch | |
endif | |
endfunction | |
1 0.000003 function! incsearch#highlight#off() abort | |
call s:hi.disable_all() | |
if ! g:incsearch#no_inc_hlsearch | |
nohlsearch | |
endif | |
endfunction | |
1 0.000003 function! s:init_hl() abort | |
hi default link IncSearchMatch Search | |
hi default link IncSearchMatchReverse IncSearch | |
hi default link IncSearchCursor Cursor | |
hi default link IncSearchOnCursor IncSearch | |
hi default IncSearchUnderline term=underline cterm=underline gui=underline | |
endfunction | |
1 0.000058 0.000018 call s:init_hl() | |
1 0.000003 augroup plugin-incsearch-highlight | |
1 0.000063 autocmd! | |
1 0.000010 autocmd ColorScheme * call s:init_hl() | |
1 0.000002 augroup END | |
1 0.000021 let s:default_highlight = { | |
\ 'visual' : { | |
\ 'group' : '_IncSearchVisual', | |
\ 'priority' : '10' | |
\ }, | |
\ 'match' : { | |
\ 'group' : 'IncSearchMatch', | |
\ 'priority' : '49' | |
\ }, | |
\ 'match_reverse' : { | |
\ 'group' : 'IncSearchMatchReverse', | |
\ 'priority' : '49' | |
\ }, | |
\ 'on_cursor' : { | |
\ 'group' : 'IncSearchOnCursor', | |
\ 'priority' : '50' | |
\ }, | |
\ 'cursor' : { | |
\ 'group' : 'IncSearchCursor', | |
\ 'priority' : '51' | |
\ }, | |
\ } | |
1 0.000005 function! incsearch#highlight#hgm() abort " highlight group management | |
let hgm = copy(s:default_highlight) | |
for key in keys(hgm) | |
call extend(hgm[key], get(g:incsearch#highlight, key, {})) | |
endfor | |
return hgm | |
endfunction | |
" hldict: { 'name' : lhs, 'highlight': rhs } | |
" Util: | |
" @return hldict | |
1 0.000004 function! incsearch#highlight#capture(hlname) abort | |
" Based On: https://github.com/t9md/vim-ezbar | |
" https://github.com/osyo-manga/vital-over | |
let hlname = a:hlname | |
if !hlexists(hlname) | |
return | |
endif | |
while 1 | |
let save_verbose = &verbose | |
let &verbose = 0 | |
try | |
redir => HL_SAVE | |
execute 'silent! highlight ' . hlname | |
redir END | |
finally | |
let &verbose = save_verbose | |
endtry | |
if !empty(matchstr(HL_SAVE, 'xxx cleared$')) | |
return '' | |
endif | |
" follow highlight link | |
let ml = matchlist(HL_SAVE, 'links to \zs.*') | |
if !empty(ml) | |
let hlname = ml[0] | |
continue | |
endif | |
break | |
endwhile | |
let HL_SAVE = substitute(matchstr(HL_SAVE, 'xxx \zs.*'), | |
\ '[ \t\n]\+', ' ', 'g') | |
return { 'name': hlname, 'highlight': HL_SAVE } | |
endfunction | |
1 0.000005 function! incsearch#highlight#turn_off(hldict) abort | |
execute 'highlight' a:hldict.name 'NONE' | |
endfunction | |
1 0.000003 function! incsearch#highlight#turn_on(hldict) abort | |
execute 'highlight' a:hldict.name a:hldict.highlight | |
endfunction | |
" Wrapper: | |
" @return hlobj | |
1 0.000004 function! incsearch#highlight#get_visual_hlobj() abort | |
if ! exists('s:_visual_hl') | |
let s:_visual_hl = incsearch#highlight#capture('Visual') | |
endif | |
return s:_visual_hl | |
endfunction | |
1 0.000003 augroup incsearch-update-visual-highlight | |
1 0.000039 autocmd! | |
1 0.000009 autocmd ColorScheme * if exists('s:_visual_hl') | unlet s:_visual_hl | endif | |
1 0.000001 augroup END | |
" Visual Highlighting Emulation: | |
1 0.000004 let s:INT = { 'MAX': 2147483647 } | |
" NOTE: | |
" Default highlight for visual selection has always higher priority than | |
" defined highlight, so you have to turn off default visual highlight and | |
" emulate it. All this function do is pseudo highlight visual selected area | |
" args: mode, visual_hl, v_start_pos, v_end_pos | |
1 0.000006 function! incsearch#highlight#emulate_visual_highlight(...) abort | |
let is_visual_now = s:U.is_visual(mode(1)) | |
let mode = get(a:, 1, is_visual_now ? mode(1) : visualmode()) | |
let visual_hl = get(a:, 2, incsearch#highlight#get_visual_hlobj()) | |
" Note: the default pos value assume visual selection is not cleared. | |
" It uses curswant to emulate visual-block | |
let v_start_pos = get(a:, 3, | |
\ (is_visual_now ? [line('v'),col('v')] : [line("'<"), col("'<")])) | |
" See: https://github.com/vim-jp/issues/issues/604 | |
" getcurpos() could be negative value, so use winsaveview() instead | |
let end_curswant_pos = | |
\ (exists('*getcurpos') ? getcurpos()[4] : winsaveview().curswant + 1) | |
let v_end_pos = get(a:, 4, (is_visual_now | |
\ ? [line('.'), end_curswant_pos < 0 ? s:INT.MAX : end_curswant_pos ] | |
\ : [line("'>"), col("'>")])) | |
let pattern = incsearch#highlight#get_visual_pattern(mode, v_start_pos, v_end_pos) | |
let hgm = incsearch#highlight#hgm() | |
let v = hgm.visual | |
" NOTE: Update highlight | |
execute 'hi' 'clear' v.group | |
execute 'hi' v.group visual_hl['highlight'] | |
call s:hi.add(v.group, v.group, pattern, v.priority) | |
call incsearch#highlight#update() | |
endfunction | |
1 0.000004 function! incsearch#highlight#get_visual_pattern(mode, v_start_pos, v_end_pos) abort | |
" NOTE: highlight doesn't work if the range is over screen height, so | |
" limit pattern to visible window. | |
let [_, v_start, v_end, _] = s:U.sort_pos([ | |
\ a:v_start_pos, | |
\ a:v_end_pos, | |
\ [line('w0'), 1], | |
\ [line('w$'), s:U.get_max_col(line('w$'))] | |
\ ]) | |
if a:mode ==# 'v' | |
if v_start[0] == v_end[0] | |
return printf('\v%%%dl%%%dc\_.*%%%dl%%%dc', | |
\ v_start[0], | |
\ min([v_start[1], s:U.get_max_col(v_start[0])]), | |
\ v_end[0], | |
\ min([v_end[1], s:U.get_max_col(v_end[0])])) | |
else | |
return printf('\v%%%dl%%%dc\_.{-}%%%dl|%%%dl\_.*%%%dl%%%dc', | |
\ v_start[0], | |
\ min([v_start[1], s:U.get_max_col(v_start[0])]), | |
\ v_end[0], | |
\ v_end[0], | |
\ v_end[0], | |
\ min([v_end[1], s:U.get_max_col(v_end[0])])) | |
endif | |
elseif a:mode ==# 'V' | |
return printf('\v%%%dl\_.*%%%dl', v_start[0], v_end[0]) | |
elseif a:mode ==# "\<C-v>" | |
" @vimlint(EVL102, 1, l:min_c) | |
let [min_c, max_c] = s:U.sort_num([v_start[1], v_end[1]]) | |
let max_c += 1 " increment needed | |
let max_c = max_c < 0 ? s:INT.MAX : max_c | |
let mapfunc = " | |
\ printf('%%%dl%%%dc.*%%%dc', | |
\ v:val, min_c, min([max_c, s:U.get_max_col(v:val)])) | |
\ " | |
return '\v'.join(map(range(v_start[0], v_end[0]), mapfunc), '|') | |
else | |
throw 'incsearch.vim: unexpected mode ' . a:mode | |
endif | |
endfunction | |
" Incremental Highlighting: | |
1 0.000004 function! incsearch#highlight#incremental_highlight(pattern, ...) abort | |
let should_separate_highlight = get(a:, 1, s:FALSE) | |
let direction = get(a:, 2, s:DIRECTION.forward) | |
let start_pos = get(a:, 3, getpos('.')[1:2]) | |
let hgm = incsearch#highlight#hgm() | |
let [m, r, o, c] = [hgm.match, hgm.match_reverse, hgm.on_cursor, hgm.cursor] | |
let on_cursor_pattern = '\m\%#\(' . a:pattern . '\m\)' | |
if '' =~# a:pattern | |
" Do not highlight for patterns which match everything | |
call s:hi.delete_all() | |
elseif ! should_separate_highlight | |
call s:hi.add(m.group, m.group, a:pattern, m.priority) | |
if ! g:incsearch#no_inc_hlsearch | |
let @/ = a:pattern | |
let &hlsearch = &hlsearch | |
endif | |
else | |
let [p1, p2] = (direction == s:DIRECTION.forward) | |
\ ? [incsearch#highlight#forward_pattern(a:pattern, start_pos) | |
\ ,incsearch#highlight#backward_pattern(a:pattern, start_pos)] | |
\ : [incsearch#highlight#backward_pattern(a:pattern, start_pos) | |
\ ,incsearch#highlight#forward_pattern(a:pattern, start_pos)] | |
call s:hi.add(m.group , m.group , p1 , m.priority) " right direction | |
call s:hi.add(r.group , r.group , p2 , r.priority) " reversed direction | |
endif | |
call s:hi.add(o.group , o.group , on_cursor_pattern , o.priority) | |
call s:hi.add(c.group , c.group , '\v%#' , c.priority) | |
call incsearch#highlight#update() | |
endfunction | |
1 0.000005 function! incsearch#highlight#forward_pattern(pattern, from_pos) abort | |
let [line, col] = a:from_pos | |
return printf('\v(%%>%dl|%%%dl%%>%dc)\m\(%s\m\)', line, line, col, a:pattern) | |
endfunction | |
1 0.000004 function! incsearch#highlight#backward_pattern(pattern, from_pos) abort | |
let [line, col] = a:from_pos | |
return printf('\v(%%<%dl|%%%dl%%<%dc)\m\(%s\m\)', line, line, col, a:pattern) | |
endfunction | |
" Restore 'cpoptions' {{{ | |
1 0.000010 let &cpo = s:save_cpo | |
1 0.000002 unlet s:save_cpo | |
" }}} | |
" __END__ {{{ | |
" vim: expandtab softtabstop=2 shiftwidth=2 | |
" vim: foldmethod=marker | |
" }}} | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Coaster/Highlight.vim | |
Sourced 2 times | |
Total time: 1490407872.232410 | |
Self time: 1490407872.231822 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000009 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000129 function! vital#_incsearch#Coaster#Highlight#import() abort | |
return map({'highlight': '', 'clear': '', 'delete': '', 'add': '', 'as_windo': '', '_vital_depends': '', 'get_hl_id': '', 'to_list': '', 'clear_all': '', 'delete_all': '', 'to_list_by': '', 'update': '', 'enable': '', 'delete_by': '', 'hl_list': '', 'make': '', 'enable_list': '', 'update_all': '', 'disable': '', 'disable_all': '', 'is_enabled': '', 'enable_all': '', 'is_added': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Coaster#Highlight#import() abort', printf("return map({'highlight': '', 'clear': '', 'delete': '', 'add': '', 'as_windo': '', '_vital_depends': '', 'get_hl_id': '', 'to_list': '', 'clear_all': '', 'delete_all': '', 'to_list_by': '', 'update': '', 'enable': '', 'delete_by': '', 'hl_list': '', 'make': '', 'enable_list': '', 'update_all': '', 'disable': '', 'disable_all': '', 'is_enabled': '', 'enable_all': '', 'is_added': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000005 scriptencoding utf-8 | |
2 0.000011 let s:save_cpo = &cpo | |
2 0.000013 set cpo&vim | |
2 0.000007 function! s:_vital_loaded(V) | |
let s:V = a:V | |
let s:Window = a:V.import("Coaster.Window") | |
let s:Gift = a:V.import("Gift") | |
call s:_init() | |
endfunction | |
2 0.000004 function! s:_vital_depends() | |
return [ | |
\ "Coaster.Window", | |
\ "Gift", | |
\ ] | |
endfunction | |
2 0.000016 let s:base = { | |
\ "variables" : { | |
\ "hl_list" : {}, | |
\ "id_list" : {} | |
\ } | |
\} | |
2 0.000006 function! s:base.add(name, group, pattern, ...) | |
call self.delete(a:name) | |
let priority = get(a:, 1, 10) | |
let self.variables.hl_list[a:name] = { | |
\ "group" : a:group, | |
\ "pattern" : a:pattern, | |
\ "priority" : priority, | |
\ "name" : a:name, | |
\ } | |
endfunction | |
2 0.000005 function! s:base.is_added(name) | |
return has_key(self.variables.hl_list, a:name) | |
endfunction | |
2 0.000004 function! s:base.hl_list() | |
return keys(self.variables.hl_list) | |
endfunction | |
2 0.000003 function! s:base.to_list() | |
return values(self.variables.hl_list) | |
endfunction | |
2 0.000006 function! s:_is_equal(__expr, __hl) | |
let name = a:__hl.name | |
let group = a:__hl.group | |
let pattern = a:__hl.pattern | |
let priority = a:__hl.priority | |
return eval(a:__expr) | |
endfunction | |
2 0.000004 function! s:base.to_list_by(expr) | |
return filter(values(self.variables.hl_list), "s:_is_equal(a:expr, v:val)") | |
endfunction | |
2 0.000003 function! s:base.enable_list(...) | |
let window = get(a:, 1, s:Gift.uniq_winnr()) | |
return keys(get(self.variables.id_list, window, {})) | |
endfunction | |
2 0.000004 function! s:base.delete(name) | |
if !self.is_added(a:name) | |
return -1 | |
endif | |
unlet! self.variables.hl_list[a:name] | |
endfunction | |
2 0.000004 function! s:base.delete_by(expr) | |
return map(self.to_list_by(a:expr), "self.delete(v:val.name)") | |
endfunction | |
2 0.000003 function! s:base.delete_all() | |
for name in self.hl_list() | |
call self.delete(name) | |
endfor | |
endfunction | |
2 0.000005 function! s:base.get_hl_id(name, ...) | |
let window = get(a:, 1, s:Gift.uniq_winnr()) | |
return get(get(self.variables.id_list, window, {}), a:name, "") | |
endfunction | |
2 0.000004 function! s:base.is_enabled(name, ...) | |
let window = get(a:, 1, s:Gift.uniq_winnr()) | |
return self.get_hl_id(a:name, window) != "" | |
endfunction | |
2 0.000004 function! s:base.enable(name) | |
let hl = get(self.variables.hl_list, a:name, {}) | |
if empty(hl) | |
return -1 | |
endif | |
if self.is_enabled(a:name) | |
call self.disable(a:name) | |
endif | |
let winnr = s:Gift.uniq_winnr() | |
if !has_key(self.variables.id_list, winnr) | |
let self.variables.id_list[winnr] = {} | |
endif | |
let self.variables.id_list[winnr][a:name] = matchadd(hl.group, hl.pattern, hl.priority) | |
endfunction | |
2 0.000003 function! s:base.enable_all() | |
for name in self.hl_list() | |
call self.enable(name) | |
endfor | |
endfunction | |
2 0.000004 function! s:base.disable(name) | |
if !self.is_enabled(a:name) | |
return -1 | |
endif | |
let id = -1 | |
silent! let id = matchdelete(self.get_hl_id(a:name)) | |
if id == -1 | |
return -1 | |
endif | |
let winnr = get(a:, 1, s:Gift.uniq_winnr()) | |
unlet! self.variables.id_list[winnr][a:name] | |
endfunction | |
2 0.000004 function! s:base.disable_all() | |
for name in self.enable_list() | |
call self.disable(name) | |
endfor | |
endfunction | |
2 0.000004 function! s:base.update(name) | |
call self.disable(a:name) | |
call self.enable(a:name) | |
endfunction | |
2 0.000002 function! s:base.update_all() | |
call self.disable_all() | |
call self.enable_all() | |
endfunction | |
2 0.000005 function! s:base.highlight(name, group, pattern, ...) | |
let priority = get(a:, 1, 10) | |
call self.add(a:name, a:group, a:pattern, priority) | |
call self.enable(a:name) | |
endfunction | |
2 0.000004 function! s:base.clear(name) | |
call self.disable(a:name) | |
call self.delete(a:name) | |
endfunction | |
2 0.000004 function! s:base.clear_all() | |
call self.disable_all() | |
call self.delete_all() | |
endfunction | |
2 0.000003 function! s:base.as_windo() | |
return self.windo | |
endfunction | |
2 0.000004 function! s:make() | |
let result = deepcopy(s:base) | |
let result.windo = s:Window.as_windo(result) | |
return result | |
endfunction | |
2 0.000030 let s:global = deepcopy(s:base) | |
2 0.000176 let s:funcs = keys(filter(copy(s:global), "type(v:val) == type(function('tr'))")) | |
44 0.000059 for s:name in s:funcs | |
2 0.000024 execute | |
\ "function! s:" . s:name . "(...) \n" | |
\ "return call(s:global." . s:name . ", a:000, s:global) \n" | |
40 0.000314 \ "endfunction" | |
42 0.000043 endfor | |
2 0.000004 unlet s:name | |
2 0.000005 function! s:_init() | |
let s:global.windo = s:Window.as_windo(s:global) | |
endfunction | |
" function! s:matchadd(...) | |
" return { | |
" \ "id" : call("matchadd", a:000), | |
" \ "bufnr" : bufnr("%"), | |
" \ } | |
" endfunction | |
" | |
" | |
" function! s:matchdelete(id) | |
" if empty(a:id) | |
" return -1 | |
" endif | |
" return s:Buffer.execute(a:id.bufnr, "call matchdelete(" . a:id.id . ")") | |
" endfunction | |
2 0.000017 let &cpo = s:save_cpo | |
2 0.000006 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Coaster/Window.vim | |
Sourced 2 times | |
Total time: 1490407872.233344 | |
Self time: 1490407872.233157 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000028 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000134 function! vital#_incsearch#Coaster#Window#import() abort | |
return map({'as_windo': '', '_vital_depends': '', 'windo': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000004 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Coaster#Window#import() abort', printf("return map({'as_windo': '', '_vital_depends': '', 'windo': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000006 scriptencoding utf-8 | |
2 0.000016 let s:save_cpo = &cpo | |
2 0.000016 set cpo&vim | |
2 0.000007 function! s:_vital_loaded(V) | |
let s:V = a:V | |
let s:Buffer = a:V.import("Vim.Buffer") | |
endfunction | |
2 0.000004 function! s:_vital_depends() | |
return [ | |
\ "Vim.Buffer", | |
\ ] | |
endfunction | |
2 0.000005 function! s:windo(func, args, ...) | |
let dict = get(a:, 1, {}) | |
if len(tabpagebuflist()) <= 1 || s:Buffer.is_cmdwin() | |
return call(a:func, a:args, dict) | |
endif | |
let pre_winnr = winnr() | |
noautocmd windo call call(a:func, a:args, dict) | |
if pre_winnr == winnr() | |
return | |
endif | |
execute pre_winnr . "wincmd w" | |
endfunction | |
2 0.000006 function! s:as_windo(base) | |
let windo = {} | |
let windo.obj = a:base | |
for [key, Value] in items(a:base) | |
if type(function("tr")) == type(Value) | |
execute | |
\ "function! windo.". key. "(...)\n" | |
\ " return s:windo(self.obj." . key . ", a:000, self.obj)\n" | |
\ "endfunction" | |
endif | |
unlet Value | |
endfor | |
return windo | |
endfunction | |
2 0.000015 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Vim/Buffer.vim | |
Sourced 2 times | |
Total time: 1490407872.234189 | |
Self time: 1490407872.234010 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000010 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000127 function! vital#_incsearch#Vim#Buffer#import() abort | |
return map({'_vital_depends': '', 'read_content': '', 'get_selected_text': '', 'is_cmdwin': '', 'edit_content': '', 'open': '', 'get_last_selected': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Vim#Buffer#import() abort', printf("return map({'_vital_depends': '', 'read_content': '', 'get_selected_text': '', 'is_cmdwin': '', 'edit_content': '', 'open': '', 'get_last_selected': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000012 let s:save_cpo = &cpo | |
2 0.000013 set cpo&vim | |
2 0.000006 function! s:_vital_loaded(V) abort | |
let s:V = a:V | |
let s:P = s:V.import('Prelude') | |
let s:G = s:V.import('Vim.Guard') | |
endfunction | |
2 0.000005 function! s:_vital_depends() abort | |
return ['Prelude', 'Vim.Guard'] | |
endfunction | |
2 0.000009 if exists('*getcmdwintype') | |
2 0.000005 function! s:is_cmdwin() abort | |
return getcmdwintype() !=# '' | |
endfunction | |
2 0.000003 else | |
function! s:is_cmdwin() abort | |
return bufname('%') ==# '[Command Line]' | |
endfunction | |
endif | |
2 0.000005 function! s:open(buffer, opener) abort | |
let save_wildignore = &wildignore | |
let &wildignore = '' | |
try | |
if s:P.is_funcref(a:opener) | |
let loaded = !bufloaded(a:buffer) | |
call a:opener(a:buffer) | |
elseif a:buffer is 0 || a:buffer is# '' | |
let loaded = 1 | |
silent execute a:opener | |
enew | |
else | |
let loaded = !bufloaded(a:buffer) | |
if s:P.is_string(a:buffer) | |
execute a:opener '`=a:buffer`' | |
elseif s:P.is_number(a:buffer) | |
silent execute a:opener | |
execute a:buffer 'buffer' | |
else | |
throw 'vital: Vim.Buffer: Unknown opener type.' | |
endif | |
endif | |
finally | |
let &wildignore = save_wildignore | |
endtry | |
return loaded | |
endfunction | |
2 0.000006 function! s:get_selected_text(...) abort | |
echohl WarningMsg | |
echom "[WARN] s:get_selected_text() is deprecated. Use 's:get_last_selected()'." | |
echohl None | |
return call('s:get_last_selected', a:000) | |
endfunction | |
" Get the last selected text in visual mode | |
" without using |gv| to avoid |textlock|. | |
" NOTE: | |
" * This function uses |gv| only when using |CTRL-V| | |
" because |gv| is the only way to get selected text | |
" when using <C-v>$ . | |
" Please see #192 for the details. | |
" * If you don't care about |textlock|, | |
" you can use simple version of this function. | |
" https://github.com/vim-jp/vital.vim/commit/39aae80f3839fdbeebd838ff14d87327a6b889a9 | |
2 0.000004 function! s:get_last_selected() abort | |
if visualmode() ==# "\<C-v>" | |
let save = getreg('"', 1) | |
let save_type = getregtype('"') | |
try | |
normal! gv""y | |
return @" | |
finally | |
call setreg('"', save, save_type) | |
endtry | |
else | |
let [begin, end] = [getpos("'<"), getpos("'>")] | |
let lastchar = matchstr(getline(end[1])[end[2]-1 :], '.') | |
if begin[1] ==# end[1] | |
let lines = [getline(begin[1])[begin[2]-1 : end[2]-2]] | |
else | |
let lines = [getline(begin[1])[begin[2]-1 :]] | |
\ + (end[1] - begin[1] <# 2 ? [] : getline(begin[1]+1, end[1]-1)) | |
\ + [getline(end[1])[: end[2]-2]] | |
endif | |
return join(lines, "\n") . lastchar . (visualmode() ==# 'V' ? "\n" : '') | |
endif | |
endfunction | |
2 0.000005 function! s:read_content(content, ...) abort | |
let options = extend({ | |
\ 'tempfile': '', | |
\ 'fileformat': '', | |
\ 'encoding': '', | |
\ 'binary': 0, | |
\ 'nobinary': 0, | |
\ 'bad': '', | |
\ 'edit': 0, | |
\}, get(a:000, 0, {})) | |
let tempfile = empty(options.tempfile) ? tempname() : options.tempfile | |
let optnames = [ | |
\ empty(options.fileformat) ? '' : '++ff=' . options.fileformat, | |
\ empty(options.encoding) ? '' : '++enc=' . options.encoding, | |
\ empty(options.binary) ? '' : '++bin', | |
\ empty(options.nobinary) ? '' : '++nobin', | |
\ empty(options.bad) ? '' : '++bad=' . options.bad, | |
\ empty(options.edit) ? '' : '++edit', | |
\] | |
let optname = join(filter(optnames, '!empty(v:val)')) | |
try | |
call writefile(a:content, tempfile) | |
execute printf('keepalt keepjumps read %s%s', | |
\ empty(optname) ? '' : optname . ' ', | |
\ fnameescape(tempfile), | |
\) | |
finally | |
call delete(tempfile) | |
endtry | |
endfunction | |
2 0.000005 function! s:edit_content(content, ...) abort | |
let options = extend({ | |
\ 'edit': 1, | |
\}, get(a:000, 0, {})) | |
let guard = s:G.store(['&l:modifiable']) | |
let saved_view = winsaveview() | |
try | |
let &l:modifiable=1 | |
silent keepjumps %delete _ | |
silent call s:read_content(a:content, options) | |
silent keepjumps 1delete _ | |
finally | |
keepjump call winrestview(saved_view) | |
call guard.restore() | |
endtry | |
setlocal nomodified | |
endfunction | |
2 0.000015 let &cpo = s:save_cpo | |
2 0.000004 unlet s:save_cpo | |
" vim:set et ts=2 sts=2 sw=2 tw=0: | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Prelude.vim | |
Sourced 2 times | |
Total time: 1490407872.235588 | |
Self time: 1490407872.235121 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000117 function! vital#_incsearch#Prelude#import() abort | |
return map({'escape_pattern': '', 'is_funcref': '', 'path2directory': '', 'wcswidth': '', 'is_string': '', 'input_helper': '', 'is_number': '', 'is_cygwin': '', 'path2project_directory': '', 'strwidthpart_reverse': '', 'input_safe': '', 'is_list': '', 'truncate_skipping': '', 'glob': '', 'truncate': '', 'is_dict': '', 'set_default': '', 'is_numeric': '', 'getchar_safe': '', 'substitute_path_separator': '', 'is_mac': '', 'strwidthpart': '', 'getchar': '', 'is_unix': '', 'is_windows': '', 'globpath': '', 'escape_file_searching': '', 'is_float': '', 'smart_execute_command': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Prelude#import() abort', printf("return map({'escape_pattern': '', 'is_funcref': '', 'path2directory': '', 'wcswidth': '', 'is_string': '', 'input_helper': '', 'is_number': '', 'is_cygwin': '', 'path2project_directory': '', 'strwidthpart_reverse': '', 'input_safe': '', 'is_list': '', 'truncate_skipping': '', 'glob': '', 'truncate': '', 'is_dict': '', 'set_default': '', 'is_numeric': '', 'getchar_safe': '', 'substitute_path_separator': '', 'is_mac': '', 'strwidthpart': '', 'getchar': '', 'is_unix': '', 'is_windows': '', 'globpath': '', 'escape_file_searching': '', 'is_float': '', 'smart_execute_command': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000012 let s:save_cpo = &cpo | |
2 0.000012 set cpo&vim | |
2 0.000008 if v:version ># 703 || | |
\ (v:version is 703 && has('patch465')) | |
2 0.000006 function! s:glob(expr) abort | |
return glob(a:expr, 1, 1) | |
endfunction | |
2 0.000004 else | |
function! s:glob(expr) abort | |
let R = glob(a:expr, 1) | |
return split(R, '\n') | |
endfunction | |
endif | |
2 0.000005 function! s:globpath(path, expr) abort | |
let R = globpath(a:path, a:expr, 1) | |
return split(R, '\n') | |
endfunction | |
" Wrapper functions for type(). | |
2 0.000056 let [ | |
\ s:__TYPE_NUMBER, | |
\ s:__TYPE_STRING, | |
\ s:__TYPE_FUNCREF, | |
\ s:__TYPE_LIST, | |
\ s:__TYPE_DICT, | |
\ s:__TYPE_FLOAT] = [ | |
\ type(3), | |
\ type(''), | |
\ type(function('tr')), | |
\ type([]), | |
\ type({}), | |
\ has('float') ? type(str2float('0')) : -1] | |
" __TYPE_FLOAT = -1 when -float | |
" This doesn't match to anything. | |
" Number or Float | |
2 0.000006 function! s:is_numeric(Value) abort | |
let _ = type(a:Value) | |
return _ ==# s:__TYPE_NUMBER | |
\ || _ ==# s:__TYPE_FLOAT | |
endfunction | |
" Number | |
2 0.000004 function! s:is_number(Value) abort | |
return type(a:Value) ==# s:__TYPE_NUMBER | |
endfunction | |
" Float | |
2 0.000005 function! s:is_float(Value) abort | |
return type(a:Value) ==# s:__TYPE_FLOAT | |
endfunction | |
" String | |
2 0.000005 function! s:is_string(Value) abort | |
return type(a:Value) ==# s:__TYPE_STRING | |
endfunction | |
" Funcref | |
2 0.000005 function! s:is_funcref(Value) abort | |
return type(a:Value) ==# s:__TYPE_FUNCREF | |
endfunction | |
" List | |
2 0.000004 function! s:is_list(Value) abort | |
return type(a:Value) ==# s:__TYPE_LIST | |
endfunction | |
" Dictionary | |
2 0.000004 function! s:is_dict(Value) abort | |
return type(a:Value) ==# s:__TYPE_DICT | |
endfunction | |
2 0.000007 function! s:truncate_skipping(str, max, footer_width, separator) abort | |
call s:_warn_deprecated('truncate_skipping', 'Data.String.truncate_skipping') | |
let width = s:wcswidth(a:str) | |
if width <= a:max | |
let ret = a:str | |
else | |
let header_width = a:max - s:wcswidth(a:separator) - a:footer_width | |
let ret = s:strwidthpart(a:str, header_width) . a:separator | |
\ . s:strwidthpart_reverse(a:str, a:footer_width) | |
endif | |
return s:truncate(ret, a:max) | |
endfunction | |
2 0.000004 function! s:truncate(str, width) abort | |
" Original function is from mattn. | |
" http://github.com/mattn/googlereader-vim/tree/master | |
call s:_warn_deprecated('truncate', 'Data.String.truncate') | |
if a:str =~# '^[\x00-\x7f]*$' | |
return len(a:str) < a:width ? | |
\ printf('%-'.a:width.'s', a:str) : strpart(a:str, 0, a:width) | |
endif | |
let ret = a:str | |
let width = s:wcswidth(a:str) | |
if width > a:width | |
let ret = s:strwidthpart(ret, a:width) | |
let width = s:wcswidth(ret) | |
endif | |
if width < a:width | |
let ret .= repeat(' ', a:width - width) | |
endif | |
return ret | |
endfunction | |
2 0.000006 function! s:strwidthpart(str, width) abort | |
call s:_warn_deprecated('strwidthpart', 'Data.String.strwidthpart') | |
if a:width <= 0 | |
return '' | |
endif | |
let ret = a:str | |
let width = s:wcswidth(a:str) | |
while width > a:width | |
let char = matchstr(ret, '.$') | |
let ret = ret[: -1 - len(char)] | |
let width -= s:wcswidth(char) | |
endwhile | |
return ret | |
endfunction | |
2 0.000006 function! s:strwidthpart_reverse(str, width) abort | |
call s:_warn_deprecated('strwidthpart_reverse', 'Data.String.strwidthpart_reverse') | |
if a:width <= 0 | |
return '' | |
endif | |
let ret = a:str | |
let width = s:wcswidth(a:str) | |
while width > a:width | |
let char = matchstr(ret, '^.') | |
let ret = ret[len(char) :] | |
let width -= s:wcswidth(char) | |
endwhile | |
return ret | |
endfunction | |
2 0.000005 if v:version >= 703 | |
" Use builtin function. | |
2 0.000006 function! s:wcswidth(str) abort | |
call s:_warn_deprecated('wcswidth', 'Data.String.wcswidth') | |
return strwidth(a:str) | |
endfunction | |
2 0.000002 else | |
function! s:wcswidth(str) abort | |
call s:_warn_deprecated('wcswidth', 'Data.String.wcswidth') | |
if a:str =~# '^[\x00-\x7f]*$' | |
return strlen(a:str) | |
end | |
let mx_first = '^\(.\)' | |
let str = a:str | |
let width = 0 | |
while 1 | |
let ucs = char2nr(substitute(str, mx_first, '\1', '')) | |
if ucs == 0 | |
break | |
endif | |
let width += s:_wcwidth(ucs) | |
let str = substitute(str, mx_first, '', '') | |
endwhile | |
return width | |
endfunction | |
" UTF-8 only. | |
function! s:_wcwidth(ucs) abort | |
let ucs = a:ucs | |
if (ucs >= 0x1100 | |
\ && (ucs <= 0x115f | |
\ || ucs == 0x2329 | |
\ || ucs == 0x232a | |
\ || (ucs >= 0x2e80 && ucs <= 0xa4cf | |
\ && ucs != 0x303f) | |
\ || (ucs >= 0xac00 && ucs <= 0xd7a3) | |
\ || (ucs >= 0xf900 && ucs <= 0xfaff) | |
\ || (ucs >= 0xfe30 && ucs <= 0xfe6f) | |
\ || (ucs >= 0xff00 && ucs <= 0xff60) | |
\ || (ucs >= 0xffe0 && ucs <= 0xffe6) | |
\ || (ucs >= 0x20000 && ucs <= 0x2fffd) | |
\ || (ucs >= 0x30000 && ucs <= 0x3fffd) | |
\ )) | |
return 2 | |
endif | |
return 1 | |
endfunction | |
endif | |
2 0.000026 let s:is_windows = has('win16') || has('win32') || has('win64') || has('win95') | |
2 0.000010 let s:is_cygwin = has('win32unix') | |
2 0.000033 let s:is_mac = !s:is_windows && !s:is_cygwin | |
\ && (has('mac') || has('macunix') || has('gui_macvim') || | |
\ (!isdirectory('/proc') && executable('sw_vers'))) | |
2 0.000007 let s:is_unix = has('unix') | |
2 0.000004 function! s:is_windows() abort | |
return s:is_windows | |
endfunction | |
2 0.000004 function! s:is_cygwin() abort | |
return s:is_cygwin | |
endfunction | |
2 0.000004 function! s:is_mac() abort | |
return s:is_mac | |
endfunction | |
2 0.000005 function! s:is_unix() abort | |
return s:is_unix | |
endfunction | |
2 0.000005 function! s:_warn_deprecated(name, alternative) abort | |
try | |
echohl Error | |
echomsg 'Prelude.' . a:name . ' is deprecated! Please use ' . a:alternative . ' instead.' | |
finally | |
echohl None | |
endtry | |
endfunction | |
2 0.000006 function! s:smart_execute_command(action, word) abort | |
execute a:action . ' ' . (a:word ==# '' ? '' : '`=a:word`') | |
endfunction | |
2 0.000006 function! s:escape_file_searching(buffer_name) abort | |
return escape(a:buffer_name, '*[]?{}, ') | |
endfunction | |
2 0.000005 function! s:escape_pattern(str) abort | |
call s:_warn_deprecated( | |
\ 'escape_pattern', | |
\ 'Data.String.escape_pattern', | |
\) | |
return escape(a:str, '~"\.^$[]*') | |
endfunction | |
2 0.000004 function! s:getchar(...) abort | |
let c = call('getchar', a:000) | |
return type(c) == type(0) ? nr2char(c) : c | |
endfunction | |
2 0.000004 function! s:getchar_safe(...) abort | |
let c = s:input_helper('getchar', a:000) | |
return type(c) == type('') ? c : nr2char(c) | |
endfunction | |
2 0.000004 function! s:input_safe(...) abort | |
return s:input_helper('input', a:000) | |
endfunction | |
2 0.000005 function! s:input_helper(funcname, args) abort | |
let success = 0 | |
if inputsave() !=# success | |
throw 'vital: Prelude: inputsave() failed' | |
endif | |
try | |
return call(a:funcname, a:args) | |
finally | |
if inputrestore() !=# success | |
throw 'vital: Prelude: inputrestore() failed' | |
endif | |
endtry | |
endfunction | |
2 0.000005 function! s:set_default(var, val) abort | |
if !exists(a:var) || type({a:var}) != type(a:val) | |
let {a:var} = a:val | |
endif | |
endfunction | |
2 0.000006 function! s:substitute_path_separator(path) abort | |
return s:is_windows ? substitute(a:path, '\\', '/', 'g') : a:path | |
endfunction | |
2 0.000005 function! s:path2directory(path) abort | |
return s:substitute_path_separator(isdirectory(a:path) ? a:path : fnamemodify(a:path, ':p:h')) | |
endfunction | |
2 0.000006 function! s:_path2project_directory_git(path) abort | |
let parent = a:path | |
while 1 | |
let path = parent . '/.git' | |
if isdirectory(path) || filereadable(path) | |
return parent | |
endif | |
let next = fnamemodify(parent, ':h') | |
if next == parent | |
return '' | |
endif | |
let parent = next | |
endwhile | |
endfunction | |
2 0.000006 function! s:_path2project_directory_svn(path) abort | |
let search_directory = a:path | |
let directory = '' | |
let find_directory = s:escape_file_searching(search_directory) | |
let d = finddir('.svn', find_directory . ';') | |
if d ==# '' | |
return '' | |
endif | |
let directory = fnamemodify(d, ':p:h:h') | |
" Search parent directories. | |
let parent_directory = s:path2directory( | |
\ fnamemodify(directory, ':h')) | |
if parent_directory !=# '' | |
let d = finddir('.svn', parent_directory . ';') | |
if d !=# '' | |
let directory = s:_path2project_directory_svn(parent_directory) | |
endif | |
endif | |
return directory | |
endfunction | |
2 0.000006 function! s:_path2project_directory_others(vcs, path) abort | |
let vcs = a:vcs | |
let search_directory = a:path | |
let find_directory = s:escape_file_searching(search_directory) | |
let d = finddir(vcs, find_directory . ';') | |
if d ==# '' | |
return '' | |
endif | |
return fnamemodify(d, ':p:h:h') | |
endfunction | |
2 0.000007 function! s:path2project_directory(path, ...) abort | |
let is_allow_empty = get(a:000, 0, 0) | |
let search_directory = s:path2directory(a:path) | |
let directory = '' | |
" Search VCS directory. | |
for vcs in ['.git', '.bzr', '.hg', '.svn'] | |
if vcs ==# '.git' | |
let directory = s:_path2project_directory_git(search_directory) | |
elseif vcs ==# '.svn' | |
let directory = s:_path2project_directory_svn(search_directory) | |
else | |
let directory = s:_path2project_directory_others(vcs, search_directory) | |
endif | |
if directory !=# '' | |
break | |
endif | |
endfor | |
" Search project file. | |
if directory ==# '' | |
for d in ['build.xml', 'prj.el', '.project', 'pom.xml', 'package.json', | |
\ 'Makefile', 'configure', 'Rakefile', 'NAnt.build', | |
\ 'P4CONFIG', 'tags', 'gtags'] | |
let d = findfile(d, s:escape_file_searching(search_directory) . ';') | |
if d !=# '' | |
let directory = fnamemodify(d, ':p:h') | |
break | |
endif | |
endfor | |
endif | |
if directory ==# '' | |
" Search /src/ directory. | |
let base = s:substitute_path_separator(search_directory) | |
if base =~# '/src/' | |
let directory = base[: strridx(base, '/src/') + 3] | |
endif | |
endif | |
if directory ==# '' && !is_allow_empty | |
" Use original path. | |
let directory = search_directory | |
endif | |
return s:substitute_path_separator(directory) | |
endfunction | |
2 0.000016 let &cpo = s:save_cpo | |
2 0.000005 unlet s:save_cpo | |
" vim:set et ts=2 sts=2 sw=2 tw=0: | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Vim/Guard.vim | |
Sourced 2 times | |
Total time: 1490407872.236816 | |
Self time: 1490407872.236547 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000011 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000120 function! vital#_incsearch#Vim#Guard#import() abort | |
return map({'_vital_depends': '', '_vital_created': '', 'store': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Vim#Guard#import() abort', printf("return map({'_vital_depends': '', '_vital_created': '', 'store': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000013 let s:save_cpo = &cpo | |
2 0.000011 set cpo&vim | |
" Use a Funcref as a special term _UNDEFINED | |
2 0.000007 function! s:_undefined() abort | |
return 'undefined' | |
endfunction | |
2 0.000013 let s:_UNDEFINED = function('s:_undefined') | |
2 0.000006 function! s:_vital_loaded(V) abort | |
let s:V = a:V | |
let s:Prelude = s:V.import('Prelude') | |
let s:List = s:V.import('Data.List') | |
let s:Dict = s:V.import('Data.Dict') | |
endfunction | |
2 0.000006 function! s:_vital_depends() abort | |
return ['Prelude', 'Data.List', 'Data.Dict'] | |
endfunction | |
2 0.000005 function! s:_vital_created(module) abort | |
" define constant variables | |
if !exists('s:const') | |
let s:const = {} | |
let s:const.is_local_variable_supported = | |
\ v:version > 703 || (v:version == 703 && has('patch560')) | |
" NOTE: | |
" The third argument is available from 7.4.242 but it had bug and that | |
" bug was fixed from 7.4.513 | |
let s:const.is_third_argument_of_getreg_supported = has('patch-7.4.513') | |
lockvar s:const | |
endif | |
call extend(a:module, s:const) | |
endfunction | |
2 0.000006 function! s:_throw(msg) abort | |
throw printf('vital: Vim.Guard: %s', a:msg) | |
endfunction | |
2 0.000006 let s:option = {} | |
2 0.000005 function! s:_new_option(name) abort | |
if a:name !~# '^&' | |
call s:_throw(printf( | |
\'An option name "%s" requires to be started from "&"', a:name | |
\)) | |
elseif !exists(a:name) | |
call s:_throw(printf( | |
\'An option name "%s" does not exist', a:name | |
\)) | |
endif | |
let option = copy(s:option) | |
let option.name = a:name | |
let option.value = eval(a:name) | |
return option | |
endfunction | |
2 0.000006 function! s:option.restore() abort | |
execute printf('let %s = %s', self.name, string(self.value)) | |
endfunction | |
2 0.000005 let s:register = {} | |
2 0.000006 function! s:_new_register(name) abort | |
if len(a:name) != 2 | |
call s:_throw(printf( | |
\'A register name "%s" requires to be "@" + a single character', a:name | |
\)) | |
elseif a:name !~# '^@' | |
call s:_throw(printf( | |
\'A register name "%s" requires to be started from "@"', a:name | |
\)) | |
elseif a:name =~# '^@[:.%]$' | |
call s:_throw(printf( | |
\'A register name "%s" is read only', a:name | |
\)) | |
elseif a:name !~# '^@[@0-9a-zA-Z#=*+~_/-]$' | |
call s:_throw(printf( | |
\'A register name "%s" does not exist. See ":help let-register"', a:name | |
\)) | |
endif | |
let name = a:name ==# '@@' ? '' : a:name[1] | |
let register = copy(s:register) | |
let register.name = name | |
if s:const.is_third_argument_of_getreg_supported | |
let register.value = getreg(name, 1, 1) | |
else | |
let register.value = getreg(name, 1) | |
endif | |
let register.type = getregtype(name) | |
return register | |
endfunction | |
2 0.000004 function! s:register.restore() abort | |
call setreg(self.name, self.value, self.type) | |
endfunction | |
2 0.000005 let s:environment = {} | |
2 0.000006 function! s:_new_environment(name) abort | |
if a:name !~# '^\$' | |
call s:_throw(printf( | |
\'An environment variable name "%s" requires to be started from "$"', a:name | |
\)) | |
elseif !exists(a:name) | |
call s:_throw(printf( | |
\'An environment variable name "%s" does not exist. While Vim cannot unlet environment variable, it requires to exist', a:name | |
\)) | |
endif | |
let environment = copy(s:environment) | |
let environment.name = a:name | |
let environment.value = eval(a:name) | |
return environment | |
endfunction | |
2 0.000008 function! s:environment.restore() abort | |
execute printf('let %s = %s', self.name, string(self.value)) | |
endfunction | |
2 0.000005 let s:variable = {} | |
2 0.000005 function! s:_new_variable(name, ...) abort | |
if a:0 == 0 | |
let m = matchlist(a:name, '^\([bwtg]:\)\(.*\)$') | |
if empty(m) | |
call s:_throw(printf( | |
\ join([ | |
\ 'An variable name "%s" requires to start from b:, w:, t:, or g:', | |
\ 'while no {namespace} is specified', | |
\ ]), | |
\ a:name, | |
\)) | |
endif | |
let [prefix, name] = m[1 : 2] | |
let namespace = eval(prefix) | |
else | |
let name = a:name | |
let namespace = a:1 | |
endif | |
let variable = copy(s:variable) | |
let variable.name = name | |
let variable.value = get(namespace, name, s:_UNDEFINED) | |
let variable.value = | |
\ type(variable.value) == type({}) || type(variable.value) == type([]) | |
\ ? deepcopy(variable.value) | |
\ : variable.value | |
let variable._namespace = namespace | |
return variable | |
endfunction | |
2 0.000004 function! s:variable.restore() abort | |
" unlet the variable to prevent variable type mis-match in case | |
silent! unlet! self._namespace[self.name] | |
if type(self.value) == type(s:_UNDEFINED) && self.value == s:_UNDEFINED | |
" do nothing, leave the variable as undefined | |
else | |
let self._namespace[self.name] = self.value | |
endif | |
endfunction | |
2 0.000005 let s:instance = {} | |
2 0.000006 function! s:_new_instance(instance, ...) abort | |
let shallow = get(a:000, 0, 0) | |
if !s:Prelude.is_list(a:instance) && !s:Prelude.is_dict(a:instance) | |
call s:_throw(printf( | |
\'An instance "%s" requires to be List or Dictionary', string(a:instance) | |
\)) | |
endif | |
let instance = copy(s:instance) | |
let instance.instance = a:instance | |
let instance.values = shallow ? copy(a:instance) : deepcopy(a:instance) | |
return instance | |
endfunction | |
2 0.000004 function! s:instance.restore() abort | |
if s:Prelude.is_list(self.instance) | |
call s:List.clear(self.instance) | |
else | |
call s:Dict.clear(self.instance) | |
endif | |
call extend(self.instance, self.values) | |
endfunction | |
2 0.000005 let s:guard = {} | |
2 0.000005 function! s:store(targets) abort | |
let resources = [] | |
for meta in a:targets | |
if s:Prelude.is_list(meta) | |
if len(meta) == 1 | |
call add(resources, s:_new_instance(meta[0])) | |
elseif len(meta) == 2 | |
if s:Prelude.is_string(meta[0]) | |
call add(resources, call('s:_new_variable', meta)) | |
else | |
call add(resources, call('s:_new_instance', meta)) | |
endif | |
else | |
call s:_throw('List assignment requires one or two elements') | |
endif | |
elseif type(meta) == type('') | |
if meta =~# '^[bwtgls]:' | |
" Note: | |
" To improve an error message, handle l:XXX or s:XXX as well | |
call add(resources, s:_new_variable(meta)) | |
elseif meta =~# '^&' | |
call add(resources, s:_new_option(meta)) | |
elseif meta =~# '^@' | |
call add(resources, s:_new_register(meta)) | |
elseif meta =~# '^\$' | |
call add(resources, s:_new_environment(meta)) | |
else | |
call s:_throw(printf( | |
\ 'Unknown value "%s" was specified', | |
\ meta | |
\)) | |
endif | |
endif | |
unlet meta | |
endfor | |
let guard = copy(s:guard) | |
let guard._resources = resources | |
return guard | |
endfunction | |
2 0.000004 function! s:guard.restore() abort | |
for resource in self._resources | |
call resource.restore() | |
endfor | |
endfunction | |
2 0.000015 let &cpo = s:save_cpo | |
2 0.000004 unlet! s:save_cpo | |
" vim:set et ts=2 sts=2 sw=2 tw=0 fdm=marker: | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Data/Dict.vim | |
Sourced 2 times | |
Total time: 1490407872.237850 | |
Self time: 1490407872.237700 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000010 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000127 function! vital#_incsearch#Data#Dict#import() abort | |
return map({'pick': '', 'clear': '', 'max_by': '', 'foldl': '', 'swap': '', 'omit': '', 'min_by': '', 'foldr': '', 'make_index': '', 'make': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Data#Dict#import() abort', printf("return map({'pick': '', 'clear': '', 'max_by': '', 'foldl': '', 'swap': '', 'omit': '', 'min_by': '', 'foldr': '', 'make_index': '', 'make': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
" Utilities for dictionary. | |
2 0.000012 let s:save_cpo = &cpo | |
2 0.000012 set cpo&vim | |
" Makes a dict from keys and values | |
2 0.000007 function! s:make(keys, values, ...) abort | |
let dict = {} | |
let fill = a:0 ? a:1 : 0 | |
for i in range(len(a:keys)) | |
let key = type(a:keys[i]) == type('') ? a:keys[i] : string(a:keys[i]) | |
if key ==# '' | |
throw "vital: Data.Dict: Can't use an empty string for key." | |
endif | |
let dict[key] = get(a:values, i, fill) | |
endfor | |
return dict | |
endfunction | |
" Swaps keys and values | |
2 0.000004 function! s:swap(dict) abort | |
return s:make(values(a:dict), keys(a:dict)) | |
endfunction | |
" Makes a index dict from a list | |
2 0.000005 function! s:make_index(list, ...) abort | |
let value = a:0 ? a:1 : 1 | |
return s:make(a:list, [], value) | |
endfunction | |
2 0.000005 function! s:pick(dict, keys) abort | |
let new_dict = {} | |
for key in a:keys | |
if has_key(a:dict, key) | |
let new_dict[key] = a:dict[key] | |
endif | |
endfor | |
return new_dict | |
endfunction | |
2 0.000005 function! s:omit(dict, keys) abort | |
let new_dict = copy(a:dict) | |
for key in a:keys | |
if has_key(a:dict, key) | |
call remove(new_dict, key) | |
endif | |
endfor | |
return new_dict | |
endfunction | |
2 0.000004 function! s:clear(dict) abort | |
for key in keys(a:dict) | |
call remove(a:dict, key) | |
endfor | |
return a:dict | |
endfunction | |
2 0.000004 function! s:_max_by(dict, expr) abort | |
let dict = s:swap(map(copy(a:dict), a:expr)) | |
let key = dict[max(keys(dict))] | |
return [key, a:dict[key]] | |
endfunction | |
2 0.000005 function! s:max_by(dict, expr) abort | |
if empty(a:dict) | |
throw 'vital: Data.Dict: Empty dictionary' | |
endif | |
return s:_max_by(a:dict, a:expr) | |
endfunction | |
2 0.000005 function! s:min_by(dict, expr) abort | |
if empty(a:dict) | |
throw 'vital: Data.Dict: Empty dictionary' | |
endif | |
return s:_max_by(a:dict, '-(' . a:expr . ')') | |
endfunction | |
2 0.000005 function! s:_foldl(f, init, xs) abort | |
let memo = a:init | |
for [k, v] in a:xs | |
let expr = substitute(a:f, 'v:key', string(k), 'g') | |
let expr = substitute(expr, 'v:val', string(v), 'g') | |
let expr = substitute(expr, 'v:memo', string(memo), 'g') | |
unlet memo | |
let memo = eval(expr) | |
endfor | |
return memo | |
endfunction | |
2 0.000005 function! s:foldl(f, init, dict) abort | |
return s:_foldl(a:f, a:init, items(a:dict)) | |
endfunction | |
2 0.000004 function! s:foldr(f, init, dict) abort | |
return s:_foldl(a:f, a:init, reverse(items(a:dict))) | |
endfunction | |
2 0.000015 let &cpo = s:save_cpo | |
2 0.000004 unlet s:save_cpo | |
" vim:set et ts=2 sts=2 sw=2 tw=0: | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Gift.vim | |
Sourced 2 times | |
Total time: 1490407872.238866 | |
Self time: 1490407872.238672 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000009 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000125 function! vital#_incsearch#Gift#import() abort | |
return map({'flatten': '', 'uniq_tabpagenr': '', 'tabpagewinnr_list': '', 'execute': '', 'getwinvar': '', 'winnr': '', 'jump_window': '', '_vital_depends': '', 'uniq_winnr': '', 'setwinvar': '', 'find': '', 'openable_bufnr_list': '', 'to_fullpath': '', 'bufnr': '', 'set_current_window': '', 'tabpagewinnr': '', 'close_window': '', 'close_window_by': '', 'uniq_winnr_list': '', '_vital_loaded': '', 'find_by': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000004 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Gift#import() abort', printf("return map({'flatten': '', 'uniq_tabpagenr': '', 'tabpagewinnr_list': '', 'execute': '', 'getwinvar': '', 'winnr': '', 'jump_window': '', '_vital_depends': '', 'uniq_winnr': '', 'setwinvar': '', 'find': '', 'openable_bufnr_list': '', 'to_fullpath': '', 'bufnr': '', 'set_current_window': '', 'tabpagewinnr': '', 'close_window': '', 'close_window_by': '', 'uniq_winnr_list': '', '_vital_loaded': '', 'find_by': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000012 let s:save_cpo = &cpo | |
2 0.000012 set cpo&vim | |
2 0.000007 function! s:_vital_loaded(V) | |
let s:V = a:V | |
let s:Window = s:V.import("Gift.Window") | |
let s:Tabpage = s:V.import("Gift.Tabpage") | |
endfunction | |
2 0.000005 function! s:_vital_depends() | |
return [ | |
\ "Gift.Window", | |
\ "Gift.Tabpage", | |
\ ] | |
endfunction | |
2 0.000005 function! s:to_fullpath(filename) | |
let name = substitute(fnamemodify(a:filename, ":p"), '\', '/', "g") | |
if filereadable(name) | |
return name | |
else | |
return a:filename | |
endif | |
endfunction | |
2 0.000004 function! s:flatten(list) | |
return eval(join(a:list, "+")) | |
endfunction | |
2 0.000004 function! s:bufnr(expr) | |
return type(a:expr) == type([]) | |
\ ? s:bufnr(s:uniq_winnr(a:expr[1], a:expr[0])) | |
\ : s:Window.bufnr(a:expr) | |
endfunction | |
2 0.000005 function! s:openable_bufnr_list() | |
return map(s:tabpagewinnr_list(), "s:bufnr([v:val[0], v:val[1]])") | |
endfunction | |
2 0.000004 function! s:tabpagewinnr(...) | |
return a:0 == 0 ? s:tabpagewinnr(s:uniq_winnr()) | |
\ : s:Window.tabpagewinnr(a:1) | |
endfunction | |
2 0.000006 function! s:tabpagewinnr_list() | |
return s:Window.tabpagewinnr_list() | |
" return s:flatten(map(range(1, tabpagenr("$")), "map(range(1, tabpagewinnr(v:val, '$')), '['.v:val.', v:val]')")) | |
endfunction | |
2 0.000005 function! s:uniq_winnr(...) | |
return call(s:Window.uniq_nr, a:000, s:Window) | |
endfunction | |
2 0.000004 function! s:winnr(uniqnr) | |
let [tabnr, winnr] = s:Window.tabpagewinnr(a:uniqnr) | |
return winnr | |
endfunction | |
2 0.000005 function! s:uniq_winnr_list(...) | |
return map(s:tabpagewinnr_list(), "s:uniq_winnr(v:val[1], v:val[0])") | |
endfunction | |
2 0.000004 function! s:find(expr) | |
let gift_find_result = [] | |
for [tabnr, winnr] in s:tabpagewinnr_list() | |
let bufnr = s:bufnr([tabnr, winnr]) | |
if eval(a:expr) | |
call add(gift_find_result, [tabnr, winnr]) | |
endif | |
endfor | |
return gift_find_result | |
endfunction | |
2 0.000004 function! s:find_by(expr) | |
if type(a:expr) == type(function("tr")) | |
return filter(s:tabpagewinnr_list(), "a:expr(s:bufnr([v:val[0], v:val[1]]), v:val[0], v:val[1])") | |
else | |
return s:find(a:expr) | |
endif | |
endfunction | |
2 0.000004 function! s:jump_window(expr) | |
return type(a:expr) == type([]) | |
\ ? s:jump_window(s:uniq_winnr(a:expr[1], a:expr[0])) | |
\ : s:Window.jump(a:expr) | |
endfunction | |
2 0.000004 function! s:set_current_window(expr) | |
return s:jump_window(a:expr) | |
endfunction | |
2 0.000004 function! s:close_window(expr, ...) | |
let close_cmd = get(a:, 1, "close") | |
return type(a:expr) == type([]) | |
\ ? s:close_window(s:uniq_winnr(a:expr[1], a:expr[0]), close_cmd) | |
\ : s:Window.close(a:expr, close_cmd) | |
endfunction | |
2 0.000005 function! s:close_window_by(expr, ...) | |
let close_cmd = get(a:, 1, "close") | |
return map(map(s:find(a:expr), "s:uniq_winnr(v:val[1], v:val[0])"), 's:close_window(v:val, close_cmd)') | |
endfunction | |
2 0.000005 function! s:execute(expr, execute) | |
return type(a:expr) == type([]) | |
\ ? s:execute(s:uniq_winnr(a:expr[1], a:expr[0]), a:execute) | |
\ : s:Window.execute(a:expr, a:execute) | |
endfunction | |
2 0.000004 function! s:getwinvar(uniq_winnr, varname, ...) | |
let def = get(a:, 1, "") | |
return s:Window.getvar(a:uniq_winnr, a:varname, def) | |
endfunction | |
2 0.000005 function! s:setwinvar(uniq_winnr, varname, val) | |
return s:Window.setvar(a:uniq_winnr, a:varname, a:val) | |
endfunction | |
2 0.000004 function! s:uniq_tabpagenr(...) | |
return call(s:Tabpage.uniq_nr, a:000, s:Tabpage) | |
endfunction | |
2 0.000015 let &cpo = s:save_cpo | |
2 0.000005 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Gift/Window.vim | |
Sourced 2 times | |
Total time: 1490407872.239885 | |
Self time: 1490407872.239685 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000010 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000127 function! vital#_incsearch#Gift#Window#import() abort | |
return map({'flatten': '', 'tabpagewinnr_list': '', 'execute': '', 'close': '', 'numbering': '', 'set_prefix': '', '_vital_depends': '', 'exists': '', 'jump': '', 'setvar': '', 'bufnr': '', 'uniq_nr': '', 'make_uniq_nr': '', 'tabpagewinnr': '', 'getvar': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000003 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Gift#Window#import() abort', printf("return map({'flatten': '', 'tabpagewinnr_list': '', 'execute': '', 'close': '', 'numbering': '', 'set_prefix': '', '_vital_depends': '', 'exists': '', 'jump': '', 'setvar': '', 'bufnr': '', 'uniq_nr': '', 'make_uniq_nr': '', 'tabpagewinnr': '', 'getvar': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000013 let s:save_cpo = &cpo | |
2 0.000012 set cpo&vim | |
2 0.000006 function! s:_vital_loaded(V) | |
let s:V = a:V | |
let s:Tabpage = s:V.import("Gift.Tabpage") | |
endfunction | |
2 0.000005 function! s:_vital_depends() | |
return [ | |
\ "Gift.Tabpage", | |
\ ] | |
endfunction | |
2 0.000025 let s:prefix = expand("<sfile>:p:h:h:t") | |
2 0.000007 function! s:set_prefix(prefix) | |
let s:prefix = a:prefix | |
endfunction | |
2 0.000004 function! s:flatten(list) | |
return eval(join(a:list, "+")) | |
endfunction | |
2 0.000005 function! s:tabpagewinnr_list() | |
return s:flatten(map(range(1, tabpagenr("$")), "map(range(1, tabpagewinnr(v:val, '$')), '['.v:val.', v:val]')")) | |
endfunction | |
2 0.000008 if !exists("s:uniq_counter") | |
1 0.000003 let s:uniq_counter = 0 | |
1 0.000001 endif | |
2 0.000013 function! s:make_uniq_nr() | |
let s:uniq_counter += 1 | |
return s:uniq_counter | |
endfunction | |
2 0.000004 function! s:numbering(...) | |
let winnr = get(a:, 1, winnr()) | |
let tabnr = get(a:, 2, tabpagenr()) | |
let uniq_nr = s:make_uniq_nr() | |
call settabwinvar(tabnr, winnr, s:prefix . "_gift_uniq_winnr", uniq_nr) | |
return uniq_nr | |
endfunction | |
2 0.000004 function! s:uniq_nr(...) | |
let winnr = get(a:, 1, winnr()) | |
let tabnr = get(a:, 2, tabpagenr()) | |
let uniq_nr = get(gettabwinvar(tabnr, winnr, ""), s:prefix . "_gift_uniq_winnr", -1) | |
if uniq_nr == -1 | |
let uniq_nr = s:numbering(winnr, tabnr) | |
endif | |
return uniq_nr | |
endfunction | |
2 0.000004 function! s:exists(nr) | |
let [tabnr, winnr] = s:tabpagewinnr(a:nr) | |
return tabnr != 0 && winnr != 0 | |
endfunction | |
2 0.000004 function! s:tabpagewinnr(nr) | |
if a:nr == 0 | |
return s:tabpagewinnr(s:uniq_nr()) | |
endif | |
let tabwinnrs = s:tabpagewinnr_list() | |
for [tabnr, winnr] in tabwinnrs | |
if s:uniq_nr(winnr, tabnr) == a:nr | |
return [tabnr, winnr] | |
endif | |
endfor | |
return [0, 0] | |
endfunction | |
2 0.000004 function! s:getvar(nr, varname, ...) | |
let def = get(a:, 1, "") | |
let [tabnr, winnr] = s:tabpagewinnr(a:nr) | |
return get(gettabwinvar(tabnr, winnr, ""), a:varname, def) | |
endfunction | |
2 0.000004 function! s:setvar(nr, varname, val) | |
let [tabnr, winnr] = s:tabpagewinnr(a:nr) | |
if tabnr == 0 || winnr == 0 | |
return | |
endif | |
return settabwinvar(tabnr, winnr, a:varname, a:val) | |
endfunction | |
2 0.000004 function! s:bufnr(nr) | |
let [tabnr, winnr] = s:tabpagewinnr(a:nr) | |
return winnr >= 1 ? get(tabpagebuflist(tabnr), winnr-1, -1) : -1 | |
endfunction | |
2 0.000010 function! s:jump(nr) | |
let [tabnr, winnr] = s:tabpagewinnr(a:nr) | |
if tabnr == 0 || winnr == 0 | |
return -1 | |
endif | |
execute "tabnext" tabnr | |
execute winnr . "wincmd w" | |
endfunction | |
2 0.000005 function! s:close(nr, close_cmd) | |
call s:execute(a:nr, a:close_cmd) | |
" let current = gift#uniq_winnr() | |
" let result = s:jump(a:nr) | |
" if result == -1 | |
" return -1 | |
" endif | |
" execute a:close_cmd | |
" return s:jump(current) | |
endfunction | |
2 0.000005 function! s:execute(nr, expr) | |
let current = s:uniq_nr() | |
let result = s:jump(a:nr) | |
if result == -1 | |
return -1 | |
endif | |
execute a:expr | |
return s:jump(current) | |
endfunction | |
2 0.000016 let &cpo = s:save_cpo | |
2 0.000007 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/vital/_incsearch/Gift/Tabpage.vim | |
Sourced 2 times | |
Total time: 1490407872.240714 | |
Self time: 1490407872.240602 | |
count total (s) self (s) | |
" ___vital___ | |
" NOTE: lines between '" ___vital___' is generated by :Vitalize. | |
" Do not mofidify the code nor insert new lines before '" ___vital___' | |
2 0.000019 if v:version > 703 || v:version == 703 && has('patch1170') | |
2 0.000140 function! vital#_incsearch#Gift#Tabpage#import() abort | |
return map({'uniq_nr': '', 'make_uniq_nr': '', 'numbering': '', 'set_prefix': ''}, 'function("s:" . v:key)') | |
endfunction | |
2 0.000004 else | |
function! s:_SID() abort | |
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') | |
endfunction | |
execute join(['function! vital#_incsearch#Gift#Tabpage#import() abort', printf("return map({'uniq_nr': '', 'make_uniq_nr': '', 'numbering': '', 'set_prefix': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n") | |
delfunction s:_SID | |
endif | |
" ___vital___ | |
2 0.000004 scriptencoding utf-8 | |
2 0.000013 let s:save_cpo = &cpo | |
2 0.000012 set cpo&vim | |
2 0.000018 let s:prefix = expand("<sfile>:p:h:h:t") | |
2 0.000007 function! s:set_prefix(prefix) | |
let s:prefix = a:prefix | |
endfunction | |
2 0.000005 let s:uniq_counter = 0 | |
2 0.000005 function! s:make_uniq_nr() | |
let s:uniq_counter += 1 | |
return s:uniq_counter | |
endfunction | |
2 0.000005 function! s:numbering(...) | |
let tabnr = get(a:, 1, tabpagenr()) | |
let uniq_nr = s:make_uniq_nr() | |
call settabvar(tabnr, s:prefix . "_gift_uniq_tabpagenr", uniq_nr) | |
return uniq_nr | |
endfunction | |
2 0.000005 function! s:uniq_nr(...) | |
let tabnr = get(a:, 1, tabpagenr()) | |
let uniq_nr = get(gettabvar(tabnr, ""), s:prefix . "_gift_uniq_tabpagenr", -1) | |
if uniq_nr == -1 | |
let uniq_nr = s:numbering(tabnr) | |
endif | |
return uniq_nr | |
endfunction | |
2 0.000016 let &cpo = s:save_cpo | |
2 0.000006 unlet s:save_cpo | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/incsearch/over/extend.vim | |
Sourced 1 time | |
Total time: 0.000267 | |
Self time: 0.000149 | |
count total (s) self (s) | |
"============================================================================= | |
" FILE: autoload/incsearch/over/extend.vim | |
" AUTHOR: haya14busa | |
" License: MIT license | |
"============================================================================= | |
1 0.000003 scriptencoding utf-8 | |
1 0.000008 let s:save_cpo = &cpo | |
1 0.000006 set cpo&vim | |
1 0.000003 let s:TRUE = !0 | |
1 0.000002 let s:FALSE = 0 | |
1 0.000003 let s:non_escaped_backslash = '\m\%(\%(^\|[^\\]\)\%(\\\\\)*\)\@<=\\' | |
1 0.000126 0.000008 let s:U = incsearch#util#import() | |
1 0.000005 function! incsearch#over#extend#enrich(cli) abort | |
return extend(a:cli, s:cli) | |
endfunction | |
1 0.000007 let s:cli = { | |
\ '_does_exit_from_incsearch': s:FALSE, | |
\ '_return_cmd': '', | |
\ '_converter_cache': {} | |
\ } | |
1 0.000002 function! s:cli._generate_command(input) abort | |
let is_cancel = self.exit_code() | |
if is_cancel | |
return s:U.is_visual(self._mode) ? '\<ESC>gv' : "\<ESC>" | |
else | |
call self._call_execute_event() | |
let [pattern, offset] = incsearch#parse_pattern(a:input, self._base_key) | |
" TODO: implement convert input method | |
let p = self._combine_pattern(self._convert(pattern), offset) | |
return self._build_search_cmd(p) | |
endif | |
endfunction | |
" @return search cmd | |
1 0.000002 function! s:cli._build_search_cmd(pattern, ...) abort | |
let mode = get(a:, 1, self._mode) | |
let op = (mode ==# 'no') ? v:operator | |
\ : s:U.is_visual(mode) ? 'gv' | |
\ : '' | |
let zv = (&foldopen =~# '\vsearch|all' && mode !=# 'no' ? 'zv' : '') | |
" NOTE: | |
" Should I consider o_v, o_V, and o_CTRL-V cases and do not | |
" <Esc>? <Esc> exists for flexible v:count with using s:cli._vcount1, | |
" but, if you do not move the cursor while incremental searching, | |
" there are no need to use <Esc>. | |
let esc = self._has_count ? "\<Esc>" : '' | |
let register = esc is# '' ? '' : '"' . v:register | |
let cnt = self._vcount1 is# 1 ? '' : self._vcount1 | |
let prefix = esc . register . (esc is# '' ? '' : op) . cnt | |
return printf("%s%s%s\<CR>%s", prefix, self._base_key, a:pattern, zv) | |
endfunction | |
"" Call on_execute_pre and on_execute event | |
" assume current position is the destination and a:cli._w is the position to | |
" start search | |
1 0.000002 function! s:cli._call_execute_event(...) abort | |
let view = get(a:, 1, winsaveview()) | |
try | |
call winrestview(self._w) | |
call self.callevent('on_execute_pre') | |
finally | |
call winrestview(view) | |
endtry | |
call self.callevent('on_execute') | |
endfunction | |
1 0.000002 function! s:cli._parse_pattern() abort | |
if v:version == 704 && !has('patch421') | |
" Ignore \ze* which clash vim 7.4 without 421 patch | |
" Assume `\m` | |
let [p, o] = incsearch#parse_pattern(self.getline(), self._base_key) | |
let p = (p =~# s:non_escaped_backslash . 'z[se]\%(\*\|\\+\)' ? '' : p) | |
return [p, o] | |
else | |
return incsearch#parse_pattern(self.getline(), self._base_key) | |
endif | |
endfunction | |
1 0.000002 function! s:cli._combine_pattern(pattern, offset) abort | |
return empty(a:offset) ? a:pattern : a:pattern . self._base_key . a:offset | |
endfunction | |
1 0.000002 function! s:cli._convert(pattern) abort | |
if a:pattern is# '' | |
return a:pattern | |
elseif empty(self._converters) | |
return incsearch#magic() . a:pattern | |
elseif has_key(self._converter_cache, a:pattern) | |
return self._converter_cache[a:pattern] | |
else | |
let ps = [incsearch#magic() . a:pattern] | |
for l:Converter in self._converters | |
let l:Convert = type(l:Converter) is type(function('function')) | |
\ ? l:Converter : l:Converter.convert | |
let ps += [l:Convert(a:pattern)] | |
unlet l:Converter | |
endfor | |
" Converters may return upper case even if a:pattern doesn't contain upper | |
" case letter, so prepend case flag explicitly | |
" let case = incsearch#detect_case(a:pattern) | |
let case = incsearch#detect_case(a:pattern) | |
let self._converter_cache[a:pattern] = case . s:U.regexp_join(ps) | |
return self._converter_cache[a:pattern] | |
endif | |
endfunction | |
1 0.000002 function! s:cli._exit_incsearch(...) abort | |
let cmd = get(a:, 1, '') | |
let self._return_cmd = cmd | |
let self._does_exit_from_incsearch = s:TRUE | |
call self.exit() | |
endfunction | |
1 0.000009 let &cpo = s:save_cpo | |
1 0.000002 unlet s:save_cpo | |
" __END__ | |
" vim: expandtab softtabstop=2 shiftwidth=2 foldmethod=marker | |
SCRIPT /home/henryhu/.vim/bundle/incsearch.vim/autoload/incsearch/autocmd.vim | |
Sourced 1 time | |
Total time: 0.000143 | |
Self time: 0.000143 | |
count total (s) self (s) | |
"============================================================================= | |
" FILE: autoload/incsearch/autocmd.vim | |
" AUTHOR: haya14busa | |
" License: MIT license | |
"============================================================================= | |
1 0.000004 scriptencoding utf-8 | |
1 0.000007 let s:save_cpo = &cpo | |
1 0.000006 set cpo&vim | |
1 0.000028 noremap <silent><expr> <Plug>(_incsearch-nohlsearch) incsearch#autocmd#auto_nohlsearch(0) | |
1 0.000016 noremap! <silent><expr> <Plug>(_incsearch-nohlsearch) incsearch#autocmd#auto_nohlsearch(0) | |
1 0.000013 nnoremap <silent> <Plug>(_incsearch-nohlsearch) :<C-u>nohlsearch<CR> | |
1 0.000012 xnoremap <silent> <Plug>(_incsearch-nohlsearch) :<C-u>nohlsearch<CR>gv | |
" Make sure move cursor by search related action __after__ calling this | |
" function because the first move event just set nested autocmd which | |
" does :nohlsearch | |
" @expr | |
1 0.000005 function! incsearch#autocmd#auto_nohlsearch(nest) abort | |
" NOTE: see this value inside this function in order to toggle auto | |
" :nohlsearch feature easily with g:incsearch#autocmd#auto_nohlsearch option | |
if !g:incsearch#auto_nohlsearch | return '' | endif | |
return s:auto_nohlsearch(a:nest) | |
endfunction | |
1 0.000004 function! incsearch#autocmd#is_set() abort | |
return exists('#incsearch-auto-nohlsearch#CursorMoved') | |
endfunction | |
1 0.000004 function! s:auto_nohlsearch(nest) abort | |
" NOTE: :h autocmd-searchpat | |
" You cannot implement this feature without feedkeys() because of | |
" :h autocmd-searchpat | |
augroup incsearch-auto-nohlsearch | |
autocmd! | |
autocmd InsertEnter * :call <SID>attach_on_insert_leave() | autocmd! incsearch-auto-nohlsearch | |
execute join([ | |
\ 'autocmd CursorMoved *' | |
\ , repeat('autocmd incsearch-auto-nohlsearch CursorMoved * ', a:nest) | |
\ , 'call feedkeys("\<Plug>(_incsearch-nohlsearch)", "m")' | |
\ , '| autocmd! incsearch-auto-nohlsearch' | |
\ ], ' ') | |
augroup END | |
return '' | |
endfunction | |
1 0.000003 function! s:attach_on_insert_leave() abort | |
augroup incsearch-auto-nohlsearch-on-insert-leave | |
autocmd! | |
autocmd InsertLeave * :call incsearch#autocmd#auto_nohlsearch(1) | |
\ | autocmd! incsearch-auto-nohlsearch-on-insert-leave | |
augroup END | |
return '' | |
endfunction | |
1 0.000007 let &cpo = s:save_cpo | |
1 0.000002 unlet s:save_cpo | |
" __END__ | |
" vim: expandtab softtabstop=2 shiftwidth=2 foldmethod=marker | |
FUNCTION <SNR>137__keymapping() | |
Called 5 times | |
Total time: 0.000031 | |
Self time: 0.000031 | |
count total (s) self (s) | |
5 0.000028 return a:str =~ '^[!nvoicsxl]\s' | |
FUNCTION <SNR>143_on_char() | |
Called 30 times | |
Total time: 1.098454 | |
Self time: 0.003570 | |
count total (s) self (s) | |
30 0.000070 if a:cmdline._does_exit_from_incsearch | |
return | |
endif | |
30 0.003173 0.000221 let [raw_pattern, offset] = a:cmdline._parse_pattern() | |
30 0.000060 if raw_pattern ==# '' | |
call s:hi.disable_all() | |
nohlsearch | |
return | |
endif | |
" For InsertRegister | |
30 0.000295 0.000219 if a:cmdline.get_tap_key() ==# "\<C-r>" | |
let p = a:cmdline.getpos() | |
" Remove `"` | |
let raw_pattern = raw_pattern[:p-1] . raw_pattern[p+1:] | |
let w = winsaveview() | |
call cursor(line('.'), col('.') + len(a:cmdline.backward_word())) | |
call a:cmdline.get_module('InsertRegister').reset() | |
call winrestview(w) | |
endif | |
30 0.000771 0.000177 let pattern = a:cmdline._convert(raw_pattern) | |
" Improved Incremental cursor move! | |
30 1.046864 0.000243 call s:move_cursor(a:cmdline, pattern, offset) | |
" Improved Incremental highlighing! | |
" case: because matchadd() doesn't handle 'ignorecase' nor 'smartcase' | |
30 0.002410 0.000288 let case = incsearch#detect_case(raw_pattern) | |
30 0.000131 let should_separate = g:incsearch#separate_highlight && a:cmdline._flag !=# 'n' | |
30 0.000246 let pattern_for_hi = (a:cmdline._flag is# 'b' ? s:unescape_question_for_backward(pattern) : pattern) . case | |
30 0.041856 0.000390 call incsearch#highlight#incremental_highlight( pattern_for_hi, should_separate, a:cmdline._direction, [a:cmdline._w.lnum, a:cmdline._w.col]) | |
" functional `normal! zz` after scroll for <expr> mappings | |
30 0.001349 0.000296 if ( a:cmdline.is_input('<Over>(incsearch-scroll-f)') || a:cmdline.is_input('<Over>(incsearch-scroll-b)')) | |
call winrestview({'topline': max([1, line('.') - winheight(0) / 2])}) | |
endif | |
FUNCTION vital#_incsearch#Over#Commandline#Modules#KeyMapping#import() | |
Called 1 time | |
Total time: 0.000024 | |
Self time: 0.000024 | |
count total (s) self (s) | |
1 0.000022 return map({'_vital_depends': '', 'make_emacs': '', 'make_vim_cmdline_mapping': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>134__reset() | |
Called 31 times | |
Total time: 0.000237 | |
Self time: 0.000237 | |
count total (s) self (s) | |
31 0.000084 let s:cmdhist = [] | |
31 0.000059 let s:count = 0 | |
31 0.000059 let s:is_match_mode = 0 " <Up>/<Down>: true, <C-n>/<C-p>: false | |
FUNCTION <SNR>108__vital_loaded() | |
Called 1 time | |
Total time: 0.011401 | |
Self time: 0.000019 | |
count total (s) self (s) | |
1 0.000003 let s:V = a:V | |
1 0.011338 0.000007 let s:Maker = s:V.import("Over.Commandline.Maker") | |
1 0.000059 0.000008 let s:Modules = s:V.import("Over.Commandline.Modules") | |
FUNCTION 352() | |
Called 1 time | |
Total time: 0.000070 | |
Self time: 0.000009 | |
count total (s) self (s) | |
1 0.000070 0.000009 return self.variables.modules.disconnect_by( "get(v:val.slot, 'name', '') == " . string(a:name) ) | |
" unlet self.variables.modules[a:name] | |
FUNCTION airline#parts#filetype() | |
Called 39 times | |
Total time: 0.000281 | |
Self time: 0.000281 | |
count total (s) self (s) | |
39 0.000252 return winwidth(0) < 100 && strlen(&filetype) > 3 ? matchstr(&filetype, '...'). (&encoding is? 'utf-8' ? '…' : '>') : &filetype | |
FUNCTION <SNR>137_rhs_key_list() | |
Called 1 time | |
Total time: 0.000744 | |
Self time: 0.000079 | |
count total (s) self (s) | |
1 0.000005 let mode = get(a:, 1, "") | |
1 0.000004 let abbr = get(a:, 2, 0) | |
1 0.000003 let dict = get(a:, 3, 0) | |
1 0.000003 let result = [] | |
2 0.000009 for m in split(mode, '\zs') | |
1 0.000704 0.000039 let result += map(s:parse_lhs_list(m), "s:_maparg(v:val, m, abbr, dict)") | |
1 0.000001 endfor | |
1 0.000008 return filter(result, "empty(v:val) == 0") | |
FUNCTION incsearch#over#modules#exit#make() | |
Called 1 time | |
Total time: 0.000006 | |
Self time: 0.000006 | |
count total (s) self (s) | |
1 0.000005 return deepcopy(s:incsearch_exit) | |
FUNCTION <SNR>114_getchar() | |
Called 30 times | |
Total time: 0.003167 | |
Self time: 0.003167 | |
count total (s) self (s) | |
30 0.000132 let mode = get(a:, 1, 0) | |
30 0.000050 while 1 | |
" Workaround for https://github.com/osyo-manga/vital-over/issues/53 | |
30 0.000044 try | |
30 0.001560 let char = call("getchar", a:000) | |
30 0.000254 catch /^Vim:Interrupt$/ | |
let char = 3 " <C-c> | |
endtry | |
" Workaround for the <expr> mappings | |
30 0.000450 if string(char) !=# "\x80\xfd`" | |
30 0.000284 return mode == 1 ? !!char : type(char) == type(0) ? nr2char(char) : char | |
endif | |
endwhile | |
FUNCTION incsearch#util#import() | |
Called 5 times | |
Total time: 0.000667 | |
Self time: 0.000568 | |
count total (s) self (s) | |
5 0.000148 0.000049 let prefix = '<SNR>' . s:SID() . '_' | |
5 0.000016 let module = {} | |
60 0.000086 for func in s:functions | |
55 0.000274 let module[func] = function(prefix . func) | |
55 0.000066 endfor | |
5 0.000031 return copy(module) | |
FUNCTION <SNR>117__vital_loaded() | |
Called 1 time | |
Total time: 0.000800 | |
Self time: 0.000013 | |
count total (s) self (s) | |
1 0.000004 let s:V = a:V | |
1 0.000795 0.000008 let s:Message = s:V.import("Vim.Message") | |
FUNCTION incsearch#execute_search() | |
Called 32 times | |
Total time: 1.219215 | |
Self time: 0.000492 | |
count total (s) self (s) | |
31 1.126038 0.000461 return call(function('s:_execute_search'), a:000) | |
FUNCTION vital#_incsearch#Data#List#import() | |
Called 1 time | |
Total time: 0.000161 | |
Self time: 0.000161 | |
count total (s) self (s) | |
1 0.000160 return map({'combinations': '', 'and': '', 'sort_by': '', 'foldr1': '', 'sort': '', 'flatten': '', 'has_index': '', 'find_indices': '', 'any': '', 'unshift': '', 'span': '', 'pop': '', 'binary_search': '', 'uniq_by': '', 'or': '', 'all': '', 'zip': '', 'find_last_index': '', 'find': '', 'partition': '', 'map_accum': '', 'permutations': '', 'break': '', 'max_by': '', 'foldl': '', 'foldr': '', 'find_index': '', 'group_by': '', 'take_while': '', 'conj': '', 'push': '', 'char_range': '', 'cons': '', 'foldl1': '', 'intersect': '', 'concat': '', 'shift': '', 'clear': '', 'has_common_items': '', 'product': '', 'zip_fill': '', 'uniq': '', 'has': '', 'min_by': '', 'with_index': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>111_length() | |
Called 31 times | |
Total time: 0.001590 | |
Self time: 0.000237 | |
count total (s) self (s) | |
31 0.001558 0.000205 return len(s:split_by_keys(a:str)) | |
FUNCTION airline#statusline() | |
Called 39 times | |
Total time: 0.000696 | |
Self time: 0.000696 | |
count total (s) self (s) | |
39 0.000313 if has_key(s:contexts, a:winnr) | |
39 0.000306 return '%{airline#check_mode('.a:winnr.')}'.s:contexts[a:winnr].line | |
endif | |
" in rare circumstances this happens...see #276 | |
return '' | |
FUNCTION <SNR>136__convert_sid() | |
Called 5 times | |
Total time: 0.000045 | |
Self time: 0.000045 | |
count total (s) self (s) | |
5 0.000041 return substitute(a:rhs, '<SID>', '<SNR>' . a:sid . '_', 'g') | |
FUNCTION airline#check_mode() | |
Called 39 times | |
Total time: 0.004045 | |
Self time: 0.004045 | |
count total (s) self (s) | |
39 0.000192 let context = s:contexts[a:winnr] | |
39 0.000152 if get(w:, 'airline_active', 1) | |
39 0.000139 let l:m = mode() | |
39 0.000085 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'] | |
elseif l:m ==# "t" | |
let l:mode = ['terminal'] | |
else | |
39 0.000102 let l:mode = ['normal'] | |
39 0.000037 endif | |
39 0.000213 let w:airline_current_mode = get(g:airline_mode_map, l:m, l:m) | |
39 0.000047 else | |
let l:mode = ['inactive'] | |
let w:airline_current_mode = get(g:airline_mode_map, '__') | |
endif | |
39 0.000142 if g:airline_detect_modified && &modified | |
call add(l:mode, 'modified') | |
endif | |
39 0.000072 if g:airline_detect_paste && &paste | |
call add(l:mode, 'paste') | |
endif | |
39 0.000199 if g:airline_detect_crypt && exists("+key") && !empty(&key) | |
call add(l:mode, 'crypt') | |
endif | |
39 0.000089 if g:airline_detect_spell && &spell | |
call add(l:mode, 'spell') | |
endif | |
39 0.000064 if &readonly || ! &modifiable | |
call add(l:mode, 'readonly') | |
endif | |
39 0.000179 let mode_string = join(l:mode) | |
39 0.000168 if get(w:, 'airline_lastmode', '') != mode_string | |
call airline#highlighter#highlight_modified_inactive(context.bufnr) | |
call airline#highlighter#highlight(l:mode, context.bufnr) | |
let w:airline_lastmode = mode_string | |
endif | |
39 0.000049 return '' | |
FUNCTION <SNR>137_parse_lhs_list() | |
Called 1 time | |
Total time: 0.000563 | |
Self time: 0.000051 | |
count total (s) self (s) | |
1 0.000005 let mode = get(a:, 1, "") | |
1 0.000558 0.000046 return map(s:capture_list(mode), "s:parse_lhs(v:val, mode)") | |
FUNCTION vital#_incsearch#Gift#import() | |
Called 1 time | |
Total time: 0.000074 | |
Self time: 0.000074 | |
count total (s) self (s) | |
1 0.000073 return map({'flatten': '', 'uniq_tabpagenr': '', 'tabpagewinnr_list': '', 'execute': '', 'getwinvar': '', 'winnr': '', 'jump_window': '', '_vital_depends': '', 'uniq_winnr': '', 'setwinvar': '', 'find': '', 'openable_bufnr_list': '', 'to_fullpath': '', 'bufnr': '', 'set_current_window': '', 'tabpagewinnr': '', 'close_window': '', 'close_window_by': '', 'uniq_winnr_list': '', '_vital_loaded': '', 'find_by': ''}, 'function("s:" . v:key)') | |
FUNCTION incsearch#cli#make() | |
Called 1 time | |
Total time: 0.000165 | |
Self time: 0.000104 | |
count total (s) self (s) | |
1 0.000089 let cli = deepcopy(s:cli) | |
1 0.000074 0.000013 call incsearch#cli#set(cli, a:config) | |
1 0.000002 return cli | |
FUNCTION incsearch#parse_pattern() | |
Called 62 times | |
Total time: 0.004183 | |
Self time: 0.004183 | |
count total (s) self (s) | |
" search_key : '/' or '?' | |
" expr : {pattern\/pattern}/{offset} | |
" expr : {pattern}/;/{newpattern} :h //; | |
" return : [{pattern\/pattern}, {offset}] | |
62 0.000178 let very_magic = '\v' | |
62 0.000149 let pattern = '(%(\\.|.){-})' | |
62 0.000272 let slash = '(\' . a:search_key . '&[^\\"|[:alnum:][:blank:]])' | |
62 0.000122 let offset = '(.*)' | |
62 0.000324 let parse_pattern = very_magic . pattern . '%(' . slash . offset . ')?$' | |
62 0.002078 let result = matchlist(a:expr, parse_pattern)[1:3] | |
62 0.000333 if type(result) == type(0) || empty(result) | |
return [] | |
endif | |
62 0.000181 unlet result[1] | |
62 0.000102 return result | |
FUNCTION incsearch#over#modules#insert_register#make() | |
Called 1 time | |
Total time: 0.000007 | |
Self time: 0.000007 | |
count total (s) self (s) | |
1 0.000006 return deepcopy(s:InsertRegister) | |
FUNCTION incsearch#highlight#update() | |
Called 31 times | |
Total time: 0.033678 | |
Self time: 0.000349 | |
count total (s) self (s) | |
" it's intuiive to call incsearch#highlight#on() & off() but there are no | |
" need to execute `:nohlsearch` when updating. | |
31 0.018805 0.000135 call s:hi.disable_all() | |
31 0.014815 0.000156 call s:hi.enable_all() | |
FUNCTION vital#_incsearch#Over#Commandline#Modules#CursorMove#import() | |
Called 1 time | |
Total time: 0.000012 | |
Self time: 0.000012 | |
count total (s) self (s) | |
1 0.000010 return map({'make': ''}, 'function("s:" . v:key)') | |
FUNCTION 362() | |
Called 1 time | |
Total time: 0.000011 | |
Self time: 0.000011 | |
count total (s) self (s) | |
1 0.000004 let self.variables.exit = 1 | |
1 0.000006 let self.variables.exit_code = get(a:, 1, 0) | |
FUNCTION <SNR>103_emulate_search_warning() | |
Called 1 time | |
Total time: 0.000024 | |
Self time: 0.000024 | |
count total (s) self (s) | |
" NOTE: | |
" - It should use :h echomsg considering emulation of default | |
" warning messages remain in the :h message-history, but it'll mess | |
" up the message-history unnecessary, so it use :h echo | |
" - See :h shortmess | |
" if &shortmess !~# 's' && g:incsearch#do_not_save_error_message_history | |
1 0.000005 if &shortmess !~# 's' && g:incsearch#do_not_save_error_message_history | |
let from = [a:from.lnum, a:from.col] | |
let to = [a:to.lnum, a:to.col] | |
let old_warningmsg = v:warningmsg | |
let v:warningmsg = ( a:direction == s:DIRECTION.forward && !s:U.is_pos_less_equal(from, to) ? 'search hit BOTTOM, continuing at TOP' : a:direction == s:DIRECTION.backward && s:U.is_pos_less_equal(from, to) ? 'search hit TOP, continuing at BOTTOM' : '' ) | |
if v:warningmsg !=# '' | |
call s:Warning(v:warningmsg) | |
else | |
let v:warningmsg = old_warningmsg | |
endif | |
endif | |
FUNCTION <SNR>136_make_vim_cmdline_mapping() | |
Called 1 time | |
Total time: 0.000006 | |
Self time: 0.000006 | |
count total (s) self (s) | |
1 0.000004 return deepcopy(s:vim_cmdline_mapping) | |
FUNCTION <SNR>103__searchforward_cmd() | |
Called 1 time | |
Total time: 0.000047 | |
Self time: 0.000013 | |
count total (s) self (s) | |
1 0.000042 0.000008 let d = (g:incsearch#consistent_n_direction ? s:DIRECTION.forward : (incsearch#cli()._base_key is# '/' ? 1 : 0)) | |
1 0.000005 return printf(":\<C-u>let v:searchforward=%d\<CR>", d) | |
FUNCTION <SNR>115_match_key() | |
Called 33 times | |
Total time: 0.001243 | |
Self time: 0.001243 | |
count total (s) self (s) | |
33 0.000344 let keys = sort(keys(a:keymapping)) | |
33 0.000862 return get(filter(keys, 'stridx(a:key, v:val) == 0'), -1, '') | |
FUNCTION airline#parts#iminsert() | |
Called 39 times | |
Total time: 0.000311 | |
Self time: 0.000311 | |
count total (s) self (s) | |
39 0.000113 if g:airline_detect_iminsert && &iminsert && exists('b:keymap_name') | |
return toupper(b:keymap_name) | |
endif | |
39 0.000042 return '' | |
FUNCTION <SNR>104__652() | |
Called 1 time | |
Total time: 0.000104 | |
Self time: 0.000022 | |
count total (s) self (s) | |
1 0.000104 0.000022 return call(<SNR>104_funcmanage()['_652']['func'], a:000, <SNR>104_funcmanage()['_652']['dict']) | |
FUNCTION <SNR>108_make_default() | |
Called 1 time | |
Total time: 0.000164 | |
Self time: 0.000012 | |
count total (s) self (s) | |
1 0.000163 0.000011 return call(s:Maker.default, a:000, s:Maker) | |
FUNCTION incsearch#over#extend#enrich() | |
Called 1 time | |
Total time: 0.000009 | |
Self time: 0.000009 | |
count total (s) self (s) | |
1 0.000008 return extend(a:cli, s:cli) | |
FUNCTION <SNR>119__finish() | |
Called 31 times | |
Total time: 0.000316 | |
Self time: 0.000316 | |
count total (s) self (s) | |
31 0.000127 if exists("s:old_statusline") | |
let &statusline = s:old_statusline | |
unlet s:old_statusline | |
redrawstatus | |
endif | |
FUNCTION vital#_incsearch#Over#Commandline#Modules#IgnoreRegexpBackwardWord#import() | |
Called 1 time | |
Total time: 0.000016 | |
Self time: 0.000016 | |
count total (s) self (s) | |
1 0.000015 return map({'backward_word': '', 'make': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>113_call() | |
Called 154 times | |
Total time: 1.299094 | |
Self time: 0.016371 | |
count total (s) self (s) | |
154 0.000832 let args = get(a:, 1, []) | |
154 0.000637 let def = get(a:, 2, 0) | |
154 1.297483 0.014760 return map(copy(a:list), "has_key(v:val, a:func) ? call(v:val.".a:func.", args, v:val) : def") | |
FUNCTION <SNR>115_as_key_config() | |
Called 2 times | |
Total time: 0.000068 | |
Self time: 0.000068 | |
count total (s) self (s) | |
2 0.000014 let base = { "noremap" : 0, "lock" : 0, "expr" : 0, } | |
2 0.000052 return type(a:config) == type({}) ? extend(base, a:config) : extend(base, { "key" : a:config, }) | |
FUNCTION incsearch#go() | |
Called 1 time | |
Total time: 0.000904 | |
Self time: 0.000214 | |
count total (s) self (s) | |
1 0.000836 0.000163 let config = incsearch#config#make(get(a:, 1, {})) | |
" FIXME?: this condition should not be config.is_expr? | |
1 0.000003 if config.is_expr | |
return incsearch#_go(config) | |
else | |
1 0.000005 let g:incsearch#_go_config = config | |
1 0.000041 0.000024 let esc = s:U.is_visual(g:incsearch#_go_config.mode) ? "\<ESC>" : '' | |
1 0.000009 return printf("%s:\<C-u>call incsearch#_go(g:incsearch#_go_config)\<CR>", esc) | |
endif | |
FUNCTION <SNR>112_sort() | |
Called 154 times | |
Total time: 0.056702 | |
Self time: 0.017247 | |
count total (s) self (s) | |
154 0.001010 if type(a:expr) == type(function('function')) | |
return sort(a:list, a:expr) | |
endif | |
154 0.000327 let s:expr = a:expr | |
154 0.054650 0.015195 return sort(a:list, 's:_compare') | |
FUNCTION 504() | |
Called 1 time | |
Total time: 0.000087 | |
Self time: 0.000015 | |
count total (s) self (s) | |
1 0.000003 let s:cmdline = a:cmdline | |
1 0.000083 0.000011 call s:doautocmd_user(self.prefix, self.prefix . 'Enter') | |
FUNCTION 505() | |
Called 1 time | |
Total time: 0.000087 | |
Self time: 0.000011 | |
count total (s) self (s) | |
1 0.000003 let s:cmdline = a:cmdline | |
1 0.000083 0.000007 call s:doautocmd_user(self.prefix, self.prefix . 'Leave') | |
FUNCTION 506() | |
Called 30 times | |
Total time: 0.002121 | |
Self time: 0.000352 | |
count total (s) self (s) | |
30 0.000096 let s:cmdline = a:cmdline | |
30 0.001999 0.000230 call s:doautocmd_user(self.prefix, self.prefix . 'Char') | |
FUNCTION 507() | |
Called 30 times | |
Total time: 0.002625 | |
Self time: 0.000402 | |
count total (s) self (s) | |
30 0.000092 let s:cmdline = a:cmdline | |
30 0.002507 0.000284 call s:doautocmd_user(self.prefix, self.prefix . 'CharPre') | |
FUNCTION 508() | |
Called 30 times | |
Total time: 0.002206 | |
Self time: 0.000354 | |
count total (s) self (s) | |
30 0.000094 let s:cmdline = a:cmdline | |
30 0.002085 0.000233 call s:doautocmd_user(self.prefix, self.prefix . 'Draw') | |
FUNCTION 509() | |
Called 30 times | |
Total time: 0.002561 | |
Self time: 0.000405 | |
count total (s) self (s) | |
30 0.000096 let s:cmdline = a:cmdline | |
30 0.002430 0.000274 call s:doautocmd_user(self.prefix, self.prefix . 'DrawPre') | |
FUNCTION vital#_incsearch#Over#Commandline#Modules#Paste#import() | |
Called 1 time | |
Total time: 0.000011 | |
Self time: 0.000011 | |
count total (s) self (s) | |
1 0.000011 return map({'make': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>137__vital_loaded() | |
Called 1 time | |
Total time: 0.000737 | |
Self time: 0.000011 | |
count total (s) self (s) | |
1 0.000002 let s:V = a:V | |
1 0.000733 0.000007 let s:Capture = s:V.import("Palette.Capture") | |
FUNCTION <SNR>143_move_cursor() | |
Called 30 times | |
Total time: 1.046621 | |
Self time: 0.007298 | |
count total (s) self (s) | |
30 0.000157 let offset = get(a:, 1, '') | |
30 0.000074 if a:cli._flag ==# 'n' " skip if stay mode | |
return | |
endif | |
30 0.004715 call winrestview(a:cli._w) | |
" pseud-move cursor position: this is restored afterward if called by | |
" <expr> mappings | |
30 0.000072 if a:cli._is_expr | |
for _ in range(a:cli._vcount1) | |
" NOTE: This cannot handle {offset} for cursor position | |
call search(a:pattern, a:cli._flag) | |
endfor | |
else | |
" More precise cursor position while searching | |
" Caveat: | |
" This block contains `normal`, please make sure <expr> mappings | |
" doesn't reach this block | |
30 0.000600 0.000314 let is_visual_mode = s:U.is_visual(mode(1)) | |
30 0.014560 0.000628 let cmd = incsearch#with_ignore_foldopen( s:U.dictfunction(a:cli._build_search_cmd, a:cli), a:cli._combine_pattern(a:pattern, offset), 'n') | |
" NOTE: | |
" :silent! | |
" Shut up errors! because this is just for the cursor emulation | |
" while searching | |
30 1.025402 0.000297 silent! call incsearch#execute_search(cmd) | |
30 0.000106 if is_visual_mode | |
let w = winsaveview() | |
normal! gv | |
call winrestview(w) | |
call incsearch#highlight#emulate_visual_highlight() | |
endif | |
30 0.000026 endif | |
FUNCTION <SNR>111_split_by_keys() | |
Called 61 times | |
Total time: 0.002228 | |
Self time: 0.000676 | |
count total (s) self (s) | |
61 0.002188 0.000636 return s:_split_keystring(a:str, "\\%(\<Plug>\\|<Over>\\)(.\\{-})\\zs\\|") | |
FUNCTION 510() | |
Called 1 time | |
Total time: 0.000076 | |
Self time: 0.000010 | |
count total (s) self (s) | |
1 0.000002 let s:cmdline = a:cmdline | |
1 0.000072 0.000006 call s:doautocmd_user(self.prefix, self.prefix . 'ExecutePre') | |
FUNCTION 512() | |
Called 1 time | |
Total time: 0.000071 | |
Self time: 0.000010 | |
count total (s) self (s) | |
1 0.000003 let s:cmdline = a:cmdline | |
1 0.000066 0.000005 call s:doautocmd_user(self.prefix, self.prefix . 'Execute') | |
FUNCTION <SNR>110__is_valid_highlight() | |
Called 1 time | |
Total time: 0.000397 | |
Self time: 0.000029 | |
count total (s) self (s) | |
1 0.000377 0.000009 let highlight = s:Highlight.get(a:name) | |
1 0.000003 if empty(highlight) | |
return 0 | |
endif | |
1 0.000007 if has("gui_running") && (has_key(highlight, "guifg") || has_key(highlight, "guibg")) | |
return 1 | |
elseif (has_key(highlight, "ctermfg") || has_key(highlight, "ctermbg")) | |
1 0.000001 return 1 | |
endif | |
return 0 | |
FUNCTION vital#_incsearch#Over#Exception#import() | |
Called 1 time | |
Total time: 0.000021 | |
Self time: 0.000021 | |
count total (s) self (s) | |
1 0.000021 return map({'throw': '', 'throw_cmd': '', 'set_prefix': '', 'error': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>115__get_key() | |
Called 1 time | |
Total time: 0.000014 | |
Self time: 0.000014 | |
count total (s) self (s) | |
" call extend(l:, a:conf) | |
1 0.000004 let self = a:conf | |
1 0.000009 return get(a:conf, "expr", 0) ? s:_safe_eval(a:conf.key, l:) : a:conf.key | |
FUNCTION <SNR>115_unmapping() | |
Called 33 times | |
Total time: 0.004664 | |
Self time: 0.001161 | |
count total (s) self (s) | |
33 0.000242 let is_locking = get(a:, 1, 0) | |
33 0.001482 0.000239 let key = s:match_key(a:keymapping, a:key) | |
33 0.000073 if key == "" | |
31 0.002004 0.000414 return s:String.length(a:key) <= 1 ? a:key : s:unmapping(a:keymapping, a:key[0], is_locking) . s:unmapping(a:keymapping, a:key[1:], is_locking) | |
endif | |
2 0.000098 0.000030 let map_conf = s:as_key_config(a:keymapping[key]) | |
2 0.000023 let next_input = s:unmapping(a:keymapping, a:key[len(key) : ], is_locking) | |
2 0.000009 if map_conf.lock == 0 && is_locking | |
1 0.000003 return key . next_input | |
elseif map_conf.lock | |
return s:unmapping(a:keymapping, s:_get_key(map_conf), is_locking) . next_input | |
else | |
1 0.000032 0.000018 return s:unmapping(a:keymapping, s:_get_key(map_conf), map_conf.noremap) . next_input | |
endif | |
FUNCTION 521() | |
Called 1 time | |
Total time: 0.000008 | |
Self time: 0.000008 | |
count total (s) self (s) | |
1 0.000003 if has_key(self, "exception") | |
call self.message(a:cmdline) | |
unlet self.exception | |
endif | |
FUNCTION 527() | |
Called 30 times | |
Total time: 0.002976 | |
Self time: 0.000713 | |
count total (s) self (s) | |
30 0.002521 0.000487 if !a:cmdline.is_input("\<Up>") && !a:cmdline.is_input("\<Down>") && !a:cmdline.is_input("\<C-p>") && !a:cmdline.is_input("\<C-n>") | |
30 0.000377 0.000148 call s:_reset() | |
30 0.000038 return | |
else | |
if s:count == 0 && empty(s:cmdhist) || s:is_match_mode != s:_should_match_cmdline(a:cmdline) | |
let cmdline = '^' . a:cmdline.getline() | |
let s:is_match_mode = s:_should_match_cmdline(a:cmdline) | |
let s:cmdhist = [a:cmdline.getline()] + (s:is_match_mode ? filter(self.histories(), 'v:val =~ cmdline') : self.histories()) | |
endif | |
endif | |
call a:cmdline.setchar("") | |
if a:cmdline.is_input("\<Down>") || a:cmdline.is_input("\<C-n>") | |
let s:count = max([s:count - 1, 0]) | |
endif | |
if a:cmdline.is_input("\<Up>") || a:cmdline.is_input("\<C-p>") | |
let s:count = min([s:count + 1, len(s:cmdhist)]) | |
endif | |
call a:cmdline.setline(get(s:cmdhist, s:count, a:cmdline.getline())) | |
FUNCTION <SNR>104_deepextend() | |
Called 1 time | |
Total time: 0.000236 | |
Self time: 0.000236 | |
count total (s) self (s) | |
1 0.000005 let expr2 = copy(a:expr2) | |
11 0.000032 for [k, V] in items(a:expr1) | |
10 0.000078 if (type(V) is type({}) || type(V) is type([])) && has_key(expr2, k) | |
let a:expr1[k] = extend(a:expr1[k], expr2[k]) | |
unlet expr2[k] | |
endif | |
10 0.000012 unlet V | |
10 0.000012 endfor | |
1 0.000006 return extend(a:expr1, expr2) | |
FUNCTION vital#_incsearch#Palette#Keymapping#import() | |
Called 1 time | |
Total time: 0.000039 | |
Self time: 0.000039 | |
count total (s) self (s) | |
1 0.000037 return map({'capture': '', '_vital_depends': '', 'escape_special_key': '', 'rhs_key_list': '', 'parse_lhs_list': '', 'lhs_key_list': '', 'capture_list': '', 'parse_lhs': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION vital#_incsearch#Vim#Guard#import() | |
Called 1 time | |
Total time: 0.000022 | |
Self time: 0.000022 | |
count total (s) self (s) | |
1 0.000020 return map({'_vital_depends': '', '_vital_created': '', 'store': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>152__vital_loaded() | |
Called 1 time | |
Total time: 0.000757 | |
Self time: 0.000009 | |
count total (s) self (s) | |
1 0.000003 let s:V = a:V | |
1 0.000754 0.000006 let s:Tabpage = s:V.import("Gift.Tabpage") | |
FUNCTION 532() | |
Called 30 times | |
Total time: 0.000164 | |
Self time: 0.000164 | |
count total (s) self (s) | |
30 0.000146 return char2nr(a:char) == 128 || char2nr(a:char) < 27 | |
FUNCTION 537() | |
Called 1 time | |
Total time: 0.001221 | |
Self time: 0.000012 | |
count total (s) self (s) | |
1 0.001221 0.000012 let self._cmaps = s:_auto_cmap() | |
FUNCTION 538() | |
Called 30 times | |
Total time: 0.000092 | |
Self time: 0.000092 | |
count total (s) self (s) | |
30 0.000068 return self._cmaps | |
FUNCTION <SNR>112__compare() | |
Called 7083 times | |
Total time: 0.039455 | |
Self time: 0.039455 | |
count total (s) self (s) | |
7083 0.036565 return eval(s:expr) | |
FUNCTION <SNR>107__import() | |
Called 50 times | |
Total time: 0.093546 | |
Self time: 0.010541 | |
count total (s) self (s) | |
50 0.000173 if has_key(s:loaded, a:name) | |
11 0.000093 return copy(s:loaded[a:name]) | |
endif | |
39 0.032708 0.000236 let module = self._get_module(a:name) | |
39 0.000143 if has_key(module, '_vital_created') | |
1 0.000038 0.000009 call module._vital_created(module) | |
1 0.000001 endif | |
39 0.001271 let export_module = filter(copy(module), 'v:key =~# "^\\a"') | |
" Cache module before calling module.vital_loaded() to avoid cyclic | |
" dependences but remove the cache if module._vital_loaded() fails. | |
" let s:loaded[a:name] = export_module | |
39 0.000175 let s:loaded[a:name] = export_module | |
39 0.000122 if has_key(module, '_vital_loaded') | |
19 0.000034 try | |
19 0.001255 0.000902 call module._vital_loaded(vital#{s:plugin_name}#of()) | |
19 0.000024 catch | |
unlet s:loaded[a:name] | |
throw 'vital: fail to call ._vital_loaded(): ' . v:exception | |
endtry | |
19 0.000017 endif | |
39 0.000227 return copy(s:loaded[a:name]) | |
FUNCTION <SNR>137_escape_special_key() | |
Called 15 times | |
Total time: 0.000251 | |
Self time: 0.000251 | |
count total (s) self (s) | |
" Workaround : <C-?> https://github.com/osyo-manga/vital-palette/issues/5 | |
15 0.000033 if a:key ==# "<^?>" | |
5 0.000008 return "\<C-?>" | |
endif | |
10 0.000163 execute 'let result = "' . substitute(escape(a:key, '\"'), '\(<.\{-}>\)', '\\\1', 'g') . '"' | |
10 0.000015 return result | |
FUNCTION incsearch#_go() | |
Called 1 time | |
Total time: 1.680380 | |
Self time: 0.000228 | |
count total (s) self (s) | |
1 0.000019 0.000009 if s:U.is_visual(a:config.mode) && !a:config.is_expr | |
normal! gv | |
endif | |
1 0.047784 0.000149 let cli = incsearch#cli#make(a:config) | |
1 1.433552 0.000012 let input = s:get_input(cli) | |
1 0.000001 if cli._does_exit_from_incsearch | |
" Outer incsearch-plugin handle it so do not something in paticular | |
return cli._return_cmd | |
else | |
" After getting input, generate command, take aftercare, and return | |
" command. | |
1 0.000007 let l:F = function(cli._flag is# 'n' ? 's:stay' : 's:search') | |
1 0.002146 0.000010 let cmd = l:F(cli, input) | |
1 0.000002 if !a:config.is_expr | |
1 0.000003 let should_set_jumplist = (cli._flag !=# 'n') | |
1 0.196845 0.000014 call s:set_search_related_stuff(cli, cmd, should_set_jumplist) | |
1 0.000002 if a:config.mode is# 'no' | |
call s:set_vimrepeat(cmd) | |
endif | |
1 0.000001 endif | |
1 0.000001 return cmd | |
endif | |
FUNCTION 332() | |
Called 124 times | |
Total time: 0.001445 | |
Self time: 0.000660 | |
count total (s) self (s) | |
124 0.001356 0.000571 return self.line.str() | |
FUNCTION 333() | |
Called 30 times | |
Total time: 0.001512 | |
Self time: 0.000189 | |
count total (s) self (s) | |
30 0.001497 0.000174 return self.line.set(a:line) | |
FUNCTION 334() | |
Called 1277 times | |
Total time: 0.003065 | |
Self time: 0.003065 | |
count total (s) self (s) | |
1277 0.002514 return self.variables.char | |
FUNCTION 335() | |
Called 40 times | |
Total time: 0.000628 | |
Self time: 0.000628 | |
count total (s) self (s) | |
" 1 の場合は既に設定されていても上書きする | |
" 0 の場合は既に設定されていれば上書きしない | |
40 0.000188 let overwrite = get(a:, 1, 1) | |
40 0.000122 if overwrite || self.variables.is_setted == 0 | |
35 0.000091 let self.variables.input = a:char | |
35 0.000070 let self.variables.is_setted = 1 | |
35 0.000032 endif | |
FUNCTION 336() | |
Called 30 times | |
Total time: 0.000240 | |
Self time: 0.000160 | |
count total (s) self (s) | |
30 0.000215 0.000135 return self.line.pos() | |
FUNCTION 337() | |
Called 30 times | |
Total time: 0.000825 | |
Self time: 0.000165 | |
count total (s) self (s) | |
30 0.000797 0.000137 return self.line.set_pos(a:pos) | |
FUNCTION 541() | |
Called 1 time | |
Total time: 0.000003 | |
Self time: 0.000003 | |
count total (s) self (s) | |
1 0.000003 return g:incsearch#emacs_like_keymap | |
FUNCTION 542() | |
Called 1 time | |
Total time: 0.000003 | |
Self time: 0.000003 | |
count total (s) self (s) | |
1 0.000003 return g:incsearch#vim_cmdline_keymap | |
FUNCTION 543() | |
Called 1 time | |
Total time: 0.000003 | |
Self time: 0.000003 | |
count total (s) self (s) | |
1 0.000002 return g:incsearch#smart_backward_word | |
FUNCTION 544() | |
Called 1 time | |
Total time: 0.001778 | |
Self time: 0.000159 | |
count total (s) self (s) | |
1 0.000004 if !exists('s:default_backward_word') | |
1 0.000005 let s:default_backward_word = a:cmdline.backward_word | |
1 0.000001 endif | |
4 0.000006 for module in self.modules | |
3 0.000033 0.000024 if has_key(module, '_condition') && ! module._condition() | |
1 0.000076 0.000006 call a:cmdline.disconnect(module.name) | |
1 0.000003 if module.name ==# 'IgnoreRegexpBackwardWord' | |
function! a:cmdline.backward_word(...) abort | |
return call(s:default_backward_word, a:000, self) | |
endfunction | |
endif | |
1 0.000003 elseif empty(a:cmdline.get_module(module.name)) | |
2 0.000202 0.000011 call a:cmdline.connect(module) | |
2 0.000005 if has_key(module, 'on_enter') | |
2 0.001240 0.000014 call module.on_enter(a:cmdline) | |
2 0.000002 endif | |
2 0.000002 endif | |
3 0.000003 endfor | |
FUNCTION 545() | |
Called 154 times | |
Total time: 0.000729 | |
Self time: 0.000729 | |
count total (s) self (s) | |
" NOTE: to overwrite backward_word() with default function | |
154 0.000490 return a:event ==# 'on_enter' ? 5 : 0 | |
FUNCTION 546() | |
Called 1 time | |
Total time: 0.000023 | |
Self time: 0.000023 | |
count total (s) self (s) | |
1 0.000002 if ! g:incsearch#no_inc_hlsearch | |
1 0.000003 let self.pattern = @/ | |
1 0.000002 let self.hlsearch = &hlsearch | |
1 0.000004 if exists('v:hlsearch') | |
1 0.000002 let self.vhlsearch = v:hlsearch | |
1 0.000001 endif | |
1 0.000006 set hlsearch | nohlsearch | |
1 0.000001 endif | |
FUNCTION 547() | |
Called 1 time | |
Total time: 0.000029 | |
Self time: 0.000026 | |
count total (s) self (s) | |
1 0.000002 if ! g:incsearch#no_inc_hlsearch | |
1 0.000008 0.000005 let is_cancel = a:cmdline.exit_code() | |
1 0.000001 if is_cancel | |
let @/ = self.pattern | |
endif | |
1 0.000005 let &hlsearch = self.hlsearch | |
1 0.000003 if exists('v:hlsearch') | |
1 0.000002 let v:hlsearch = self.vhlsearch | |
1 0.000001 endif | |
1 0.000000 endif | |
FUNCTION 548() | |
Called 30 times | |
Total time: 0.031606 | |
Self time: 0.031606 | |
count total (s) self (s) | |
30 0.000074 let stack = [] | |
30 0.000050 let c = 1 | |
60 0.000098 while c | |
30 0.030472 let c = getchar(0) | |
30 0.000107 if c != 0 | |
let stack += [nr2char(c)] | |
elseif !empty(stack) | |
call a:cmdline.set_input_key_stack(stack) | |
endif | |
30 0.000041 endwhile | |
FUNCTION <SNR>137_capture_list() | |
Called 1 time | |
Total time: 0.000296 | |
Self time: 0.000043 | |
count total (s) self (s) | |
1 0.000004 let mode = get(a:, 1, "") | |
1 0.000291 0.000038 return filter(split(s:capture(mode), "\n"), "s:_keymapping(v:val)") | |
FUNCTION <SNR>129__vital_loaded() | |
Called 1 time | |
Total time: 0.000072 | |
Self time: 0.000012 | |
count total (s) self (s) | |
1 0.000003 let s:V = a:V | |
1 0.000067 0.000007 let s:String = s:V.import("Over.String") | |
FUNCTION <SNR>138__verbosefile_push() | |
Called 1 time | |
Total time: 0.000021 | |
Self time: 0.000021 | |
count total (s) self (s) | |
1 0.000005 call add(s:verbosefiles, &verbosefile) | |
1 0.000014 let &verbosefile = a:file | |
1 0.000002 return a:file | |
FUNCTION 473() | |
Called 30 times | |
Total time: 0.084341 | |
Self time: 0.002165 | |
count total (s) self (s) | |
30 0.000305 0.000181 if empty(a:cmdline.line.pos_char()) | |
30 0.000129 let cursor = "echohl " . a:cmdline.highlights.cursor . " | echon ' '" | |
30 0.000039 else | |
let cursor = "echohl " . a:cmdline.highlights.cursor_on . " | " . s:_as_echon(a:cmdline.line.pos_char()) | |
endif | |
30 0.000054 let suffix = "" | |
30 0.000219 0.000140 if a:cmdline.get_suffix() != "" | |
let suffix = s:_as_echon(s:suffix(a:cmdline.get_prompt() . a:cmdline.getline() . repeat(" ", empty(a:cmdline.line.pos_char())), a:cmdline.get_suffix())) | |
endif | |
30 0.002170 0.000828 let self.draw_command = join([ "echohl " . a:cmdline.highlights.prompt, s:_as_echon(a:cmdline.get_prompt()), "echohl NONE", s:_as_echon(a:cmdline.backward()), cursor, "echohl NONE", s:_as_echon(a:cmdline.forward()), suffix, ], " | ") | |
30 0.080854 0.000223 call s:_redraw(a:cmdline) | |
FUNCTION 373() | |
Called 1 time | |
Total time: 0.000004 | |
Self time: 0.000004 | |
count total (s) self (s) | |
1 0.000003 return join(self.variables.input_key_stack, "") | |
FUNCTION 340() | |
Called 1397 times | |
Total time: 0.003369 | |
Self time: 0.003369 | |
count total (s) self (s) | |
1397 0.002712 return self.variables.tap_key | |
FUNCTION 341() | |
Called 1367 times | |
Total time: 0.023102 | |
Self time: 0.016820 | |
count total (s) self (s) | |
1367 0.006164 let prekey = get(a:, 1, "") | |
1367 0.016065 0.009783 return self.get_tap_key() ==# prekey && self.char() ==# a:key | |
" \ && self.char() == (prekey . a:key) | |
FUNCTION 343() | |
Called 2 times | |
Total time: 0.000008 | |
Self time: 0.000008 | |
count total (s) self (s) | |
2 0.000007 let self.variables.prompt = a:prompt | |
FUNCTION 344() | |
Called 61 times | |
Total time: 0.000150 | |
Self time: 0.000150 | |
count total (s) self (s) | |
61 0.000118 return self.variables.prompt | |
FUNCTION 346() | |
Called 60 times | |
Total time: 0.000144 | |
Self time: 0.000144 | |
count total (s) self (s) | |
60 0.000118 return self.variables.suffix | |
FUNCTION 347() | |
Called 30 times | |
Total time: 0.001077 | |
Self time: 0.000363 | |
count total (s) self (s) | |
30 0.000060 if a:0 | |
call self.line.set(a:1) | |
endif | |
30 0.000865 0.000151 call self.line.input(a:word) | |
FUNCTION 348() | |
Called 30 times | |
Total time: 0.000292 | |
Self time: 0.000125 | |
count total (s) self (s) | |
30 0.000279 0.000112 return self.line.forward() | |
FUNCTION 349() | |
Called 30 times | |
Total time: 0.000459 | |
Self time: 0.000136 | |
count total (s) self (s) | |
30 0.000440 0.000117 return self.line.backward() | |
FUNCTION 475() | |
Called 1 time | |
Total time: 0.000012 | |
Self time: 0.000005 | |
count total (s) self (s) | |
1 0.000011 0.000004 call s:cmdheight.restore() | |
FUNCTION vital#_incsearch#Over#Commandline#Modules#InsertRegister#import() | |
Called 1 time | |
Total time: 0.000029 | |
Self time: 0.000029 | |
count total (s) self (s) | |
1 0.000028 return map({'_vital_depends': '', 'to_string': '', 'input': '', 'get_cmdline_cword': '', 'make': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION vital#_incsearch#Data#Dict#import() | |
Called 1 time | |
Total time: 0.000039 | |
Self time: 0.000039 | |
count total (s) self (s) | |
1 0.000038 return map({'pick': '', 'clear': '', 'max_by': '', 'foldl': '', 'swap': '', 'omit': '', 'min_by': '', 'foldr': '', 'make_index': '', 'make': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>103_set_search_reg() | |
Called 1 time | |
Total time: 0.000006 | |
Self time: 0.000006 | |
count total (s) self (s) | |
1 0.000005 let @/ = a:command is# '?' ? substitute(a:pattern, '\\?', '?', 'g') : a:pattern | |
FUNCTION 353() | |
Called 2 times | |
Total time: 0.000123 | |
Self time: 0.000026 | |
count total (s) self (s) | |
2 0.000115 0.000018 let slot = self.variables.modules.find_first_by("get(v:val.slot, 'name', '') == " . string(a:name)) | |
2 0.000008 return empty(slot) ? {} : slot.slot.module | |
FUNCTION 354() | |
Called 154 times | |
Total time: 1.397949 | |
Self time: 0.002627 | |
count total (s) self (s) | |
154 0.078325 0.001163 call self.variables.modules.sort_by("has_key(v:val.slot.module, 'priority') ? v:val.slot.module.priority('" . a:event . "') : 0") | |
154 1.319512 0.001352 return self.variables.modules.call(a:event, [self]) | |
" call map(filter(copy(self.variables.modules), "has_key(v:val, a:event)"), "v:val." . a:event . "(self)") | |
FUNCTION 358() | |
Called 30 times | |
Total time: 0.000331 | |
Self time: 0.000157 | |
count total (s) self (s) | |
30 0.000311 0.000137 return self.__keymapping__() | |
FUNCTION incsearch#over#modules#pattern_saver#make() | |
Called 1 time | |
Total time: 0.000007 | |
Self time: 0.000007 | |
count total (s) self (s) | |
1 0.000006 return deepcopy(s:pattern_saver) | |
FUNCTION incsearch#with_ignore_foldopen() | |
Called 30 times | |
Total time: 0.003439 | |
Self time: 0.001042 | |
count total (s) self (s) | |
30 0.000125 let foldopen_save = &foldopen | |
30 0.000186 let &foldopen='' | |
30 0.000058 try | |
30 0.002724 0.000327 return call(a:F, a:000) | |
finally | |
30 0.000194 let &foldopen = foldopen_save | |
30 0.000051 endtry | |
FUNCTION vital#_incsearch#Coaster#Highlight#import() | |
Called 1 time | |
Total time: 0.000079 | |
Self time: 0.000079 | |
count total (s) self (s) | |
1 0.000078 return map({'highlight': '', 'clear': '', 'delete': '', 'add': '', 'as_windo': '', '_vital_depends': '', 'get_hl_id': '', 'to_list': '', 'clear_all': '', 'delete_all': '', 'to_list_by': '', 'update': '', 'enable': '', 'delete_by': '', 'hl_list': '', 'make': '', 'enable_list': '', 'update_all': '', 'disable': '', 'disable_all': '', 'is_enabled': '', 'enable_all': '', 'is_added': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>103_get_input() | |
Called 1 time | |
Total time: 1.433540 | |
Self time: 0.000038 | |
count total (s) self (s) | |
" Handle visual mode highlight | |
1 0.000016 0.000006 if s:U.is_visual(a:cli._mode) | |
let visual_hl = incsearch#highlight#get_visual_hlobj() | |
try | |
call incsearch#highlight#turn_off(visual_hl) | |
call incsearch#highlight#emulate_visual_highlight(a:cli._mode, visual_hl) | |
let input = a:cli.get(a:cli._pattern) | |
finally | |
call incsearch#highlight#turn_on(visual_hl) | |
endtry | |
else | |
1 1.433501 0.000009 let input = a:cli.get(a:cli._pattern) | |
1 0.000001 endif | |
1 0.000001 return input | |
FUNCTION vital#_incsearch#Over#Commandline#Modules#Delete#import() | |
Called 1 time | |
Total time: 0.000011 | |
Self time: 0.000011 | |
count total (s) self (s) | |
1 0.000011 return map({'make': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>152_make_uniq_nr() | |
Called 1 time | |
Total time: 0.000005 | |
Self time: 0.000005 | |
count total (s) self (s) | |
1 0.000003 let s:uniq_counter += 1 | |
1 0.000002 return s:uniq_counter | |
FUNCTION 411() | |
Called 60 times | |
Total time: 0.000231 | |
Self time: 0.000231 | |
count total (s) self (s) | |
60 0.000202 return get(self.list, self.col, "") | |
FUNCTION 414() | |
Called 30 times | |
Total time: 0.000714 | |
Self time: 0.000714 | |
count total (s) self (s) | |
30 0.000375 call extend(self.list, split(a:str, '\zs'), self.col) | |
30 0.000252 let self.col += len(split(a:str, '\zs')) | |
30 0.000054 return self | |
FUNCTION 361() | |
Called 30 times | |
Total time: 0.135625 | |
Self time: 0.000456 | |
count total (s) self (s) | |
30 0.109572 0.000168 call self.callevent("on_draw_pre") | |
30 0.026031 0.000266 call self.callevent("on_draw") | |
FUNCTION 365() | |
Called 60 times | |
Total time: 0.000173 | |
Self time: 0.000173 | |
count total (s) self (s) | |
60 0.000137 return self.variables.enable_keymapping | |
FUNCTION 366() | |
Called 4 times | |
Total time: 0.000009 | |
Self time: 0.000009 | |
count total (s) self (s) | |
4 0.000008 return self.variables.exit_code | |
FUNCTION 367() | |
Called 1 time | |
Total time: 0.000109 | |
Self time: 0.000109 | |
count total (s) self (s) | |
1 0.000004 if exists("self.variables.old_guicursor") | |
1 0.000046 set guicursor& | |
1 0.000037 let &guicursor = self.variables.old_guicursor | |
1 0.000002 unlet self.variables.old_guicursor | |
1 0.000001 endif | |
1 0.000003 if exists("self.variables.old_t_ve") | |
1 0.000012 let &t_ve = self.variables.old_t_ve | |
1 0.000002 unlet self.variables.old_t_ve | |
1 0.000001 endif | |
FUNCTION 368() | |
Called 1 time | |
Total time: 0.000038 | |
Self time: 0.000038 | |
count total (s) self (s) | |
1 0.000005 if exists("self.variables.old_t_ve") | |
return | |
endif | |
1 0.000003 let self.variables.old_guicursor = &guicursor | |
1 0.000010 set guicursor=n:block-NONE | |
1 0.000004 let self.variables.old_t_ve = &t_ve | |
1 0.000011 set t_ve= | |
FUNCTION 369() | |
Called 1 time | |
Total time: 1.433452 | |
Self time: 0.000011 | |
count total (s) self (s) | |
1 1.433449 0.000008 let exit_code = call(self.__main, a:000, self) | |
1 0.000001 return exit_code | |
FUNCTION 570() | |
Called 91 times | |
Total time: 0.002965 | |
Self time: 0.001627 | |
count total (s) self (s) | |
91 0.001741 0.000403 call self.delete(a:name) | |
91 0.000423 let priority = get(a:, 1, 10) | |
91 0.000687 let self.variables.hl_list[a:name] = { "group" : a:group, "pattern" : a:pattern, "priority" : priority, "name" : a:name, } | |
FUNCTION 571() | |
Called 94 times | |
Total time: 0.000386 | |
Self time: 0.000386 | |
count total (s) self (s) | |
94 0.000337 return has_key(self.variables.hl_list, a:name) | |
FUNCTION 572() | |
Called 32 times | |
Total time: 0.000141 | |
Self time: 0.000141 | |
count total (s) self (s) | |
32 0.000124 return keys(self.variables.hl_list) | |
FUNCTION vital#_incsearch#Over#Commandline#Modules#Digraphs#import() | |
Called 1 time | |
Total time: 0.000027 | |
Self time: 0.000027 | |
count total (s) self (s) | |
1 0.000026 return map({'capture': '', '_vital_depends': '', 'digraph': '', 'make': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION 575() | |
Called 32 times | |
Total time: 0.001638 | |
Self time: 0.000491 | |
count total (s) self (s) | |
32 0.001410 0.000263 let window = get(a:, 1, s:Gift.uniq_winnr()) | |
32 0.000196 return keys(get(self.variables.id_list, window, {})) | |
FUNCTION 576() | |
Called 94 times | |
Total time: 0.001371 | |
Self time: 0.000985 | |
count total (s) self (s) | |
94 0.000837 0.000451 if !self.is_added(a:name) | |
3 0.000004 return -1 | |
endif | |
91 0.000252 unlet! self.variables.hl_list[a:name] | |
FUNCTION 578() | |
Called 1 time | |
Total time: 0.000060 | |
Self time: 0.000024 | |
count total (s) self (s) | |
4 0.000010 0.000007 for name in self.hl_list() | |
3 0.000041 0.000008 call self.delete(name) | |
3 0.000003 endfor | |
FUNCTION 579() | |
Called 273 times | |
Total time: 0.010971 | |
Self time: 0.003467 | |
count total (s) self (s) | |
273 0.009249 0.001745 let window = get(a:, 1, s:Gift.uniq_winnr()) | |
273 0.001523 return get(get(self.variables.id_list, window, {}), a:name, "") | |
FUNCTION incsearch#cli() | |
Called 1 time | |
Total time: 0.000034 | |
Self time: 0.000006 | |
count total (s) self (s) | |
1 0.000033 0.000005 return incsearch#cli#get() | |
FUNCTION <SNR>103_search() | |
Called 1 time | |
Total time: 0.002136 | |
Self time: 0.000144 | |
count total (s) self (s) | |
1 0.000316 0.000137 call incsearch#autocmd#auto_nohlsearch(1) " NOTE: `.` repeat doesn't handle this | |
1 0.001820 0.000007 return a:cli._generate_command(a:input) | |
FUNCTION 371() | |
Called 1 time | |
Total time: 1.433492 | |
Self time: 0.000033 | |
count total (s) self (s) | |
1 0.000004 let Old_execute = self.execute | |
1 0.000003 let self.execute = self.__empty | |
1 0.000001 try | |
1 1.433463 0.000011 let exit_code = call(self.start, a:000, self) | |
1 0.000002 if exit_code == 0 | |
1 0.000011 0.000004 return self.getline() | |
endif | |
finally | |
1 0.000003 let self.execute = Old_execute | |
1 0.000001 endtry | |
return "" | |
FUNCTION 372() | |
Called 90 times | |
Total time: 0.000224 | |
Self time: 0.000224 | |
count total (s) self (s) | |
90 0.000175 return self.variables.input_key_stack | |
FUNCTION <SNR>105_lazy_config() | |
Called 1 time | |
Total time: 0.000029 | |
Self time: 0.000020 | |
count total (s) self (s) | |
1 0.000005 let m = mode(1) | |
1 0.000024 0.000015 return { 'count': v:count, 'mode': m, 'is_expr': (m is# 'no'), 'keymap': s:keymap() } | |
FUNCTION 374() | |
Called 30 times | |
Total time: 0.000215 | |
Self time: 0.000215 | |
count total (s) self (s) | |
30 0.000125 let self.variables.input_key_stack = a:stack | |
30 0.000063 return self.variables.input_key_stack | |
FUNCTION 375() | |
Called 30 times | |
Total time: 0.000248 | |
Self time: 0.000181 | |
count total (s) self (s) | |
30 0.000228 0.000161 return remove(self.input_key_stack(), 0) | |
FUNCTION 377() | |
Called 1 time | |
Total time: 0.000082 | |
Self time: 0.000031 | |
count total (s) self (s) | |
1 0.000003 let self.variables.tap_key = "" | |
1 0.000002 let self.variables.char = "" | |
1 0.000001 let self.variables.input = "" | |
1 0.000002 let self.variables.exit = 0 | |
1 0.000002 let self.variables.exit_code = 1 | |
1 0.000002 let self.variables.enable_keymapping = 1 | |
1 0.000002 let self.variables.input_key_stack = [] | |
1 0.000068 0.000017 let self.line = deepcopy(s:String.make()) | |
FUNCTION 378() | |
Called 1 time | |
Total time: 0.000598 | |
Self time: 0.000081 | |
count total (s) self (s) | |
1 0.000087 0.000005 call self.__init_variables() | |
1 0.000051 0.000013 call self.hl_cursor_off() | |
1 0.000006 if !hlexists(self.highlights.cursor) | |
1 0.000407 0.000010 if s:_is_valid_highlight("Cursor") | |
1 0.000010 execute "highlight link " . self.highlights.cursor . " Cursor" | |
1 0.000001 else | |
" Workaround by CUI Vim Cursor Highlight | |
" issues #92 | |
" https://github.com/osyo-manga/vital-over/issues/92 | |
execute "highlight " . self.highlights.cursor . " term=reverse cterm=reverse gui=reverse" | |
endif | |
1 0.000001 endif | |
1 0.000004 if !hlexists(self.highlights.cursor_on) | |
1 0.000007 execute "highlight link " . self.highlights.cursor_on . " " . self.highlights.cursor | |
1 0.000001 endif | |
1 0.000003 if !hlexists(self.highlights.cursor_insert) | |
1 0.000010 execute "highlight " . self.highlights.cursor_insert . " cterm=underline term=underline gui=underline" | |
1 0.000001 endif | |
FUNCTION 651() | |
Called 1 time | |
Total time: 0.001813 | |
Self time: 0.000040 | |
count total (s) self (s) | |
1 0.000007 0.000005 let is_cancel = self.exit_code() | |
1 0.000001 if is_cancel | |
return s:U.is_visual(self._mode) ? '\<ESC>gv' : "\<ESC>" | |
else | |
1 0.001644 0.000006 call self._call_execute_event() | |
1 0.000067 0.000010 let [pattern, offset] = incsearch#parse_pattern(a:input, self._base_key) | |
" TODO: implement convert input method | |
1 0.000030 0.000008 let p = self._combine_pattern(self._convert(pattern), offset) | |
1 0.000058 0.000004 return self._build_search_cmd(p) | |
endif | |
FUNCTION 580() | |
Called 182 times | |
Total time: 0.014721 | |
Self time: 0.002308 | |
count total (s) self (s) | |
182 0.006284 0.001166 let window = get(a:, 1, s:Gift.uniq_winnr()) | |
182 0.008350 0.001055 return self.get_hl_id(a:name, window) != "" | |
FUNCTION 581() | |
Called 91 times | |
Total time: 0.013515 | |
Self time: 0.003792 | |
count total (s) self (s) | |
91 0.000402 let hl = get(self.variables.hl_list, a:name, {}) | |
91 0.000216 if empty(hl) | |
return -1 | |
endif | |
91 0.007610 0.000355 if self.is_enabled(a:name) | |
call self.disable(a:name) | |
endif | |
91 0.002926 0.000458 let winnr = s:Gift.uniq_winnr() | |
91 0.000363 if !has_key(self.variables.id_list, winnr) | |
1 0.000004 let self.variables.id_list[winnr] = {} | |
1 0.000001 endif | |
91 0.001106 let self.variables.id_list[winnr][a:name] = matchadd(hl.group, hl.pattern, hl.priority) | |
FUNCTION 582() | |
Called 31 times | |
Total time: 0.014659 | |
Self time: 0.001006 | |
count total (s) self (s) | |
122 0.000437 0.000299 for name in self.hl_list() | |
91 0.013940 0.000425 call self.enable(name) | |
91 0.000143 endfor | |
FUNCTION 583() | |
Called 91 times | |
Total time: 0.016499 | |
Self time: 0.002847 | |
count total (s) self (s) | |
91 0.007847 0.000381 if !self.is_enabled(a:name) | |
return -1 | |
endif | |
91 0.000179 let id = -1 | |
91 0.004362 0.000686 silent! let id = matchdelete(self.get_hl_id(a:name)) | |
91 0.000143 if id == -1 | |
return -1 | |
endif | |
91 0.003118 0.000608 let winnr = get(a:, 1, s:Gift.uniq_winnr()) | |
91 0.000339 unlet! self.variables.id_list[winnr][a:name] | |
FUNCTION 584() | |
Called 32 times | |
Total time: 0.019195 | |
Self time: 0.001058 | |
count total (s) self (s) | |
123 0.001956 0.000318 for name in self.enable_list() | |
91 0.016947 0.000448 call self.disable(name) | |
91 0.000125 endfor | |
FUNCTION vital#_incsearch#Over#Signals#import() | |
Called 1 time | |
Total time: 0.000024 | |
Self time: 0.000024 | |
count total (s) self (s) | |
1 0.000023 return map({'_vital_depends': '', 'call': '', 'make': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION airline#util#wrap() | |
Called 195 times | |
Total time: 0.001361 | |
Self time: 0.001361 | |
count total (s) self (s) | |
195 0.000573 if a:minwidth > 0 && winwidth(0) < a:minwidth | |
return '' | |
endif | |
195 0.000263 return a:text | |
FUNCTION incsearch#cli#set() | |
Called 1 time | |
Total time: 0.000061 | |
Self time: 0.000057 | |
count total (s) self (s) | |
1 0.000004 let a:cli._base_key = a:config.command | |
1 0.000005 let a:cli._vcount1 = max([1, a:config.count]) | |
1 0.000003 let a:cli._has_count = a:config.count > 0 | |
1 0.000002 let a:cli._is_expr = a:config.is_expr | |
1 0.000002 let a:cli._mode = a:config.mode | |
1 0.000003 let a:cli._pattern = a:config.pattern | |
1 0.000002 let a:cli._prompt = a:config.prompt | |
1 0.000002 let a:cli._keymap = a:config.keymap | |
1 0.000002 let a:cli._converters = a:config.converters | |
1 0.000004 let a:cli._flag = a:config.is_stay ? 'n' : a:config.command is# '/' ? '' : a:config.command is# '?' ? 'b' : '' | |
1 0.000004 let a:cli._direction = (a:cli._base_key is# '/' ? s:DIRECTION.forward : s:DIRECTION.backward) | |
" TODO: provide config? but it may conflict with <expr> mapping | |
" NOTE: _w: default cursor view | |
1 0.000005 let a:cli._w = winsaveview() | |
1 0.000002 for module in a:config.modules | |
call a:cli.connect(module) | |
endfor | |
1 0.000009 0.000005 call a:cli.set_prompt(a:cli._prompt) | |
1 0.000001 return a:cli | |
FUNCTION <SNR>137_capture() | |
Called 1 time | |
Total time: 0.000222 | |
Self time: 0.000033 | |
count total (s) self (s) | |
1 0.000005 let mode = get(a:, 1, "") | |
1 0.000010 let modes = split(mode, '\zs') | |
1 0.000206 0.000017 return join(map(modes, "s:_capture(v:val)"), "\n") | |
FUNCTION 381() | |
Called 30 times | |
Total time: 1.237227 | |
Self time: 0.001117 | |
count total (s) self (s) | |
30 0.000086 let char = a:char | |
30 0.000072 let self.variables.input_key = char | |
30 0.000068 let self.variables.char = char | |
30 0.000652 0.000160 call self.setchar(self.variables.char) | |
30 0.000059 let self.variables.is_setted = 0 | |
30 0.106820 0.000208 call self.callevent("on_char_pre") | |
30 0.001313 0.000236 call self.insert(self.variables.input) | |
30 1.128106 0.000177 call self.callevent("on_char") | |
FUNCTION 382() | |
Called 31 times | |
Total time: 1.245629 | |
Self time: 0.002648 | |
count total (s) self (s) | |
31 0.000092 if a:input == "" | |
1 0.000001 return | |
endif | |
30 0.000107 let self.variables.input_key = a:input | |
30 0.000045 if a:0 == 0 | |
let keymapping = self.__get_keymapping() | |
else | |
30 0.000069 let keymapping = a:1 | |
30 0.000033 endif | |
30 0.000230 0.000135 if self.is_enable_keymapping() | |
30 0.004340 0.000254 let key = s:Keymapping.unmapping(keymapping, a:input) | |
30 0.000053 else | |
let key = a:input | |
endif | |
30 0.000054 if key == "" | |
return | |
endif | |
30 0.001405 0.000315 call self.set_input_key_stack(s:String.split_by_keys(key)) | |
60 0.000839 0.000604 while !(empty(self.input_key_stack()) || self.is_exit()) | |
30 1.237732 0.000257 call self.__input_char(self.input_key_stack_pop()) | |
30 0.000041 endwhile | |
FUNCTION 383() | |
Called 30 times | |
Total time: 1.268454 | |
Self time: 0.002887 | |
count total (s) self (s) | |
30 0.000200 0.000122 if !self.is_enable_keymapping() | |
return self.__input(s:Input.getchar()) | |
endif | |
30 0.003458 0.000291 let input = s:Input.getchar() | |
30 0.000812 0.000322 let old_line = self.getline() | |
30 0.000413 0.000173 let old_pos = self.getpos() | |
30 0.012715 0.000183 let keymapping = self.__get_keymapping() | |
30 0.000067 try | |
30 0.000111 let t = reltime() | |
30 0.001435 0.000336 while s:is_input_waiting(keymapping, input) && str2nr(reltimestr(reltime(t))) * 1000 < &timeoutlen | |
call self.setline(old_line) | |
call self.insert(input) | |
call self.setpos(old_pos) | |
call self.draw() | |
let input .= s:Input.getchar(0) | |
endwhile | |
30 0.000053 finally | |
30 0.001694 0.000182 call self.setline(old_line) | |
30 0.001013 0.000188 call self.setpos(old_pos) | |
30 0.000051 endtry | |
30 1.245833 0.000209 call self.__input(input, keymapping) | |
FUNCTION 384() | |
Called 30 times | |
Total time: 1.420800 | |
Self time: 0.000847 | |
count total (s) self (s) | |
" call self.callevent("on_update") | |
" if !getchar(1) | |
" continue | |
" endif | |
" | |
" call self.__input(s:getchar(0)) | |
" call self.draw() | |
30 0.020596 0.000159 call self.callevent("on_update") | |
30 1.268689 0.000235 call self.__inputting() | |
" call self.__input(s:Input.getchar()) | |
30 0.000216 0.000148 if self.is_exit() | |
1 0.000001 return -1 | |
endif | |
29 0.131102 0.000108 call self.draw() | |
FUNCTION 385() | |
Called 1 time | |
Total time: 1.433441 | |
Self time: 0.000763 | |
count total (s) self (s) | |
1 0.000002 try | |
1 0.000603 0.000005 call self.__init() | |
1 0.003076 0.000009 call self.callevent("on_enter") | |
1 0.000015 0.000010 call self.__input(get(a:, 1, "")) | |
1 0.004636 0.000005 call self.draw() | |
30 0.000300 0.000201 while !self.is_exit() | |
30 0.000061 try | |
30 1.420953 0.000153 if self.__update() | |
1 0.000001 break | |
endif | |
29 0.000039 catch | |
call self.callevent("on_exception") | |
endtry | |
29 0.000031 endwhile | |
1 0.000001 catch | |
echohl ErrorMsg | echom v:throwpoint . " " . v:exception | echohl None | |
let self.variables.exit_code = -1 | |
finally | |
1 0.000121 0.000007 call self.__finish() | |
1 0.003367 0.000005 call self.callevent("on_leave") | |
1 0.000002 endtry | |
1 0.000007 0.000005 return self.exit_code() | |
FUNCTION 386() | |
Called 1 time | |
Total time: 0.000114 | |
Self time: 0.000005 | |
count total (s) self (s) | |
1 0.000114 0.000005 call self.hl_cursor_on() | |
FUNCTION 388() | |
Called 90 times | |
Total time: 0.000245 | |
Self time: 0.000245 | |
count total (s) self (s) | |
90 0.000202 return self.variables.exit | |
FUNCTION 389() | |
Called 30 times | |
Total time: 0.012532 | |
Self time: 0.008094 | |
count total (s) self (s) | |
30 0.000111 let result = {} | |
" for module in values(self.variables.modules) | |
690 0.005104 0.001089 for module in self.variables.modules.slots() | |
660 0.001607 if has_key(module, "keymapping") | |
60 0.000103 if module isnot self | |
30 0.000428 0.000336 call extend(result, module.keymapping(self)) | |
30 0.000032 endif | |
60 0.000059 endif | |
660 0.000624 endfor | |
30 0.000641 0.000310 return extend(extend(result, self.variables.keymapping), self.keymapping()) | |
FUNCTION <SNR>107__get_module() | |
Called 39 times | |
Total time: 0.032472 | |
Self time: 0.001331 | |
count total (s) self (s) | |
39 0.001224 0.000385 let funcname = s:_import_func_name(self.plugin_name(), a:name) | |
39 0.029347 0.000290 if s:_exists_autoload_func_with_source(funcname) | |
39 0.001863 0.000618 return call(funcname, []) | |
else | |
return s:_get_builtin_module(a:name) | |
endif | |
FUNCTION <SNR>111_make() | |
Called 1 time | |
Total time: 0.000051 | |
Self time: 0.000025 | |
count total (s) self (s) | |
1 0.000006 let default = get(a:, 1, "") | |
1 0.000009 let result = deepcopy(s:base) | |
1 0.000033 0.000007 call result.set(default) | |
1 0.000001 return result | |
FUNCTION vital#_incsearch#Over#Keymapping#import() | |
Called 1 time | |
Total time: 0.000028 | |
Self time: 0.000028 | |
count total (s) self (s) | |
1 0.000026 return map({'_vital_depends': '', 'unmapping': '', 'as_key_config': '', 'match_key': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION airline#extensions#whitespace#check() | |
Called 39 times | |
Total time: 0.000372 | |
Self time: 0.000372 | |
count total (s) self (s) | |
39 0.000280 if &readonly || !&modifiable || !s:enabled || line('$') > s:max_lines || get(b:, 'airline_whitespace_disabled', 0) | |
39 0.000057 return '' | |
endif | |
if !exists('b:airline_whitespace_check') | |
let b:airline_whitespace_check = '' | |
let checks = get(b:, 'airline_whitespace_checks', get(g:, 'airline#extensions#whitespace#checks', s:default_checks)) | |
let trailing = 0 | |
if index(checks, 'trailing') > -1 | |
try | |
let regexp = get(g:, 'airline#extensions#whitespace#trailing_regexp', '\s$') | |
let trailing = search(regexp, 'nw') | |
catch | |
echomsg 'airline#whitespace: error occured evaluating '. regexp | |
echomsg v:exception | |
return '' | |
endtry | |
endif | |
let mixed = 0 | |
let check = 'indent' | |
if index(checks, check) > -1 && index(get(s:skip_check_ft, &ft, []), check) < 0 | |
let mixed = s:check_mixed_indent() | |
endif | |
let mixed_file = '' | |
let check = 'mixed-indent-file' | |
if index(checks, check) > -1 && index(get(s:skip_check_ft, &ft, []), check) < 0 | |
let mixed_file = s:check_mixed_indent_file() | |
endif | |
let long = 0 | |
if index(checks, 'long') > -1 && &tw > 0 | |
let long = search('\%>'.&tw.'v.\+', 'nw') | |
endif | |
if trailing != 0 || mixed != 0 || long != 0 || !empty(mixed_file) | |
let b:airline_whitespace_check = s:symbol | |
if strlen(s:symbol) > 0 | |
let space = (g:airline_symbols.space) | |
else | |
let space = '' | |
endif | |
if s:show_message | |
if trailing != 0 | |
let b:airline_whitespace_check .= space.printf(s:trailing_format, trailing) | |
endif | |
if mixed != 0 | |
let b:airline_whitespace_check .= space.printf(s:mixed_indent_format, mixed) | |
endif | |
if long != 0 | |
let b:airline_whitespace_check .= space.printf(s:long_format, long) | |
endif | |
if !empty(mixed_file) | |
let b:airline_whitespace_check .= space.printf(s:mixed_indent_file_format, mixed_file) | |
endif | |
endif | |
endif | |
endif | |
return airline#util#shorten(b:airline_whitespace_check, 120, 9) | |
FUNCTION <SNR>109_default() | |
Called 1 time | |
Total time: 0.000152 | |
Self time: 0.000009 | |
count total (s) self (s) | |
1 0.000152 0.000009 return call(s:Cmdline.make, a:000, s:Cmdline) | |
FUNCTION <SNR>124__as_echon() | |
Called 90 times | |
Total time: 0.000513 | |
Self time: 0.000513 | |
count total (s) self (s) | |
90 0.000457 return "echon " . strtrans(string(a:str)) | |
FUNCTION <SNR>116__vital_loaded() | |
Called 1 time | |
Total time: 0.000004 | |
Self time: 0.000004 | |
count total (s) self (s) | |
1 0.000004 let s:V = a:V | |
FUNCTION <SNR>138__verbosefile_pop() | |
Called 1 time | |
Total time: 0.000028 | |
Self time: 0.000028 | |
count total (s) self (s) | |
1 0.000003 let filename = &verbosefile | |
1 0.000017 let &verbosefile = get(s:verbosefiles, -1) | |
1 0.000004 call remove(s:verbosefiles, -1) | |
1 0.000001 return filename | |
FUNCTION <SNR>123_make() | |
Called 1 time | |
Total time: 0.000005 | |
Self time: 0.000005 | |
count total (s) self (s) | |
1 0.000004 return deepcopy(s:module) | |
FUNCTION 526() | |
Called 1 time | |
Total time: 0.000022 | |
Self time: 0.000014 | |
count total (s) self (s) | |
1 0.000022 0.000014 call s:_reset() | |
FUNCTION <SNR>131_make() | |
Called 1 time | |
Total time: 0.000226 | |
Self time: 0.000226 | |
count total (s) self (s) | |
1 0.000004 if has_key(s:cache_command, a:prefix) | |
unlet! s:cache_command[a:prefix] | |
endif | |
1 0.000007 execute "augroup " a:prefix . "-vital-over-commandline-doautocmd-dummy" | |
1 0.000196 autocmd! | |
1 0.000002 augroup END | |
1 0.000007 let module = deepcopy(s:module) | |
1 0.000002 let module.prefix = a:prefix | |
1 0.000001 return module | |
FUNCTION <SNR>125_make() | |
Called 1 time | |
Total time: 0.000013 | |
Self time: 0.000013 | |
count total (s) self (s) | |
1 0.000005 let result = deepcopy(s:module) | |
1 0.000005 let result.exit_code = get(a:, 1, 0) | |
1 0.000001 return result | |
FUNCTION <SNR>119_make() | |
Called 1 time | |
Total time: 0.000006 | |
Self time: 0.000006 | |
count total (s) self (s) | |
1 0.000006 return deepcopy(s:module) | |
FUNCTION incsearch#highlight#incremental_highlight() | |
Called 30 times | |
Total time: 0.041466 | |
Self time: 0.003341 | |
count total (s) self (s) | |
30 0.000231 let should_separate_highlight = get(a:, 1, s:FALSE) | |
30 0.000162 let direction = get(a:, 2, s:DIRECTION.forward) | |
30 0.000245 let start_pos = get(a:, 3, getpos('.')[1:2]) | |
30 0.001994 0.000185 let hgm = incsearch#highlight#hgm() | |
30 0.000165 let [m, r, o, c] = [hgm.match, hgm.match_reverse, hgm.on_cursor, hgm.cursor] | |
30 0.000114 let on_cursor_pattern = '\m\%#\(' . a:pattern . '\m\)' | |
30 0.000193 if '' =~# a:pattern | |
" Do not highlight for patterns which match everything | |
call s:hi.delete_all() | |
elseif ! should_separate_highlight | |
30 0.001395 0.000259 call s:hi.add(m.group, m.group, a:pattern, m.priority) | |
30 0.000067 if ! g:incsearch#no_inc_hlsearch | |
30 0.000082 let @/ = a:pattern | |
30 0.000187 let &hlsearch = &hlsearch | |
30 0.000044 endif | |
30 0.000024 else | |
let [p1, p2] = (direction == s:DIRECTION.forward) ? [incsearch#highlight#forward_pattern(a:pattern, start_pos) ,incsearch#highlight#backward_pattern(a:pattern, start_pos)] : [incsearch#highlight#backward_pattern(a:pattern, start_pos) ,incsearch#highlight#forward_pattern(a:pattern, start_pos)] | |
call s:hi.add(m.group , m.group , p1 , m.priority) " right direction | |
call s:hi.add(r.group , r.group , p2 , r.priority) " reversed direction | |
endif | |
30 0.001160 0.000213 call s:hi.add(o.group , o.group , on_cursor_pattern , o.priority) | |
30 0.001045 0.000194 call s:hi.add(c.group , c.group , '\v%#' , c.priority) | |
30 0.033548 0.000166 call incsearch#highlight#update() | |
FUNCTION <SNR>116_get() | |
Called 16 times | |
Total time: 0.016950 | |
Self time: 0.000309 | |
count total (s) self (s) | |
16 0.000061 if exists("s:" . a:name) | |
return s:{a:name} | |
endif | |
16 0.016788 0.000147 let s:{a:name} = s:V.import('Over.Commandline.Modules.' . a:name) | |
16 0.000046 return s:{a:name} | |
FUNCTION <SNR>133_make() | |
Called 1 time | |
Total time: 0.000022 | |
Self time: 0.000022 | |
count total (s) self (s) | |
1 0.000006 let result = deepcopy(s:module) | |
1 0.000008 let result.prefix = get(a:, 1, "vital-over(".s:vname.") Exception") | |
1 0.000005 let result.command = get(a:, 2, "echom") | |
1 0.000002 return result | |
FUNCTION <SNR>107_import() | |
Called 50 times | |
Total time: 0.096000 | |
Self time: 0.001868 | |
count total (s) self (s) | |
50 0.000127 let target = {} | |
50 0.000102 let functions = [] | |
50 0.000137 for a in a:000 | |
if type(a) == type({}) | |
let target = a | |
elseif type(a) == type([]) | |
let functions = a | |
endif | |
unlet a | |
endfor | |
50 0.036661 0.019001 let module = self._import(a:name) | |
50 0.000119 if empty(functions) | |
50 0.000318 call extend(target, module, 'keep') | |
50 0.000057 else | |
for f in functions | |
if has_key(module, f) && !has_key(target, f) | |
let target[f] = module[f] | |
endif | |
endfor | |
endif | |
50 0.000067 return target | |
FUNCTION airline#util#append() | |
Called 234 times | |
Total time: 0.002968 | |
Self time: 0.002968 | |
count total (s) self (s) | |
234 0.000647 if a:minwidth > 0 && winwidth(0) < a:minwidth | |
return '' | |
endif | |
234 0.000852 let prefix = s:spc == "\ua0" ? s:spc : s:spc.s:spc | |
234 0.000768 return empty(a:text) ? '' : prefix.g:airline_left_alt_sep.s:spc.a:text | |
FUNCTION <SNR>135_make() | |
Called 1 time | |
Total time: 0.000015 | |
Self time: 0.000015 | |
count total (s) self (s) | |
1 0.000006 let module = deepcopy(s:module) | |
1 0.000006 let module.chars = type(a:chars) == type([]) ? a:chars : [a:chars] | |
1 0.000002 return module | |
FUNCTION <SNR>117_parse() | |
Called 1 time | |
Total time: 0.000284 | |
Self time: 0.000249 | |
count total (s) self (s) | |
1 0.000003 let highlight = a:highlight | |
1 0.000011 if highlight !~# '^\w\+\s\+xxx\s' | |
return {} | |
endif | |
1 0.000019 0.000008 let name = s:parse_to_name(a:highlight) | |
1 0.000004 let result = { "_name" : name } | |
1 0.000012 if highlight =~# '^\w\+\s\+xxx cleared' | |
let result.cleared = 1 | |
return result | |
endif | |
1 0.000033 0.000009 let link = s:links_to(highlight) | |
1 0.000003 if link != "" | |
let result.link = link | |
return result | |
endif | |
1 0.000005 let attrs = [ "term", "cterm", "ctermfg", "ctermbg", "gui", "font", "guifg", "guibg", "guisp", ] | |
10 0.000012 for attr in attrs | |
9 0.000104 let item = matchstr(highlight, '\s' . attr . '=\zs#\?\w\+\ze') | |
9 0.000017 if item != "" | |
4 0.000012 let result[attr] = item | |
4 0.000004 endif | |
9 0.000008 endfor | |
1 0.000002 return result | |
FUNCTION <SNR>145__vital_loaded() | |
Called 1 time | |
Total time: 0.008791 | |
Self time: 0.000028 | |
count total (s) self (s) | |
1 0.000003 let s:V = a:V | |
1 0.005468 0.000006 let s:Window = a:V.import("Coaster.Window") | |
1 0.002871 0.000011 let s:Gift = a:V.import("Gift") | |
1 0.000449 0.000008 call s:_init() | |
FUNCTION <SNR>138_command() | |
Called 1 time | |
Total time: 0.000163 | |
Self time: 0.000114 | |
count total (s) self (s) | |
" Workaround : Vim 7.3.xxx in Travis and Ubuntu | |
" https://github.com/osyo-manga/vital-palette/issues/5 | |
" call extend(l:, get(a:, 1, {})) | |
1 0.000002 if a:0 > 0 | |
call s:extend(l:, a:1) | |
endif | |
1 0.000055 0.000034 call s:_verbosefile_push(tempname()) | |
1 0.000002 try | |
1 0.000003 redir =>result | |
1 0.000043 silent execute a:cmd | |
1 0.000002 finally | |
1 0.000003 redir END | |
1 0.000002 endtry | |
1 0.000041 0.000013 call s:_verbosefile_pop() | |
" let result = substitute(result, "<SRN>", "\<SNR>", "g") | |
" let result = substitute(result, "<SID>", "\<SID>", "g") | |
1 0.000002 return result | |
FUNCTION <SNR>115__vital_loaded() | |
Called 1 time | |
Total time: 0.000082 | |
Self time: 0.000022 | |
count total (s) self (s) | |
1 0.000004 let s:V = a:V | |
1 0.000077 0.000017 let s:String = s:V.import("Over.String") | |
FUNCTION <SNR>145_make() | |
Called 1 time | |
Total time: 0.000465 | |
Self time: 0.000020 | |
count total (s) self (s) | |
1 0.000011 let result = deepcopy(s:base) | |
1 0.000451 0.000006 let result.windo = s:Window.as_windo(result) | |
1 0.000001 return result | |
FUNCTION <SNR>151__vital_loaded() | |
Called 1 time | |
Total time: 0.001849 | |
Self time: 0.000019 | |
count total (s) self (s) | |
1 0.000003 let s:V = a:V | |
1 0.001787 0.000008 let s:Window = s:V.import("Gift.Window") | |
1 0.000059 0.000008 let s:Tabpage = s:V.import("Gift.Tabpage") | |
FUNCTION <SNR>139_make() | |
Called 1 time | |
Total time: 0.000005 | |
Self time: 0.000005 | |
count total (s) self (s) | |
1 0.000004 return deepcopy(s:module) | |
FUNCTION vital#_incsearch#Over#Commandline#Modules#DrawCommandline#import() | |
Called 1 time | |
Total time: 0.000016 | |
Self time: 0.000016 | |
count total (s) self (s) | |
1 0.000016 return map({'suffix': '', 'make': ''}, 'function("s:" . v:key)') | |
FUNCTION vital#_incsearch#Over#Commandline#import() | |
Called 1 time | |
Total time: 0.000040 | |
Self time: 0.000040 | |
count total (s) self (s) | |
1 0.000039 return map({'_vital_depends': '', 'make_standard_search_back': '', 'get_module': '', 'make_standard_search': '', 'make_standard': '', 'make_module': '', 'make_default': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION vital#_incsearch#Vim#Buffer#import() | |
Called 1 time | |
Total time: 0.000035 | |
Self time: 0.000035 | |
count total (s) self (s) | |
1 0.000034 return map({'_vital_depends': '', 'read_content': '', 'get_selected_text': '', 'is_cmdwin': '', 'edit_content': '', 'open': '', 'get_last_selected': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION vital#_incsearch#Over#Commandline#Base#import() | |
Called 1 time | |
Total time: 0.000028 | |
Self time: 0.000028 | |
count total (s) self (s) | |
1 0.000028 return map({'_vital_depends': '', 'make_plain': '', 'is_input_waiting': '', 'make': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION vital#_incsearch#Vim#Message#import() | |
Called 1 time | |
Total time: 0.000030 | |
Self time: 0.000030 | |
count total (s) self (s) | |
1 0.000030 return map({'capture': '', 'echomsg': '', 'echo': '', 'warn': '', 'get_hit_enter_max_length': '', 'error': ''}, 'function("s:" . v:key)') | |
FUNCTION incsearch#cli#get() | |
Called 1 time | |
Total time: 0.000028 | |
Self time: 0.000020 | |
count total (s) self (s) | |
1 0.000001 try | |
" It returns current cli object | |
1 0.000019 0.000011 return s:Doautocmd.get_cmdline() | |
catch /vital-over(_incsearch) Exception/ | |
" If there are no current cli object, return default one | |
return incsearch#cli#make(incsearch#config#make({})) | |
endtry | |
FUNCTION incsearch#over#modules#bulk_input_char#make() | |
Called 1 time | |
Total time: 0.000006 | |
Self time: 0.000006 | |
count total (s) self (s) | |
1 0.000005 return deepcopy(s:bulk_input_char) | |
FUNCTION vital#_incsearch#Prelude#import() | |
Called 1 time | |
Total time: 0.000099 | |
Self time: 0.000099 | |
count total (s) self (s) | |
1 0.000098 return map({'escape_pattern': '', 'is_funcref': '', 'path2directory': '', 'wcswidth': '', 'is_string': '', 'input_helper': '', 'is_number': '', 'is_cygwin': '', 'path2project_directory': '', 'strwidthpart_reverse': '', 'input_safe': '', 'is_list': '', 'truncate_skipping': '', 'glob': '', 'truncate': '', 'is_dict': '', 'set_default': '', 'is_numeric': '', 'getchar_safe': '', 'substitute_path_separator': '', 'is_mac': '', 'strwidthpart': '', 'getchar': '', 'is_unix': '', 'is_windows': '', 'globpath': '', 'escape_file_searching': '', 'is_float': '', 'smart_execute_command': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>107__function() | |
Called 9 times | |
Total time: 0.000055 | |
Self time: 0.000055 | |
count total (s) self (s) | |
9 0.000048 return function(a:fstr) | |
FUNCTION airline#parts#ffenc() | |
Called 39 times | |
Total time: 0.001294 | |
Self time: 0.001294 | |
count total (s) self (s) | |
39 0.000199 let expected = get(g:, 'airline#parts#ffenc#skip_expected_string', '') | |
39 0.000118 let bomb = &l:bomb ? '[BOM]' : '' | |
39 0.000445 let ff = strlen(&ff) ? '['.&ff.']' : '' | |
39 0.000226 if expected is# &fenc.bomb.ff | |
return '' | |
else | |
39 0.000168 return &fenc.bomb.ff | |
endif | |
FUNCTION <SNR>143_on_char_pre() | |
Called 30 times | |
Total time: 0.013366 | |
Self time: 0.005206 | |
count total (s) self (s) | |
" NOTE: | |
" `:call a:cmdline.setchar('')` as soon as possible! | |
30 0.003468 0.000221 let [raw_pattern, offset] = a:cmdline._parse_pattern() | |
30 0.000861 0.000244 let pattern = a:cmdline._convert(raw_pattern) | |
" Interactive :h last-pattern if pattern is empty | |
30 0.001476 0.000326 if ( a:cmdline.is_input('<Over>(incsearch-next)') || a:cmdline.is_input('<Over>(incsearch-prev)') ) && empty(pattern) | |
call a:cmdline.setchar('') | |
" Use history instead of @/ to work with magic option and converter | |
call a:cmdline.setline(histget('/', -1) . (empty(offset) ? '' : a:cmdline._base_key) . offset) | |
" Just insert last-pattern and do not count up, but the incsearch-prev | |
" should move the cursor to reversed directly, so do not return if the | |
" command is prev | |
if a:cmdline.is_input('<Over>(incsearch-next)') | return | endif | |
endif | |
30 0.000710 0.000148 if a:cmdline.is_input('<Over>(incsearch-next)') | |
call a:cmdline.setchar('') | |
if a:cmdline._flag ==# 'n' " exit stay mode | |
let a:cmdline._flag = '' | |
else | |
let a:cmdline._vcount1 += 1 | |
endif | |
elseif a:cmdline.is_input('<Over>(incsearch-prev)') | |
call a:cmdline.setchar('') | |
if a:cmdline._flag ==# 'n' " exit stay mode | |
let a:cmdline._flag = '' | |
endif | |
let a:cmdline._vcount1 -= 1 | |
elseif (a:cmdline.is_input('<Over>(incsearch-scroll-f)') && (a:cmdline._flag ==# '' || a:cmdline._flag ==# 'n')) || (a:cmdline.is_input('<Over>(incsearch-scroll-b)') && a:cmdline._flag ==# 'b') | |
call a:cmdline.setchar('') | |
if a:cmdline._flag ==# 'n' | let a:cmdline._flag = '' | endif | |
let pos_expr = a:cmdline.is_input('<Over>(incsearch-scroll-f)') ? 'w$' : 'w0' | |
let to_col = a:cmdline.is_input('<Over>(incsearch-scroll-f)') ? s:U.get_max_col(pos_expr) : 1 | |
let [from, to] = [getpos('.')[1:2], [line(pos_expr), to_col]] | |
let cnt = s:U.count_pattern(pattern, from, to) | |
let a:cmdline._vcount1 += cnt | |
elseif (a:cmdline.is_input('<Over>(incsearch-scroll-b)') && (a:cmdline._flag ==# '' || a:cmdline._flag ==# 'n')) || (a:cmdline.is_input('<Over>(incsearch-scroll-f)') && a:cmdline._flag ==# 'b') | |
call a:cmdline.setchar('') | |
if a:cmdline._flag ==# 'n' | |
let a:cmdline._flag = '' | |
let a:cmdline._vcount1 -= 1 | |
endif | |
let pos_expr = a:cmdline.is_input('<Over>(incsearch-scroll-f)') ? 'w$' : 'w0' | |
let to_col = a:cmdline.is_input('<Over>(incsearch-scroll-f)') ? s:U.get_max_col(pos_expr) : 1 | |
let [from, to] = [getpos('.')[1:2], [line(pos_expr), to_col]] | |
let cnt = s:U.count_pattern(pattern, from, to) | |
let a:cmdline._vcount1 -= cnt | |
endif | |
" Handle nowrapscan: | |
" if you `:set nowrapscan`, you can't move to the reversed direction | |
30 0.000228 if !&wrapscan && ( a:cmdline.is_input('<Over>(incsearch-next)') || a:cmdline.is_input('<Over>(incsearch-prev)') || a:cmdline.is_input('<Over>(incsearch-scroll-f)') || a:cmdline.is_input('<Over>(incsearch-scroll-b)') ) | |
if a:cmdline._vcount1 < 1 | |
let a:cmdline._vcount1 = 1 | |
else | |
call a:cmdline.setchar('') | |
let [from, to] = [[a:cmdline._w.lnum, a:cmdline._w.col + 1], a:cmdline._flag !=# 'b' ? [line('$'), s:U.get_max_col('$')] : [1, 1] ] | |
let max_cnt = s:U.count_pattern(pattern, from, to, s:TRUE) | |
let a:cmdline._vcount1 = min([max_cnt, a:cmdline._vcount1]) | |
endif | |
endif | |
30 0.000078 if &wrapscan && a:cmdline._vcount1 < 1 | |
let a:cmdline._vcount1 += s:U.count_pattern(pattern) | |
endif | |
FUNCTION <SNR>104_is_visual() | |
Called 66 times | |
Total time: 0.000623 | |
Self time: 0.000623 | |
count total (s) self (s) | |
66 0.000574 return a:mode =~# "[vV\<C-v>]" | |
FUNCTION <SNR>146__vital_loaded() | |
Called 1 time | |
Total time: 0.004618 | |
Self time: 0.000011 | |
count total (s) self (s) | |
1 0.000003 let s:V = a:V | |
1 0.004613 0.000006 let s:Buffer = a:V.import("Vim.Buffer") | |
FUNCTION <SNR>146_as_windo() | |
Called 2 times | |
Total time: 0.000875 | |
Self time: 0.000875 | |
count total (s) self (s) | |
2 0.000006 let windo = {} | |
2 0.000004 let windo.obj = a:base | |
46 0.000124 for [key, Value] in items(a:base) | |
44 0.000202 if type(function("tr")) == type(Value) | |
42 0.000354 execute "function! windo.". key. "(...)\n" " return s:windo(self.obj." . key . ", a:000, self.obj)\n" "endfunction" | |
42 0.000039 endif | |
44 0.000047 unlet Value | |
44 0.000038 endfor | |
2 0.000011 return windo | |
FUNCTION vital#_incsearch#Palette#Capture#import() | |
Called 1 time | |
Total time: 0.000015 | |
Self time: 0.000015 | |
count total (s) self (s) | |
1 0.000014 return map({'extend': '', 'command': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>131_doautocmd_user() | |
Called 124 times | |
Total time: 0.008275 | |
Self time: 0.005702 | |
count total (s) self (s) | |
124 0.000508 let group = a:prefix . "-vital-over-commandline-doautocmd-dummy" | |
124 0.000462 if !has_key(s:cache_command, a:prefix) | |
1 0.000004 let s:cache_command[a:prefix] = {} | |
1 0.000001 endif | |
124 0.000503 if !has_key(s:cache_command[a:prefix], a:command) | |
8 0.000130 execute "autocmd " . group . " User " . a:command." silent! execute ''" | |
8 0.000030 if v:version > 703 || v:version == 703 && has("patch438") | |
8 0.000046 let s:cache_command[a:prefix][a:command] = "doautocmd <nomodeline> User " . a:command | |
8 0.000009 else | |
let s:cache_command[a:prefix][a:command] = "doautocmd User " . a:command | |
endif | |
8 0.000007 endif | |
124 0.004332 0.001759 execute s:cache_command[a:prefix][a:command] | |
FUNCTION <SNR>107_plugin_name() | |
Called 39 times | |
Total time: 0.000100 | |
Self time: 0.000100 | |
count total (s) self (s) | |
39 0.000084 return self._plugin_name | |
FUNCTION <SNR>111__clamp() | |
Called 34 times | |
Total time: 0.000216 | |
Self time: 0.000216 | |
count total (s) self (s) | |
34 0.000198 return min([max([a:x, a:max]), a:min]) | |
FUNCTION airline#parts#paste() | |
Called 39 times | |
Total time: 0.000155 | |
Self time: 0.000155 | |
count total (s) self (s) | |
39 0.000131 return g:airline_detect_paste && &paste ? g:airline_symbols.paste : '' | |
FUNCTION vital#_incsearch#Palette#Highlight#import() | |
Called 1 time | |
Total time: 0.000039 | |
Self time: 0.000039 | |
count total (s) self (s) | |
1 0.000038 return map({'capture': '', '_vital_depends': '', 'parse': '', 'group_list': '', 'set': '', 'parse_to_name': '', 'links_to': '', 'get': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>113_make() | |
Called 1 time | |
Total time: 0.000011 | |
Self time: 0.000011 | |
count total (s) self (s) | |
1 0.000008 let result = deepcopy(s:base) | |
1 0.000002 return result | |
FUNCTION vital#_incsearch#Over#Commandline#Modules#ExceptionMessage#import() | |
Called 1 time | |
Total time: 0.000011 | |
Self time: 0.000011 | |
count total (s) self (s) | |
1 0.000011 return map({'make': ''}, 'function("s:" . v:key)') | |
FUNCTION 531() | |
Called 30 times | |
Total time: 0.000640 | |
Self time: 0.000335 | |
count total (s) self (s) | |
30 0.000435 0.000195 if self.is_no_insert(a:cmdline.char()) | |
5 0.000089 0.000024 call a:cmdline.setchar("", 0) | |
5 0.000004 endif | |
FUNCTION airline#parts#readonly() | |
Called 39 times | |
Total time: 0.000383 | |
Self time: 0.000383 | |
count total (s) self (s) | |
39 0.000165 if &readonly && &modifiable && !filereadable(bufname('%')) | |
return '[noperm]' | |
else | |
39 0.000077 return &readonly ? g:airline_symbols.readonly : '' | |
endif | |
FUNCTION <SNR>103__echohl() | |
Called 1 time | |
Total time: 0.001550 | |
Self time: 0.001550 | |
count total (s) self (s) | |
1 0.000004 let echocmd = get(a:, 1, 'echo') | |
1 0.001522 redraw | echo '' | |
1 0.000008 exec 'echohl' a:hlgroup | |
1 0.000014 exec echocmd string(a:msg) | |
1 0.000001 echohl None | |
FUNCTION <SNR>117_parse_to_name() | |
Called 1 time | |
Total time: 0.000011 | |
Self time: 0.000011 | |
count total (s) self (s) | |
1 0.000010 return matchstr(a:highlight, '^\zs\w\+\ze') | |
FUNCTION 646() | |
Called 1 time | |
Total time: 0.000442 | |
Self time: 0.000056 | |
count total (s) self (s) | |
1 0.000002 nohlsearch " disable previous highlight | |
1 0.000007 let a:cmdline._w = winsaveview() | |
1 0.000058 0.000007 let hgm = incsearch#highlight#hgm() | |
1 0.000002 let c = hgm.cursor | |
1 0.000040 0.000009 call s:hi.add(c.group, c.group, '\%#', c.priority) | |
1 0.000304 0.000008 call incsearch#highlight#update() | |
" XXX: Manipulate search history for magic option | |
" In the first place, I want to omit magic flag when histadd(), but | |
" when returning cmd as expr mapping and feedkeys() cannot handle it, so | |
" remove no user intended magic flag at on_enter. | |
" Maybe I can also handle it with autocmd, should I use autocmd instead? | |
1 0.000004 let hist = histget('/', -1) | |
1 0.000017 0.000009 if len(hist) > 2 && hist[:1] ==# incsearch#magic() | |
call histdel('/', -1) | |
call histadd('/', hist[2:]) | |
endif | |
FUNCTION <SNR>118_capture() | |
Called 1 time | |
Total time: 0.000026 | |
Self time: 0.000026 | |
count total (s) self (s) | |
1 0.000002 try | |
1 0.000003 redir => out | |
1 0.000013 silent execute a:command | |
1 0.000001 finally | |
1 0.000002 redir END | |
1 0.000001 endtry | |
1 0.000002 return out | |
FUNCTION vital#_incsearch#Over#Commandline#Modules#LiteralInsert#import() | |
Called 1 time | |
Total time: 0.000011 | |
Self time: 0.000011 | |
count total (s) self (s) | |
1 0.000010 return map({'make': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>124__redraw() | |
Called 30 times | |
Total time: 0.080631 | |
Self time: 0.079841 | |
count total (s) self (s) | |
30 0.000808 0.000369 let left = a:cmdline.get_prompt() . a:cmdline.getline() . (empty(a:cmdline.line.pos_char()) ? " " : "") | |
30 0.000129 let width = len(left) + 1 | |
30 0.000196 0.000131 if a:cmdline.get_suffix() != "" | |
let width += len(s:suffix(left, a:cmdline.get_suffix())) - 1 | |
endif | |
30 0.000114 if &columns >= width && &columns <= s:old_width && s:old_width >= width | |
redraw | |
normal! : | |
elseif &columns <= width | |
normal! : | |
else | |
30 0.077710 redraw | |
30 0.000056 endif | |
30 0.000097 let s:old_width = width | |
30 0.000404 0.000204 call s:cmdheight.save() | |
30 0.000429 0.000343 let height = max([(width - 1) / (&columns) + 1, s:cmdheight.get()]) | |
30 0.000080 if height > &cmdheight || &cmdheight > height | |
let &cmdheight = height | |
redraw | |
endif | |
FUNCTION <SNR>121_make() | |
Called 1 time | |
Total time: 0.000006 | |
Self time: 0.000006 | |
count total (s) self (s) | |
1 0.000004 return deepcopy(s:module) | |
FUNCTION vital#_incsearch#Over#Commandline#Modules#BufferComplete#import() | |
Called 1 time | |
Total time: 0.000013 | |
Self time: 0.000013 | |
count total (s) self (s) | |
1 0.000011 return map({'make': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>145__init() | |
Called 1 time | |
Total time: 0.000441 | |
Self time: 0.000011 | |
count total (s) self (s) | |
1 0.000440 0.000010 let s:global.windo = s:Window.as_windo(s:global) | |
FUNCTION incsearch#detect_case() | |
Called 30 times | |
Total time: 0.002122 | |
Self time: 0.002122 | |
count total (s) self (s) | |
" Ignore \%C, \%U, \%V for smartcase detection | |
30 0.000656 let p = substitute(a:pattern, s:non_escaped_backslash . '%[CUV]', '', 'g') | |
" Explicit \c has highest priority | |
30 0.000300 if p =~# s:non_escaped_backslash . 'c' | |
return '\c' | |
endif | |
30 0.000294 if p =~# s:non_escaped_backslash . 'C' || &ignorecase == s:FALSE | |
return '\C' " noignorecase or explicit \C | |
endif | |
30 0.000070 if &smartcase == s:FALSE | |
return '\c' " ignorecase & nosmartcase | |
endif | |
" Find uppercase letter which isn't escaped | |
30 0.000316 if p =~# s:escaped_backslash . '[A-Z]' | |
return '\C' " smartcase with [A-Z] | |
else | |
30 0.000044 return '\c' " smartcase without [A-Z] | |
endif | |
FUNCTION <SNR>136__vital_loaded() | |
Called 1 time | |
Total time: 0.001666 | |
Self time: 0.000010 | |
count total (s) self (s) | |
1 0.001665 0.000009 let s:Keymapping = a:V.import("Palette.Keymapping") | |
FUNCTION 431() | |
Called 22 times | |
Total time: 0.000284 | |
Self time: 0.000284 | |
count total (s) self (s) | |
22 0.000061 let self.variables.counter += 1 | |
22 0.000087 let slot = { "id" : self.variables.counter, "slot" : a:slot } | |
22 0.000079 call add(self.variables.slots, slot) | |
22 0.000034 return slot | |
FUNCTION 432() | |
Called 1 time | |
Total time: 0.000005 | |
Self time: 0.000005 | |
count total (s) self (s) | |
1 0.000003 if empty(a:slot) | |
1 0.000001 return -1 | |
endif | |
for i in range(len(self.variables.slots)) | |
if self.variables.slots[i].id == a:slot.id | |
unlet self.variables.slots[i] | |
return | |
endif | |
endfor | |
return -1 | |
FUNCTION incsearch#magic() | |
Called 62 times | |
Total time: 0.000473 | |
Self time: 0.000473 | |
count total (s) self (s) | |
62 0.000184 let m = g:incsearch#magic | |
62 0.000233 return (len(m) == 2 && m =~# '\\[mMvV]' ? m : '') | |
FUNCTION incsearch#over#modules#incsearch#make() | |
Called 1 time | |
Total time: 0.000007 | |
Self time: 0.000007 | |
count total (s) self (s) | |
1 0.000007 return deepcopy(s:inc) | |
FUNCTION <SNR>103_set_search_related_stuff() | |
Called 1 time | |
Total time: 0.196831 | |
Self time: 0.000602 | |
count total (s) self (s) | |
" For stay motion | |
1 0.000005 let should_set_jumplist = get(a:, 1, s:TRUE) | |
1 0.000007 0.000005 let is_cancel = a:cli.exit_code() | |
1 0.000001 if is_cancel | |
" Restore cursor position and return | |
" NOTE: Should I request on_cancel event to vital-over and use it? | |
call winrestview(a:cli._w) | |
call s:cleanup_cmdline() | |
return | |
endif | |
1 0.000084 0.000005 let [raw_pattern, offset] = a:cli._parse_pattern() | |
1 0.000004 let should_execute = !empty(offset) || empty(raw_pattern) | |
1 0.000001 if should_execute | |
" Execute with feedkeys() to work with | |
" 1. :h {offset} for `n` and `N` | |
" 2. empty input (:h last-pattern) | |
" NOTE: Don't use feedkeys() as much as possible to avoid flickering | |
call winrestview(a:cli._w) | |
call feedkeys(a:cmd, 'n') | |
if g:incsearch#consistent_n_direction | |
call feedkeys("\<Plug>(_incsearch-searchforward)", 'm') | |
endif | |
else | |
" Add history if necessary | |
" Do not save converted pattern to history | |
1 0.000021 0.000005 let pattern = a:cli._convert(raw_pattern) | |
1 0.000009 0.000005 let input = a:cli._combine_pattern(raw_pattern, offset) | |
1 0.000005 call histadd(a:cli._base_key, input) | |
1 0.000020 0.000014 call s:set_search_reg(pattern, a:cli._base_key) | |
1 0.000004 let target_view = winsaveview() | |
1 0.000114 call winrestview(a:cli._w) " Get back start position temporarily for emulation | |
" Set jump list | |
1 0.000001 if should_set_jumplist | |
1 0.000117 normal! m` | |
1 0.000001 endif | |
" Emulate errors, and handling `n` and `N` preparation | |
1 0.196042 0.000012 call s:emulate_search_error(a:cli._direction, a:cli._w) | |
" winrestview() between error and wraning emulation to avoid flickering | |
1 0.000126 call winrestview(target_view) | |
" Emulate warning | |
1 0.000037 0.000013 call s:emulate_search_warning(a:cli._direction, a:cli._w, target_view) | |
1 0.000075 0.000007 call s:silent_after_search() | |
" Open fold | |
1 0.000015 if &foldopen =~# '\vsearch|all' | |
1 0.000115 normal! zv | |
1 0.000001 endif | |
1 0.000001 endif | |
FUNCTION incsearch#autocmd#auto_nohlsearch() | |
Called 1 time | |
Total time: 0.000006 | |
Self time: 0.000006 | |
count total (s) self (s) | |
" NOTE: see this value inside this function in order to toggle auto | |
" :nohlsearch feature easily with g:incsearch#autocmd#auto_nohlsearch option | |
1 0.000004 if !g:incsearch#auto_nohlsearch | return '' | endif | |
return s:auto_nohlsearch(a:nest) | |
FUNCTION <SNR>107__runtime() | |
Called 39 times | |
Total time: 0.027280 | |
Self time: 0.006484 | |
count total (s) self (s) | |
39 0.027257 0.006461 execute 'runtime' fnameescape(a:path) | |
FUNCTION <SNR>107__import_func_name() | |
Called 39 times | |
Total time: 0.000739 | |
Self time: 0.000379 | |
count total (s) self (s) | |
39 0.000721 0.000361 return printf('vital#_%s#%s#import', a:plugin_name, s:_dot_to_sharp(a:module_name)) | |
FUNCTION 647() | |
Called 1 time | |
Total time: 0.002532 | |
Self time: 0.001905 | |
count total (s) self (s) | |
1 0.000529 0.000004 call s:hi.disable_all() | |
1 0.000065 0.000005 call s:hi.delete_all() | |
" redraw: hide pseud-cursor | |
1 0.001842 redraw " need to redraw for handling non-<expr> mappings | |
1 0.000035 0.000010 if a:cmdline.getline() ==# '' | |
echo '' | |
else | |
1 0.000037 0.000024 echo a:cmdline.get_prompt() . a:cmdline.getline() | |
1 0.000001 endif | |
" NOTE: | |
" push rest of keymappings with feedkeys() | |
" FIXME: assume 'noremap' but it should take care wheter or not the | |
" mappings should be remapped or not | |
1 0.000012 0.000008 if a:cmdline.input_key_stack_string() !=# '' | |
call feedkeys(a:cmdline.input_key_stack_string(), 'n') | |
endif | |
FUNCTION 519() | |
Called 30 times | |
Total time: 0.000368 | |
Self time: 0.000368 | |
count total (s) self (s) | |
30 0.000148 if has_key(self, "exception") | |
call self.message(a:cmdline) | |
unlet self.exception | |
endif | |
FUNCTION <SNR>110__vital_loaded() | |
Called 1 time | |
Total time: 0.008320 | |
Self time: 0.000075 | |
count total (s) self (s) | |
1 0.000004 let s:V = a:V | |
1 0.003025 0.000009 let s:String = s:V.import("Over.String") | |
1 0.001052 0.000011 let s:Signals = s:V.import("Over.Signals") | |
1 0.000706 0.000009 let s:Input = s:V.import("Over.Input") | |
1 0.000980 0.000008 let s:Keymapping = s:V.import("Over.Keymapping") | |
1 0.000778 0.000009 let s:Module = s:V.import("Over.Commandline.Modules") | |
1 0.000021 0.000010 let s:base.variables.modules = s:Signals.make() | |
1 0.000003 function! s:base.variables.modules.get_slot(val) | |
return a:val.slot.module | |
endfunction | |
1 0.001747 0.000008 let s:Highlight = s:V.import("Palette.Highlight") | |
FUNCTION vital#_incsearch#Over#Commandline#Modules#Cancel#import() | |
Called 1 time | |
Total time: 0.000012 | |
Self time: 0.000012 | |
count total (s) self (s) | |
1 0.000011 return map({'make': ''}, 'function("s:" . v:key)') | |
FUNCTION airline#parts#spell() | |
Called 39 times | |
Total time: 0.000161 | |
Self time: 0.000161 | |
count total (s) self (s) | |
39 0.000142 return g:airline_detect_spell && &spell ? g:airline_symbols.spell : '' | |
FUNCTION vital#_incsearch#Over#Input#import() | |
Called 1 time | |
Total time: 0.000013 | |
Self time: 0.000013 | |
count total (s) self (s) | |
1 0.000011 return map({'getchar': ''}, 'function("s:" . v:key)') | |
FUNCTION 406() | |
Called 35 times | |
Total time: 0.001456 | |
Self time: 0.000387 | |
count total (s) self (s) | |
35 0.001435 0.000366 return type(a:item) == type("") ? self.set_str(a:item) : type(a:item) == type(0) ? self.set_pos(a:item) : self | |
FUNCTION 407() | |
Called 124 times | |
Total time: 0.000785 | |
Self time: 0.000785 | |
count total (s) self (s) | |
124 0.000693 return join(self.list, "") | |
FUNCTION 408() | |
Called 34 times | |
Total time: 0.000731 | |
Self time: 0.000394 | |
count total (s) self (s) | |
34 0.000656 0.000319 let self.col = s:_clamp(a:pos, 0, self.length()) | |
34 0.000050 return self | |
FUNCTION 409() | |
Called 30 times | |
Total time: 0.000323 | |
Self time: 0.000323 | |
count total (s) self (s) | |
30 0.000302 return self.col > 0 ? join(self.list[ : self.col-1], '') : "" | |
FUNCTION <SNR>103_Error() | |
Called 1 time | |
Total time: 0.001566 | |
Self time: 0.000016 | |
count total (s) self (s) | |
1 0.001566 0.000016 return call(function('s:_echohl'), [a:msg, 'ErrorMsg'] + a:000) | |
FUNCTION <SNR>112_sort_by() | |
Called 154 times | |
Total time: 0.075838 | |
Self time: 0.017872 | |
count total (s) self (s) | |
154 0.014940 0.013676 let pairs = map(a:list, printf('[v:val, %s]', a:expr)) | |
154 0.060760 0.004058 return map(s:sort(pairs, 'a:a[1] ==# a:b[1] ? 0 : a:a[1] ># a:b[1] ? 1 : -1'), 'v:val[0]') | |
FUNCTION <SNR>104_SID() | |
Called 35 times | |
Total time: 0.000816 | |
Self time: 0.000816 | |
count total (s) self (s) | |
35 0.000778 return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$') | |
FUNCTION vital#_incsearch#Gift#Window#import() | |
Called 1 time | |
Total time: 0.000058 | |
Self time: 0.000058 | |
count total (s) self (s) | |
1 0.000057 return map({'flatten': '', 'tabpagewinnr_list': '', 'execute': '', 'close': '', 'numbering': '', 'set_prefix': '', '_vital_depends': '', 'exists': '', 'jump': '', 'setvar': '', 'bufnr': '', 'uniq_nr': '', 'make_uniq_nr': '', 'tabpagewinnr': '', 'getvar': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>117_links_to() | |
Called 1 time | |
Total time: 0.000024 | |
Self time: 0.000024 | |
count total (s) self (s) | |
1 0.000024 return matchstr(a:highlight, '^\S\+\s\+xxx links to \zs.*\ze$') | |
FUNCTION <SNR>111__vital_loaded() | |
Called 1 time | |
Total time: 0.001926 | |
Self time: 0.000017 | |
count total (s) self (s) | |
1 0.000003 let s:V = a:V | |
1 0.001922 0.000013 let s:List = s:V.import("Data.List") | |
FUNCTION incsearch#over#modules#module_management#make() | |
Called 1 time | |
Total time: 0.000012 | |
Self time: 0.000012 | |
count total (s) self (s) | |
1 0.000006 let m = deepcopy(s:module_management) | |
1 0.000003 let m.modules = a:modules | |
1 0.000002 return m | |
FUNCTION 339() | |
Called 30 times | |
Total time: 0.000231 | |
Self time: 0.000231 | |
count total (s) self (s) | |
30 0.000085 if self.variables.tap_key == a:key | |
let self.variables.tap_key = "" | |
return 1 | |
endif | |
FUNCTION 410() | |
Called 30 times | |
Total time: 0.000167 | |
Self time: 0.000167 | |
count total (s) self (s) | |
30 0.000146 return join(self.list[self.col+1 : ], '') | |
FUNCTION 412() | |
Called 31 times | |
Total time: 0.000998 | |
Self time: 0.000998 | |
count total (s) self (s) | |
31 0.000764 let self.list = split(a:str, '\zs') | |
31 0.000136 let self.col = strchars(a:str) | |
31 0.000053 return self | |
FUNCTION 413() | |
Called 30 times | |
Total time: 0.000080 | |
Self time: 0.000080 | |
count total (s) self (s) | |
30 0.000060 return self.col | |
FUNCTION 415() | |
Called 42 times | |
Total time: 0.000154 | |
Self time: 0.000154 | |
count total (s) self (s) | |
42 0.000123 return len(self.list) | |
FUNCTION 418() | |
Called 4 times | |
Total time: 0.000208 | |
Self time: 0.000089 | |
count total (s) self (s) | |
4 0.000030 0.000018 if a:index < 0 || self.length() <= a:index | |
return "" | |
endif | |
4 0.000014 let result = self.list[a:index] | |
4 0.000011 unlet self.list[a:index] | |
4 0.000007 if a:index < self.col | |
4 0.000123 0.000016 call self.set(self.col - 1) | |
4 0.000005 endif | |
4 0.000005 return result | |
FUNCTION airline#parts#crypt() | |
Called 39 times | |
Total time: 0.000251 | |
Self time: 0.000251 | |
count total (s) self (s) | |
39 0.000224 return g:airline_detect_crypt && exists("+key") && !empty(&key) ? g:airline_symbols.crypt : '' | |
FUNCTION 420() | |
Called 4 times | |
Total time: 0.000233 | |
Self time: 0.000025 | |
count total (s) self (s) | |
4 0.000231 0.000023 return self.remove(self.col - 1) | |
FUNCTION <SNR>151_uniq_winnr() | |
Called 669 times | |
Total time: 0.018747 | |
Self time: 0.004084 | |
count total (s) self (s) | |
669 0.018515 0.003852 return call(s:Window.uniq_nr, a:000, s:Window) | |
FUNCTION <SNR>152_uniq_nr() | |
Called 669 times | |
Total time: 0.014663 | |
Self time: 0.014633 | |
count total (s) self (s) | |
669 0.003089 let winnr = get(a:, 1, winnr()) | |
669 0.002667 let tabnr = get(a:, 2, tabpagenr()) | |
669 0.003667 let uniq_nr = get(gettabwinvar(tabnr, winnr, ""), s:prefix . "_gift_uniq_winnr", -1) | |
669 0.001005 if uniq_nr == -1 | |
1 0.000038 0.000008 let uniq_nr = s:numbering(winnr, tabnr) | |
1 0.000001 endif | |
669 0.000850 return uniq_nr | |
FUNCTION <SNR>107_new() | |
Called 21 times | |
Total time: 0.000267 | |
Self time: 0.000267 | |
count total (s) self (s) | |
21 0.000148 let base = deepcopy(s:Vital) | |
21 0.000065 let base._plugin_name = a:plugin_name | |
21 0.000032 return base | |
FUNCTION <SNR>109__vital_loaded() | |
Called 1 time | |
Total time: 0.010377 | |
Self time: 0.000021 | |
count total (s) self (s) | |
1 0.000003 let s:V = a:V | |
1 0.010311 0.000008 let s:Cmdline = s:V.import("Over.Commandline.Base") | |
1 0.000062 0.000009 let s:Modules = s:V.import("Over.Commandline.Modules") | |
FUNCTION airline#parts#mode() | |
Called 39 times | |
Total time: 0.000846 | |
Self time: 0.000349 | |
count total (s) self (s) | |
39 0.000824 0.000327 return airline#util#shorten(get(w:, 'airline_current_mode', ''), 79, 1) | |
FUNCTION <SNR>107__dot_to_sharp() | |
Called 39 times | |
Total time: 0.000360 | |
Self time: 0.000360 | |
count total (s) self (s) | |
39 0.000339 return substitute(a:name, '\.', '#', 'g') | |
FUNCTION 434() | |
Called 154 times | |
Total time: 1.318160 | |
Self time: 0.002085 | |
count total (s) self (s) | |
154 1.318059 0.001984 return call("s:call", [self.slots(), a:func] + a:000) | |
FUNCTION 435() | |
Called 25 times | |
Total time: 0.000736 | |
Self time: 0.000736 | |
count total (s) self (s) | |
25 0.000719 return filter(copy(self.variables.slots), a:expr) | |
FUNCTION 436() | |
Called 25 times | |
Total time: 0.000914 | |
Self time: 0.000178 | |
count total (s) self (s) | |
25 0.000904 0.000168 return get(self.find_by(a:expr), 0, {}) | |
FUNCTION 437() | |
Called 154 times | |
Total time: 0.077162 | |
Self time: 0.001324 | |
count total (s) self (s) | |
154 0.077079 0.001241 let self.variables.slots = s:L.sort_by(self.variables.slots, a:expr) | |
FUNCTION 439() | |
Called 184 times | |
Total time: 0.020996 | |
Self time: 0.011921 | |
count total (s) self (s) | |
184 0.020909 0.011834 return map(copy(self.variables.slots), "self.get_slot(v:val)") | |
FUNCTION vital#incsearch#import() | |
Called 3 times | |
Total time: 0.012544 | |
Self time: 0.000064 | |
count total (s) self (s) | |
3 0.000011 if !exists('s:V') | |
1 0.000025 0.000011 let s:V = s:new(s:plugin_name) | |
1 0.000001 endif | |
3 0.012495 0.000029 return call(s:V.import, a:000, s:V) | |
FUNCTION 645() | |
Called 154 times | |
Total time: 0.000535 | |
Self time: 0.000535 | |
count total (s) self (s) | |
154 0.000432 return a:event is# 'on_char' ? 10 : 0 | |
FUNCTION 648() | |
Called 30 times | |
Total time: 0.015271 | |
Self time: 0.000419 | |
count total (s) self (s) | |
30 0.015251 0.000399 call s:on_searching(function('s:on_char_pre'), a:cmdline) | |
FUNCTION 649() | |
Called 30 times | |
Total time: 1.100188 | |
Self time: 0.000336 | |
count total (s) self (s) | |
30 1.100167 0.000315 call s:on_searching(function('s:on_char'), a:cmdline) | |
FUNCTION <SNR>126_make() | |
Called 1 time | |
Total time: 0.000004 | |
Self time: 0.000004 | |
count total (s) self (s) | |
1 0.000004 return deepcopy(s:module) | |
FUNCTION vital#_incsearch#Coaster#Window#import() | |
Called 1 time | |
Total time: 0.000022 | |
Self time: 0.000022 | |
count total (s) self (s) | |
1 0.000021 return map({'as_windo': '', '_vital_depends': '', 'windo': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION 440() | |
Called 4046 times | |
Total time: 0.009075 | |
Self time: 0.009075 | |
count total (s) self (s) | |
4046 0.007362 return a:val.slot.module | |
FUNCTION 448() | |
Called 30 times | |
Total time: 0.006010 | |
Self time: 0.002678 | |
count total (s) self (s) | |
30 0.001460 0.000298 if a:cmdline.is_input("<Over>(buffer-complete)") || a:cmdline.is_input("<Over>(buffer-complete-prev)") | |
if self.complete(a:cmdline) == -1 | |
call s:_finish() | |
call a:cmdline.setchar('') | |
return | |
endif | |
if a:cmdline.is_input("<Over>(buffer-complete-prev)") | |
let s:count = len(s:complete_list) - 1 | |
endif | |
call a:cmdline.setchar('') | |
call a:cmdline.tap_keyinput("Completion") | |
" elseif a:cmdline.is_input("\<Tab>", "Completion") | |
elseif a:cmdline.is_input("<Over>(buffer-complete)", "Completion") || a:cmdline.is_input("\<Right>", "Completion") | |
call a:cmdline.setchar('') | |
let s:count += 1 | |
if s:count >= len(s:complete_list) | |
let s:count = 0 | |
endif | |
elseif a:cmdline.is_input("<Over>(buffer-complete-prev)", "Completion") || a:cmdline.is_input("\<Left>", "Completion") | |
call a:cmdline.setchar('') | |
let s:count -= 1 | |
if s:count < 0 | |
let s:count = len(s:complete_list) - 1 | |
endif | |
else | |
30 0.000382 0.000151 if a:cmdline.untap_keyinput("Completion") | |
call a:cmdline.callevent("on_char_pre") | |
endif | |
30 0.000459 0.000152 call s:_finish() | |
30 0.000037 return | |
endif | |
call a:cmdline.setline(s:line) | |
call a:cmdline.insert(s:complete_list[s:count], s:pos) | |
if len(s:complete_list) > 1 | |
let &statusline = s:_as_statusline(s:complete_list, s:count) | |
redrawstatus | |
endif | |
if len(s:complete_list) == 1 | |
call a:cmdline.untap_keyinput("Completion") | |
endif | |
FUNCTION 449() | |
Called 30 times | |
Total time: 0.000037 | |
Self time: 0.000037 | |
count total (s) self (s) | |
" redrawstatus | |
FUNCTION 433() | |
Called 1 time | |
Total time: 0.000061 | |
Self time: 0.000010 | |
count total (s) self (s) | |
1 0.000060 0.000009 return self.disconnect(self.find_first_by(a:expr)) | |
FUNCTION 652() | |
Called 31 times | |
Total time: 0.001787 | |
Self time: 0.001507 | |
count total (s) self (s) | |
31 0.000192 let mode = get(a:, 1, self._mode) | |
31 0.000561 0.000281 let op = (mode ==# 'no') ? v:operator : s:U.is_visual(mode) ? 'gv' : '' | |
31 0.000249 let zv = (&foldopen =~# '\vsearch|all' && mode !=# 'no' ? 'zv' : '') | |
" NOTE: | |
" Should I consider o_v, o_V, and o_CTRL-V cases and do not | |
" <Esc>? <Esc> exists for flexible v:count with using s:cli._vcount1, | |
" but, if you do not move the cursor while incremental searching, | |
" there are no need to use <Esc>. | |
31 0.000096 let esc = self._has_count ? "\<Esc>" : '' | |
31 0.000108 let register = esc is# '' ? '' : '"' . v:register | |
31 0.000086 let cnt = self._vcount1 is# 1 ? '' : self._vcount1 | |
31 0.000130 let prefix = esc . register . (esc is# '' ? '' : op) . cnt | |
31 0.000233 return printf("%s%s%s\<CR>%s", prefix, self._base_key, a:pattern, zv) | |
FUNCTION 653() | |
Called 1 time | |
Total time: 0.001638 | |
Self time: 0.000265 | |
count total (s) self (s) | |
1 0.000016 let view = get(a:, 1, winsaveview()) | |
1 0.000002 try | |
1 0.000117 call winrestview(self._w) | |
1 0.000710 0.000005 call self.callevent('on_execute_pre') | |
1 0.000001 finally | |
1 0.000115 call winrestview(view) | |
1 0.000001 endtry | |
1 0.000674 0.000006 call self.callevent('on_execute') | |
FUNCTION 654() | |
Called 61 times | |
Total time: 0.006278 | |
Self time: 0.001502 | |
count total (s) self (s) | |
61 0.000223 if v:version == 704 && !has('patch421') | |
" Ignore \ze* which clash vim 7.4 without 421 patch | |
" Assume `\m` | |
let [p, o] = incsearch#parse_pattern(self.getline(), self._base_key) | |
let p = (p =~# s:non_escaped_backslash . 'z[se]\%(\*\|\\+\)' ? '' : p) | |
return [p, o] | |
else | |
61 0.005349 0.000573 return incsearch#parse_pattern(self.getline(), self._base_key) | |
endif | |
FUNCTION 655() | |
Called 32 times | |
Total time: 0.000191 | |
Self time: 0.000191 | |
count total (s) self (s) | |
32 0.000174 return empty(a:offset) ? a:pattern : a:pattern . self._base_key . a:offset | |
FUNCTION 656() | |
Called 62 times | |
Total time: 0.001244 | |
Self time: 0.000779 | |
count total (s) self (s) | |
62 0.000156 if a:pattern is# '' | |
1 0.000003 return a:pattern | |
elseif empty(self._converters) | |
61 0.000789 0.000324 return incsearch#magic() . a:pattern | |
elseif has_key(self._converter_cache, a:pattern) | |
return self._converter_cache[a:pattern] | |
else | |
let ps = [incsearch#magic() . a:pattern] | |
for l:Converter in self._converters | |
let l:Convert = type(l:Converter) is type(function('function')) ? l:Converter : l:Converter.convert | |
let ps += [l:Convert(a:pattern)] | |
unlet l:Converter | |
endfor | |
" Converters may return upper case even if a:pattern doesn't contain upper | |
" case letter, so prepend case flag explicitly | |
" let case = incsearch#detect_case(a:pattern) | |
let case = incsearch#detect_case(a:pattern) | |
let self._converter_cache[a:pattern] = case . s:U.regexp_join(ps) | |
return self._converter_cache[a:pattern] | |
endif | |
FUNCTION 452() | |
Called 30 times | |
Total time: 0.001465 | |
Self time: 0.000459 | |
count total (s) self (s) | |
30 0.001286 0.000280 if a:cmdline.is_input("\<Esc>") || a:cmdline.is_input("\<C-c>") | |
" call a:cmdline.cancel() | |
call a:cmdline.exit(1) | |
call a:cmdline.setchar("") | |
endif | |
FUNCTION <SNR>149__vital_loaded() | |
Called 1 time | |
Total time: 0.001045 | |
Self time: 0.000053 | |
count total (s) self (s) | |
1 0.000002 let s:V = a:V | |
1 0.000099 0.000027 let s:Prelude = s:V.import('Prelude') | |
1 0.000099 0.000014 let s:List = s:V.import('Data.List') | |
1 0.000844 0.000009 let s:Dict = s:V.import('Data.Dict') | |
FUNCTION <SNR>131_get_cmdline() | |
Called 1 time | |
Total time: 0.000008 | |
Self time: 0.000008 | |
count total (s) self (s) | |
1 0.000004 if !exists("s:cmdline") | |
execute s:E.throw_cmd("Undefined cmdline object.", "Over.Commandline.Modules.Doautocmd") | |
endif | |
1 0.000001 return s:cmdline | |
FUNCTION <SNR>110_is_input_waiting() | |
Called 30 times | |
Total time: 0.001099 | |
Self time: 0.001099 | |
count total (s) self (s) | |
30 0.000949 let num = len(filter(copy(a:keymapping), 'stridx(v:key, a:input) == 0')) | |
30 0.000117 return num > 1 || (num == 1 && !has_key(a:keymapping, a:input)) | |
FUNCTION 450() | |
Called 1 time | |
Total time: 0.000015 | |
Self time: 0.000006 | |
count total (s) self (s) | |
1 0.000014 0.000005 call s:_finish() | |
1 0.000001 unlet! s:complete | |
FUNCTION 454() | |
Called 30 times | |
Total time: 0.007368 | |
Self time: 0.002430 | |
count total (s) self (s) | |
30 0.000647 0.000144 if a:cmdline.is_input("\<Right>") | |
call a:cmdline.line.next() | |
call a:cmdline.setchar('') | |
elseif a:cmdline.is_input("\<Left>") | |
call a:cmdline.line.prev() | |
call a:cmdline.setchar('') | |
elseif a:cmdline.is_input("\<C-b>") || a:cmdline.is_input("\<Home>") | |
call a:cmdline.setline(0) | |
call a:cmdline.setchar('') | |
elseif a:cmdline.is_input("\<C-e>") || a:cmdline.is_input("\<End>") | |
call a:cmdline.setline(a:cmdline.line.length()) | |
call a:cmdline.setchar('') | |
elseif a:cmdline.is_input("\<C-Left>") || a:cmdline.is_input("\<S-Left>") | |
call a:cmdline.setline(strridx(a:cmdline.backward()[:-2], ' ') + 1) | |
call a:cmdline.setchar('') | |
elseif a:cmdline.is_input("\<C-Right>") || a:cmdline.is_input("\<S-Right>") | |
let p = stridx(a:cmdline.forward()[1:], ' ') | |
call a:cmdline.setline(p != -1 ? a:cmdline.line.pos() + p + 2 : a:cmdline.line.length()) | |
call a:cmdline.setchar('') | |
endif | |
FUNCTION 458() | |
Called 1 time | |
Total time: 0.000003 | |
Self time: 0.000003 | |
count total (s) self (s) | |
" Delete cache to handle additional digraphs definition | |
1 0.000002 let self.digraphs = {} | |
FUNCTION 459() | |
Called 30 times | |
Total time: 0.001822 | |
Self time: 0.001342 | |
count total (s) self (s) | |
30 0.000628 0.000148 if a:cmdline.is_input("\<C-k>") | |
if empty(self.digraphs) | |
" Get digraphs when inputting <C-k> instead of on_enter because it cause | |
" flicker in some environments #107 | |
let self.digraphs = s:digraph() | |
endif | |
call a:cmdline.setchar('?') | |
let self.prefix_key = a:cmdline.input_key() | |
let self.old_line = a:cmdline.getline() | |
let self.old_pos = a:cmdline.getpos() | |
return | |
elseif exists("self.prefix_key") && a:cmdline.get_tap_key() == self.prefix_key | |
call a:cmdline.setline(self.old_line) | |
call a:cmdline.setpos(self.old_pos) | |
let x = a:cmdline.input_key() | |
let y = s:Input.getchar() | |
" For CTRL-K, there is one general digraph: CTRL-K <Space> {char} will | |
" enter {char} with the highest bit set. You can use this to enter | |
" meta-characters. | |
let char = x ==# "\<Space>" ? nr2char(char2nr(y) + 128) : get(self.digraphs, x . y, y) | |
call a:cmdline.setchar(char) | |
endif | |
FUNCTION 650() | |
Called 30 times | |
Total time: 0.000174 | |
Self time: 0.000174 | |
count total (s) self (s) | |
30 0.000151 return copy(self._keymap) | |
FUNCTION <SNR>134_make() | |
Called 1 time | |
Total time: 0.000015 | |
Self time: 0.000015 | |
count total (s) self (s) | |
1 0.000006 let module = deepcopy(s:module) | |
1 0.000006 let module.mode = get(a:, 1, "cmd") | |
1 0.000002 return module | |
FUNCTION <SNR>113__vital_loaded() | |
Called 1 time | |
Total time: 0.000113 | |
Self time: 0.000017 | |
count total (s) self (s) | |
1 0.000003 let s:V = a:V | |
1 0.000109 0.000013 let s:L = s:V.import("Data.List") | |
FUNCTION vital#incsearch#of() | |
Called 20 times | |
Total time: 0.000367 | |
Self time: 0.000114 | |
count total (s) self (s) | |
20 0.000360 0.000107 return s:new(s:plugin_name) | |
FUNCTION <SNR>117_get() | |
Called 1 time | |
Total time: 0.000368 | |
Self time: 0.000042 | |
count total (s) self (s) | |
1 0.000005 if !hlexists(a:name) | |
return {} | |
endif | |
1 0.000350 0.000024 let result = s:parse(substitute(s:capture(a:name), "\n", "", "g")) | |
1 0.000004 if has_key(result, "link") && get(a:, 1, 0) | |
return s:get(result.link, get(a:, 1, 0)) | |
else | |
1 0.000001 return result | |
endif | |
FUNCTION vital#_incsearch#Over#Commandline#Modules#import() | |
Called 1 time | |
Total time: 0.000019 | |
Self time: 0.000019 | |
count total (s) self (s) | |
1 0.000018 return map({'get': '', 'make': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>147__vital_loaded() | |
Called 1 time | |
Total time: 0.003718 | |
Self time: 0.000022 | |
count total (s) self (s) | |
1 0.000002 let s:V = a:V | |
1 0.001552 0.000010 let s:P = s:V.import('Prelude') | |
1 0.002162 0.000008 let s:G = s:V.import('Vim.Guard') | |
FUNCTION 540() | |
Called 1 time | |
Total time: 0.000005 | |
Self time: 0.000005 | |
count total (s) self (s) | |
1 0.000003 function! a:cmdline.backward_word(...) | |
return call("s:backward_word", [self.backward()] + a:000) | |
endfunction | |
FUNCTION 460() | |
Called 30 times | |
Total time: 0.001477 | |
Self time: 0.000884 | |
count total (s) self (s) | |
30 0.000813 0.000220 if a:cmdline.is_input("\<C-k>") | |
call a:cmdline.tap_keyinput(self.prefix_key) | |
call a:cmdline.disable_keymapping() | |
call a:cmdline.setpos(a:cmdline.getpos()-1) | |
else | |
30 0.000095 if exists("self.prefix_key") | |
call a:cmdline.untap_keyinput(self.prefix_key) | |
call a:cmdline.enable_keymapping() | |
unlet! self.prefix_key | |
endif | |
30 0.000029 endif | |
FUNCTION 462() | |
Called 30 times | |
Total time: 0.004341 | |
Self time: 0.001751 | |
count total (s) self (s) | |
30 0.001256 0.000257 if a:cmdline.is_input("\<C-h>") || a:cmdline.is_input("\<BS>") | |
4 0.000035 0.000014 if a:cmdline.line.length() == 0 | |
return a:cmdline.exit(1) | |
else | |
4 0.000252 0.000019 call a:cmdline.line.remove_prev() | |
4 0.000068 0.000019 call a:cmdline.setchar('') | |
4 0.000003 endif | |
4 0.000006 elseif a:cmdline.is_input("\<Del>") | |
call a:cmdline.line.remove_pos() | |
call a:cmdline.setchar('') | |
elseif a:cmdline.is_input("\<C-w>") | |
let word = a:cmdline.backward_word() | |
let backward = a:cmdline.backward()[ : -strlen(word)-1 ] | |
call a:cmdline.setline(backward . a:cmdline.line.pos_char() . a:cmdline.forward()) | |
call a:cmdline.setline(strchars(backward)) | |
call a:cmdline.setchar('') | |
elseif a:cmdline.is_input("\<C-u>") | |
call a:cmdline.setline(a:cmdline.line.pos_char() . a:cmdline.forward()) | |
call a:cmdline.setline(0) | |
call a:cmdline.setchar('') | |
endif | |
FUNCTION <SNR>117_capture() | |
Called 1 time | |
Total time: 0.000042 | |
Self time: 0.000016 | |
count total (s) self (s) | |
1 0.000004 if hlexists(a:name) == 0 | |
return "" | |
endif | |
1 0.000035 0.000009 return s:Message.capture("highlight " . a:name) | |
FUNCTION <SNR>143_on_searching() | |
Called 60 times | |
Total time: 1.114704 | |
Self time: 0.002884 | |
count total (s) self (s) | |
60 0.000130 try | |
60 1.112293 0.000473 return call(a:func, a:000) | |
catch /E16:/ " E16: Invalid range (with /\_[a- ) | |
catch /E33:/ " E33: No previous substitute regular expression | |
catch /E53:/ " E53: Unmatched %( | |
catch /E54:/ | |
catch /E55:/ | |
catch /E62:/ " E62: Nested \= (with /a\=\=) | |
catch /E63:/ " E63: invalid use of \_ | |
catch /E64:/ " E64: \@ follows nothing | |
catch /E65:/ " E65: Illegal back reference | |
catch /E66:/ " E66: \z( not allowed here | |
catch /E67:/ " E67: \z1 et al. not allowed here | |
catch /E68:/ " E68: Invalid character after \z (with /\za & re=1) | |
catch /E69:/ " E69: Missing ] after \%[ | |
catch /E70:/ " E70: Empty \%[] | |
catch /E71:/ " E71: Invalid character after \% | |
catch /E554:/ | |
catch /E678:/ " E678: Invalid character after \%[dxouU] | |
catch /E864:/ " E864: \%#= can only be followed by 0, 1, or 2. The | |
" automatic engine will be used | |
catch /E865:/ " E865: (NFA) Regexp end encountered prematurely | |
catch /E866:/ " E866: (NFA regexp) Misplaced @ | |
catch /E867:/ " E867: (NFA) Unknown operator | |
catch /E869:/ " E869: (NFA) Unknown operator '\@m | |
catch /E870:/ " E870: (NFA regexp) Error reading repetition limits | |
catch /E871:/ " E871: (NFA regexp) Can't have a multi follow a multi ! | |
catch /E874:/ " E874: (NFA) Could not pop the stack ! (with \&) | |
catch /E877:/ " E877: (NFA regexp) Invalid character class: 109 | |
catch /E888:/ " E888: (NFA regexp) cannot repeat (with /\ze*) | |
call s:hi.disable_all() | |
catch | |
echohl ErrorMsg | echom v:throwpoint . ' ' . v:exception | echohl None | |
endtry | |
FUNCTION incsearch#highlight#hgm() | |
Called 31 times | |
Total time: 0.001860 | |
Self time: 0.001860 | |
count total (s) self (s) | |
31 0.000178 let hgm = copy(s:default_highlight) | |
186 0.000392 for key in keys(hgm) | |
155 0.000790 call extend(hgm[key], get(g:incsearch#highlight, key, {})) | |
155 0.000180 endfor | |
31 0.000049 return hgm | |
FUNCTION <SNR>137__maparg() | |
Called 5 times | |
Total time: 0.000102 | |
Self time: 0.000102 | |
count total (s) self (s) | |
" Workaround : <C-?> https://github.com/osyo-manga/vital-palette/issues/5 | |
5 0.000010 if a:name ==# "<^?>" | |
return maparg("\<C-?>", a:mode, a:abbr, a:dict) | |
endif | |
5 0.000067 return maparg(a:name, a:mode, a:abbr, a:dict) | |
FUNCTION <SNR>152_numbering() | |
Called 1 time | |
Total time: 0.000030 | |
Self time: 0.000025 | |
count total (s) self (s) | |
1 0.000004 let winnr = get(a:, 1, winnr()) | |
1 0.000004 let tabnr = get(a:, 2, tabpagenr()) | |
1 0.000013 0.000008 let uniq_nr = s:make_uniq_nr() | |
1 0.000006 call settabwinvar(tabnr, winnr, s:prefix . "_gift_uniq_winnr", uniq_nr) | |
1 0.000002 return uniq_nr | |
FUNCTION 470() | |
Called 30 times | |
Total time: 0.000200 | |
Self time: 0.000200 | |
count total (s) self (s) | |
30 0.000119 if has_key(self, "value") | |
29 0.000035 return | |
endif | |
1 0.000003 let self.value = &cmdheight | |
FUNCTION 471() | |
Called 2 times | |
Total time: 0.000020 | |
Self time: 0.000020 | |
count total (s) self (s) | |
2 0.000005 if has_key(self, "value") | |
1 0.000006 let &cmdheight = self.value | |
1 0.000001 unlet self.value | |
1 0.000000 endif | |
FUNCTION 472() | |
Called 30 times | |
Total time: 0.000086 | |
Self time: 0.000086 | |
count total (s) self (s) | |
30 0.000061 return self.value | |
FUNCTION 474() | |
Called 30 times | |
Total time: 0.001273 | |
Self time: 0.001273 | |
count total (s) self (s) | |
30 0.001068 execute self.draw_command | |
" execute "echohl" a:cmdline.highlights.prompt | |
" call s:echon(a:cmdline.get_prompt()) | |
" echohl NONE | |
" call s:echon(a:cmdline.backward()) | |
" if empty(a:cmdline.line.pos_char()) | |
" execute "echohl" a:cmdline.highlights.cursor | |
" call s:echon(' ') | |
" else | |
" execute "echohl" a:cmdline.highlights.cursor_on | |
" call s:echon(a:cmdline.line.pos_char()) | |
" endif | |
" echohl NONE | |
" call s:echon(a:cmdline.forward()) | |
" if a:cmdline.get_suffix() != "" | |
" call s:echon(s:suffix(a:cmdline.get_prompt() . a:cmdline.getline() . repeat(" ", empty(a:cmdline.line.pos_char())), a:cmdline.get_suffix())) | |
" endif | |
FUNCTION <SNR>103__execute_search() | |
Called 32 times | |
Total time: 1.218723 | |
Self time: 1.218723 | |
count total (s) self (s) | |
" :nohlsearch | |
" Please do not highlight at the first place if you set back | |
" info! I'll handle it myself :h function-search-undo | |
31 1.125498 execute s:keeppattern 'keepjumps' 'normal!' a:cmd | nohlsearch | |
FUNCTION 476() | |
Called 1 time | |
Total time: 0.000019 | |
Self time: 0.000006 | |
count total (s) self (s) | |
1 0.000017 0.000004 call s:cmdheight.restore() | |
FUNCTION <SNR>129_make() | |
Called 1 time | |
Total time: 0.000005 | |
Self time: 0.000005 | |
count total (s) self (s) | |
1 0.000005 return deepcopy(s:module) | |
FUNCTION <SNR>103_silent_after_search() | |
Called 1 time | |
Total time: 0.000068 | |
Self time: 0.000048 | |
count total (s) self (s) | |
" :h function-search-undo | |
1 0.000005 let m = get(a:, 1, mode(1)) | |
1 0.000002 if m !=# 'no' " guard for operator-mapping | |
1 0.000044 0.000024 let cmd = join([ (s:U.is_visual(m) ? "\<Plug>(_incsearch-esc)" : ''), "\<Plug>(_incsearch-hlsearch)", "\<Plug>(_incsearch-searchforward)", (s:U.is_visual(m) ? "\<Plug>(_incsearch-gv)" : '') ], '') | |
1 0.000006 call feedkeys(cmd, 'm') | |
1 0.000001 endif | |
FUNCTION <SNR>136_make_emacs() | |
Called 1 time | |
Total time: 0.000005 | |
Self time: 0.000005 | |
count total (s) self (s) | |
1 0.000004 return deepcopy(s:emacs) | |
FUNCTION airline#util#shorten() | |
Called 39 times | |
Total time: 0.000497 | |
Self time: 0.000497 | |
count total (s) self (s) | |
39 0.000216 if winwidth(0) < a:winwidth && len(split(a:text, '\zs')) > a:minwidth | |
return matchstr(a:text, '^.\{'.a:minwidth.'}').'…' | |
else | |
39 0.000069 return a:text | |
endif | |
FUNCTION <SNR>103_emulate_search_error() | |
Called 1 time | |
Total time: 0.196030 | |
Self time: 0.000354 | |
count total (s) self (s) | |
1 0.000007 let from = get(a:, 1, winsaveview()) | |
1 0.000003 let keyseq = (a:direction == s:DIRECTION.forward ? '/' : '?') | |
1 0.000002 let old_errmsg = v:errmsg | |
1 0.000002 let v:errmsg = '' | |
" NOTE: | |
" - XXX: Handle `n` and `N` preparation with s:silent_after_search() | |
" - silent!: Do not show error and warning message, because it also | |
" echo v:throwpoint for error and save messages in message-history | |
" - Unlike v:errmsg, v:warningmsg doesn't set if it use :silent! | |
" Get first error | |
1 0.100955 0.000008 silent! call incsearch#execute_search(keyseq . "\<CR>") | |
1 0.000109 call winrestview(from) | |
1 0.000003 if g:incsearch#do_not_save_error_message_history | |
if v:errmsg !=# '' | |
call s:Error(v:errmsg) | |
else | |
let v:errmsg = old_errmsg | |
endif | |
else | |
" NOTE: show more than two errors e.g. `/\za` | |
1 0.000003 let last_error = v:errmsg | |
1 0.000002 try | |
" Do not use silent! to show warning | |
1 0.093176 0.000013 call incsearch#execute_search(keyseq . "\<CR>") | |
catch /^Vim\%((\a\+)\)\=:E/ | |
1 0.000026 let first_error = matchlist(v:exception, '\v^Vim%(\(\a+\))=:(E.*)$')[1] | |
1 0.001578 0.000012 call s:Error(first_error, 'echom') | |
1 0.000002 if last_error !=# '' && last_error !=# first_error | |
call s:Error(last_error, 'echom') | |
endif | |
1 0.000002 finally | |
1 0.000105 call winrestview(from) | |
1 0.000002 endtry | |
1 0.000002 if v:errmsg ==# '' | |
let v:errmsg = old_errmsg | |
endif | |
1 0.000001 endif | |
FUNCTION 480() | |
Called 30 times | |
Total time: 0.001861 | |
Self time: 0.000825 | |
count total (s) self (s) | |
30 0.001286 0.000250 if a:cmdline.is_input("\<C-v>") || a:cmdline.is_input("\<C-q>") | |
let old_line = a:cmdline.getline() | |
let old_pos = a:cmdline.getpos() | |
call a:cmdline.insert('^') | |
call a:cmdline.setpos(old_pos) | |
call a:cmdline.draw() | |
let char = a:cmdline.getchar() | |
call a:cmdline.setline(old_line) | |
call a:cmdline.setpos(old_pos) | |
call a:cmdline.setchar(char) | |
endif | |
FUNCTION 481() | |
Called 30 times | |
Total time: 0.001510 | |
Self time: 0.000488 | |
count total (s) self (s) | |
30 0.001272 0.000283 if a:cmdline.is_input("\<CR>") || a:cmdline.is_input("\<NL>") | |
1 0.000029 0.000007 call a:cmdline.setchar('') | |
1 0.000023 0.000012 call a:cmdline.exit(self.exit_code) | |
1 0.000002 endif | |
FUNCTION 488() | |
Called 30 times | |
Total time: 0.002274 | |
Self time: 0.001754 | |
count total (s) self (s) | |
30 0.000660 0.000140 if a:cmdline.is_input("\<C-r>") | |
call a:cmdline.setchar('"') | |
let self.prefix_key = a:cmdline.input_key() | |
let self.old_line = a:cmdline.getline() | |
let self.old_pos = a:cmdline.getpos() | |
return | |
elseif exists("self.prefix_key") && a:cmdline.get_tap_key() == self.prefix_key | |
call a:cmdline.setline(self.old_line) | |
call a:cmdline.setpos(self.old_pos) | |
let char = a:cmdline.input_key() | |
if char =~ '^[0-9a-zA-z.%#:/"\-*+]$' | |
let register = tr(getreg(char), "\n", "\r") | |
call a:cmdline.setchar(register) | |
elseif char == "=" | |
call a:cmdline.setchar(s:input(a:cmdline)) | |
elseif char == "\<C-w>" | |
call a:cmdline.setchar(s:get_cmdline_cword(a:cmdline.backward_word(), self.cword)) | |
elseif char == "\<C-a>" | |
call a:cmdline.setchar(self.cWORD) | |
elseif char == "\<C-f>" | |
call a:cmdline.setchar(self.cfile) | |
elseif char == "\<C-r>" | |
call a:cmdline.setchar('"') | |
else | |
call a:cmdline.setchar("") | |
endif | |
" elseif a:cmdline.is_input('=', self.prefix_key) | |
" call a:cmdline.setchar(s:input(a:cmdline)) | |
" elseif a:cmdline.is_input("\<C-w>", self.prefix_key) | |
" call a:cmdline.setchar(self.cword) | |
" elseif a:cmdline.is_input("\<C-a>", self.prefix_key) | |
" call a:cmdline.setchar(self.cWORD) | |
" elseif a:cmdline.is_input("\<C-f>", self.prefix_key) | |
" call a:cmdline.setchar(self.cfile) | |
" elseif a:cmdline.is_input("\<C-r>", self.prefix_key) | |
" call a:cmdline.setchar('"') | |
" else | |
" call a:cmdline.setchar("") | |
" endif | |
endif | |
FUNCTION 489() | |
Called 30 times | |
Total time: 0.001277 | |
Self time: 0.000742 | |
count total (s) self (s) | |
30 0.000691 0.000156 if a:cmdline.is_input("\<C-r>") | |
call a:cmdline.tap_keyinput(self.prefix_key) | |
call a:cmdline.disable_keymapping() | |
call a:cmdline.setpos(a:cmdline.getpos()-1) | |
else | |
30 0.000091 if exists("self.prefix_key") | |
call a:cmdline.untap_keyinput(self.prefix_key) | |
call a:cmdline.enable_keymapping() | |
unlet! self.prefix_key | |
endif | |
30 0.000025 endif | |
FUNCTION vital#_incsearch#Over#String#import() | |
Called 1 time | |
Total time: 0.000031 | |
Self time: 0.000031 | |
count total (s) self (s) | |
1 0.000029 return map({'_vital_depends': '', 'length': '', 'index': '', 'split_by_keys': '', 'make': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>107__exists_autoload_func_with_source() | |
Called 39 times | |
Total time: 0.029057 | |
Self time: 0.001777 | |
count total (s) self (s) | |
39 0.000207 if exists('*' . a:funcname) | |
" Return true if a given func is already defined | |
return 1 | |
endif | |
" source a file which may include a given func definition and try again. | |
39 0.000877 let path = 'autoload/' . substitute(substitute(a:funcname, '#[^#]*$', '.vim', ''), '#', '/', 'g') | |
39 0.027548 0.000268 call s:_runtime(path) | |
39 0.000248 return exists('*' . a:funcname) | |
FUNCTION vital#_incsearch#Gift#Tabpage#import() | |
Called 1 time | |
Total time: 0.000021 | |
Self time: 0.000021 | |
count total (s) self (s) | |
1 0.000020 return map({'uniq_nr': '', 'make_uniq_nr': '', 'numbering': '', 'set_prefix': ''}, 'function("s:" . v:key)') | |
FUNCTION vital#_incsearch#Over#Commandline#Modules#History#import() | |
Called 1 time | |
Total time: 0.000013 | |
Self time: 0.000013 | |
count total (s) self (s) | |
1 0.000011 return map({'make': ''}, 'function("s:" . v:key)') | |
FUNCTION vital#_incsearch#Over#Commandline#Modules#Doautocmd#import() | |
Called 1 time | |
Total time: 0.000027 | |
Self time: 0.000027 | |
count total (s) self (s) | |
1 0.000025 return map({'_vital_depends': '', 'doautocmd_user': '', 'get_cmdline': '', 'make': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>110_make() | |
Called 1 time | |
Total time: 0.000143 | |
Self time: 0.000062 | |
count total (s) self (s) | |
1 0.000040 let result = deepcopy(s:base) | |
1 0.000016 0.000012 call result.set_prompt(get(a:, 1, ":")) | |
1 0.000084 0.000007 call result.connect(result, "_") | |
1 0.000002 return result | |
FUNCTION 490() | |
Called 1 time | |
Total time: 0.000004 | |
Self time: 0.000004 | |
count total (s) self (s) | |
1 0.000004 let self.search_register = @/ | |
FUNCTION 491() | |
Called 30 times | |
Total time: 0.003189 | |
Self time: 0.000915 | |
count total (s) self (s) | |
30 0.000154 if exists('self.prefix_key') && a:cmdline.get_tap_key() == self.prefix_key | |
call a:cmdline.setline(self.old_line) | |
call a:cmdline.setpos(self.old_pos) | |
let char = a:cmdline.input_key() | |
if char ==# '/' | |
let register = tr(self.search_register, "\n", "\r") | |
call a:cmdline.setchar(register) | |
return | |
endif | |
endif | |
30 0.002505 0.000231 return call(s:InsertRegister_orig_on_char_pre, [a:cmdline], self) | |
FUNCTION 493() | |
Called 30 times | |
Total time: 0.000982 | |
Self time: 0.000441 | |
count total (s) self (s) | |
30 0.000667 0.000126 if a:cmdline.is_input("<Over>(paste)") | |
let register = v:register == "" ? '"' : v:register | |
call a:cmdline.insert(tr(getreg("*"), "\n", "\r")) | |
call a:cmdline.setchar('') | |
endif | |
FUNCTION vital#_incsearch#Over#Commandline#Maker#import() | |
Called 1 time | |
Total time: 0.000049 | |
Self time: 0.000049 | |
count total (s) self (s) | |
1 0.000047 return map({'plain': '', '_vital_depends': '', 'standard_search': '', 'standard': '', 'standard_search_back': '', 'default': '', '_vital_loaded': ''}, 'function("s:" . v:key)') | |
FUNCTION incsearch#config#make() | |
Called 1 time | |
Total time: 0.000318 | |
Self time: 0.000053 | |
count total (s) self (s) | |
1 0.000050 0.000021 let default = extend(deepcopy(s:config), s:lazy_config()) | |
1 0.000252 0.000016 let c = s:U.deepextend(default, a:additional) | |
1 0.000005 if c.prompt is# '' | |
1 0.000005 let c.prompt = c.command | |
1 0.000002 endif | |
1 0.000003 return c | |
FUNCTION <SNR>120_make() | |
Called 1 time | |
Total time: 0.000005 | |
Self time: 0.000005 | |
count total (s) self (s) | |
1 0.000005 return deepcopy(s:module) | |
FUNCTION <SNR>149__vital_created() | |
Called 1 time | |
Total time: 0.000029 | |
Self time: 0.000029 | |
count total (s) self (s) | |
" define constant variables | |
1 0.000003 if !exists('s:const') | |
1 0.000002 let s:const = {} | |
1 0.000005 let s:const.is_local_variable_supported = v:version > 703 || (v:version == 703 && has('patch560')) | |
" NOTE: | |
" The third argument is available from 7.4.242 but it had bug and that | |
" bug was fixed from 7.4.513 | |
1 0.000007 let s:const.is_third_argument_of_getreg_supported = has('patch-7.4.513') | |
1 0.000002 lockvar s:const | |
1 0.000001 endif | |
1 0.000004 call extend(a:module, s:const) | |
FUNCTION <SNR>137_parse_lhs() | |
Called 5 times | |
Total time: 0.000216 | |
Self time: 0.000216 | |
count total (s) self (s) | |
5 0.000035 let mode = get(a:, 1, '[!nvoicsxl]') | |
" NOTE: :map! Surpport : https://github.com/osyo-manga/vital-palette/issues/4 | |
5 0.000044 if get(a:, 1, "") =~# '[!ci]' | |
5 0.000014 let mode = '[!ci]' | |
5 0.000007 endif | |
5 0.000105 return matchstr(a:text, mode . '\{1,3\}\s*\zs\S\{-}\ze\s\+') | |
FUNCTION <SNR>122_make() | |
Called 1 time | |
Total time: 0.000006 | |
Self time: 0.000006 | |
count total (s) self (s) | |
1 0.000006 return deepcopy(s:module) | |
FUNCTION <SNR>104_funcmanage() | |
Called 60 times | |
Total time: 0.000151 | |
Self time: 0.000151 | |
count total (s) self (s) | |
60 0.000122 return s:funcmanage | |
FUNCTION <SNR>105_keymap() | |
Called 1 time | |
Total time: 0.000009 | |
Self time: 0.000009 | |
count total (s) self (s) | |
1 0.000008 return extend(copy(s:default_keymappings), g:incsearch_cli_key_mappings) | |
FUNCTION <SNR>116_make() | |
Called 9 times | |
Total time: 0.008082 | |
Self time: 0.000155 | |
count total (s) self (s) | |
9 0.007921 0.000050 let module = s:get(a:name) | |
9 0.000155 0.000099 return call(module.make, a:000, module) | |
FUNCTION <SNR>130_make() | |
Called 1 time | |
Total time: 0.000005 | |
Self time: 0.000005 | |
count total (s) self (s) | |
1 0.000004 return deepcopy(s:module) | |
FUNCTION <SNR>104_dictfunction() | |
Called 30 times | |
Total time: 0.010311 | |
Self time: 0.009594 | |
count total (s) self (s) | |
30 0.008073 let funcname = '_' . matchstr(string(a:dictfunc), '\d\+') | |
30 0.000279 let s:funcmanage[funcname] = { 'func': a:dictfunc, 'dict': a:dict } | |
30 0.000933 0.000216 let prefix = '<SNR>' . s:SID() . '_' | |
30 0.000185 let fm = printf("%sfuncmanage()['%s']", prefix, funcname) | |
30 0.000575 execute join([ printf('function! s:%s(...) abort', funcname), printf(" return call(%s['func'], a:000, %s['dict'])", fm, fm), 'endfunction' ], "\n") | |
30 0.000202 return function(printf('%s%s', prefix, funcname)) | |
FUNCTION vital#_incsearch#Over#Commandline#Modules#NoInsert#import() | |
Called 1 time | |
Total time: 0.000015 | |
Self time: 0.000015 | |
count total (s) self (s) | |
1 0.000015 return map({'make_special_chars': '', 'make': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>124_make() | |
Called 1 time | |
Total time: 0.000006 | |
Self time: 0.000006 | |
count total (s) self (s) | |
1 0.000005 return deepcopy(s:module) | |
FUNCTION <SNR>136__auto_cmap() | |
Called 1 time | |
Total time: 0.001209 | |
Self time: 0.000169 | |
count total (s) self (s) | |
1 0.000003 let cmaps = {} | |
1 0.000755 0.000011 let cmap_info = s:Keymapping.rhs_key_list("c", 0, 1) | |
" vital-over currently doesn't support <buffer> mappings | |
6 0.000014 for c in filter(cmap_info, "v:val['buffer'] ==# 0") | |
5 0.000417 0.000121 let cmaps[s:Keymapping.escape_special_key(c['lhs'])] = { 'noremap' : c['noremap'], 'key' : s:Keymapping.escape_special_key(s:_convert_sid(c['rhs'], c['sid'])), 'expr' : s:Keymapping.escape_special_key(c['expr']), } | |
5 0.000008 endfor | |
1 0.000001 return cmaps | |
FUNCTION <SNR>144_init_hl() | |
Called 1 time | |
Total time: 0.000040 | |
Self time: 0.000040 | |
count total (s) self (s) | |
1 0.000011 hi default link IncSearchMatch Search | |
1 0.000013 hi default link IncSearchMatchReverse IncSearch | |
1 0.000004 hi default link IncSearchCursor Cursor | |
1 0.000004 hi default link IncSearchOnCursor IncSearch | |
1 0.000007 hi default IncSearchUnderline term=underline cterm=underline gui=underline | |
FUNCTION <SNR>122__vital_loaded() | |
Called 1 time | |
Total time: 0.000079 | |
Self time: 0.000011 | |
count total (s) self (s) | |
1 0.000077 0.000009 let s:Input = a:V.import("Over.Input") | |
FUNCTION <SNR>131__vital_loaded() | |
Called 1 time | |
Total time: 0.000738 | |
Self time: 0.000009 | |
count total (s) self (s) | |
1 0.000003 let s:V = a:V | |
1 0.000735 0.000006 let s:E = s:V.import("Over.Exception") | |
FUNCTION <SNR>137__capture() | |
Called 1 time | |
Total time: 0.000189 | |
Self time: 0.000026 | |
count total (s) self (s) | |
1 0.000003 let cmd = "map" | |
1 0.000002 if a:mode ==# "!" | |
let cmd = cmd . "!" | |
elseif a:mode =~# "[nvoicsxl]" | |
1 0.000003 let cmd = a:mode . cmd | |
1 0.000001 endif | |
1 0.000171 0.000008 return s:Capture.command(cmd) | |
FUNCTION <SNR>111__split_keystring() | |
Called 61 times | |
Total time: 0.001552 | |
Self time: 0.001552 | |
count total (s) self (s) | |
61 0.001514 return split(a:str, s:_engine . '\m\%(' . get(a:, 1, '') . s:_regex . '\)') | |
FUNCTION vital#_incsearch#Over#Commandline#Modules#ExceptionExit#import() | |
Called 1 time | |
Total time: 0.000011 | |
Self time: 0.000011 | |
count total (s) self (s) | |
1 0.000011 return map({'make': ''}, 'function("s:" . v:key)') | |
FUNCTION <SNR>135_make_special_chars() | |
Called 1 time | |
Total time: 0.000031 | |
Self time: 0.000016 | |
count total (s) self (s) | |
1 0.000024 0.000009 let module = s:make([]) | |
1 0.000002 function! module.is_no_insert(char) | |
return char2nr(a:char) == 128 || char2nr(a:char) < 27 | |
endfunction | |
1 0.000001 return module | |
FUNCTION 351() | |
Called 31 times | |
Total time: 0.010971 | |
Self time: 0.008851 | |
count total (s) self (s) | |
31 0.000127 if type(a:module) == type("") | |
9 0.008185 0.000103 return call(self.connect, [s:Module.make(a:module)] + a:000, self) | |
endif | |
22 0.000050 if empty(a:module) | |
return | |
endif | |
22 0.000081 let name = a:0 > 0 ? a:1 : a:module.name | |
22 0.000970 0.000199 let slot = self.variables.modules.find_first_by("get(v:val.slot, 'name', '') == " . string(name)) | |
22 0.000055 if empty(slot) | |
22 0.000463 0.000179 call self.variables.modules.connect({ "name" : name, "module" : a:module }) | |
22 0.000025 else | |
let slot.slot.module = a:module | |
endif | |
" let self.variables.modules[name] = a:module | |
FUNCTIONS SORTED ON TOTAL TIME | |
count total (s) self (s) function | |
1 1.680380 0.000228 incsearch#_go() | |
1 1.433540 0.000038 <SNR>103_get_input() | |
1 1.433492 0.000033 371() | |
1 1.433452 0.000011 369() | |
1 1.433441 0.000763 385() | |
30 1.420800 0.000847 384() | |
154 1.397949 0.002627 354() | |
154 1.318160 0.002085 434() | |
154 1.299094 0.016371 <SNR>113_call() | |
30 1.268454 0.002887 383() | |
31 1.245629 0.002648 382() | |
30 1.237227 0.001117 381() | |
32 1.219215 0.000492 incsearch#execute_search() | |
32 1.218723 <SNR>103__execute_search() | |
60 1.114704 0.002884 <SNR>143_on_searching() | |
30 1.100188 0.000336 649() | |
30 1.098454 0.003570 <SNR>143_on_char() | |
30 1.046621 0.007298 <SNR>143_move_cursor() | |
1 0.196831 0.000602 <SNR>103_set_search_related_stuff() | |
1 0.196030 0.000354 <SNR>103_emulate_search_error() | |
FUNCTIONS SORTED ON SELF TIME | |
count total (s) self (s) function | |
32 1.218723 <SNR>103__execute_search() | |
30 0.080631 0.079841 <SNR>124__redraw() | |
7083 0.039455 <SNR>112__compare() | |
30 0.031606 548() | |
154 0.075838 0.017872 <SNR>112_sort_by() | |
154 0.056702 0.017247 <SNR>112_sort() | |
1367 0.023102 0.016820 341() | |
154 1.299094 0.016371 <SNR>113_call() | |
669 0.014663 0.014633 <SNR>152_uniq_nr() | |
184 0.020996 0.011921 439() | |
50 0.093546 0.010541 <SNR>107__import() | |
30 0.010311 0.009594 <SNR>104_dictfunction() | |
4046 0.009075 440() | |
31 0.010971 0.008851 351() | |
30 0.012532 0.008094 389() | |
30 1.046621 0.007298 <SNR>143_move_cursor() | |
39 0.027280 0.006484 <SNR>107__runtime() | |
124 0.008275 0.005702 <SNR>131_doautocmd_user() | |
30 0.013366 0.005206 <SNR>143_on_char_pre() | |
62 0.004183 incsearch#parse_pattern() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment