Created
May 23, 2015 20:13
-
-
Save splinterofchaos/440de336083cf2f6078f to your computer and use it in GitHub Desktop.
gita.profile
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 /usr/local/share/nvim/runtime/syntax/syncolor.vim | |
Sourced 1 time | |
Total time: 0.001307 | |
Self time: 0.001307 | |
count total (s) self (s) | |
" Vim syntax support file | |
" Maintainer: Bram Moolenaar <[email protected]> | |
" Last Change: 2001 Sep 12 | |
" This file sets up the default methods for highlighting. | |
" It is loaded from "synload.vim" and from Vim for ":syntax reset". | |
" Also used from init_highlight(). | |
1 0.000018 if !exists("syntax_cmd") || syntax_cmd == "on" | |
" ":syntax on" works like in Vim 5.7: set colors but keep links | |
1 0.000030 command -nargs=* SynColor hi <args> | |
1 0.000021 command -nargs=* SynLink hi link <args> | |
1 0.000004 else | |
if syntax_cmd == "enable" | |
" ":syntax enable" keeps any existing colors | |
command -nargs=* SynColor hi def <args> | |
command -nargs=* SynLink hi def link <args> | |
elseif syntax_cmd == "reset" | |
" ":syntax reset" resets all colors to the default | |
command -nargs=* SynColor hi <args> | |
command -nargs=* SynLink hi! link <args> | |
else | |
" User defined syncolor file has already set the colors. | |
finish | |
endif | |
endif | |
" Many terminals can only use six different colors (plus black and white). | |
" Therefore the number of colors used is kept low. It doesn't look nice with | |
" too many colors anyway. | |
" Careful with "cterm=bold", it changes the color to bright for some terminals. | |
" There are two sets of defaults: for a dark and a light background. | |
1 0.000008 if &background == "dark" | |
1 0.000035 SynColor Comment term=bold cterm=NONE ctermfg=Cyan ctermbg=NONE gui=NONE guifg=#80a0ff guibg=NONE | |
1 0.000029 SynColor Constant term=underline cterm=NONE ctermfg=Magenta ctermbg=NONE gui=NONE guifg=#ffa0a0 guibg=NONE | |
1 0.000028 SynColor Special term=bold cterm=NONE ctermfg=LightRed ctermbg=NONE gui=NONE guifg=Orange guibg=NONE | |
1 0.000027 SynColor Identifier term=underline cterm=bold ctermfg=Cyan ctermbg=NONE gui=NONE guifg=#40ffff guibg=NONE | |
1 0.000027 SynColor Statement term=bold cterm=NONE ctermfg=Yellow ctermbg=NONE gui=bold guifg=#ffff60 guibg=NONE | |
1 0.000027 SynColor PreProc term=underline cterm=NONE ctermfg=LightBlue ctermbg=NONE gui=NONE guifg=#ff80ff guibg=NONE | |
1 0.000028 SynColor Type term=underline cterm=NONE ctermfg=LightGreen ctermbg=NONE gui=bold guifg=#60ff60 guibg=NONE | |
1 0.000026 SynColor Underlined term=underline cterm=underline ctermfg=LightBlue gui=underline guifg=#80a0ff | |
1 0.000035 SynColor Ignore term=NONE cterm=NONE ctermfg=black ctermbg=NONE gui=NONE guifg=bg guibg=NONE | |
1 0.000004 else | |
SynColor Comment term=bold cterm=NONE ctermfg=DarkBlue ctermbg=NONE gui=NONE guifg=Blue guibg=NONE | |
SynColor Constant term=underline cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=Magenta guibg=NONE | |
SynColor Special term=bold cterm=NONE ctermfg=DarkMagenta ctermbg=NONE gui=NONE guifg=SlateBlue guibg=NONE | |
SynColor Identifier term=underline cterm=NONE ctermfg=DarkCyan ctermbg=NONE gui=NONE guifg=DarkCyan guibg=NONE | |
SynColor Statement term=bold cterm=NONE ctermfg=Brown ctermbg=NONE gui=bold guifg=Brown guibg=NONE | |
SynColor PreProc term=underline cterm=NONE ctermfg=DarkMagenta ctermbg=NONE gui=NONE guifg=Purple guibg=NONE | |
SynColor Type term=underline cterm=NONE ctermfg=DarkGreen ctermbg=NONE gui=bold guifg=SeaGreen guibg=NONE | |
SynColor Underlined term=underline cterm=underline ctermfg=DarkMagenta gui=underline guifg=SlateBlue | |
SynColor Ignore term=NONE cterm=NONE ctermfg=white ctermbg=NONE gui=NONE guifg=bg guibg=NONE | |
endif | |
1 0.000033 SynColor Error term=reverse cterm=NONE ctermfg=White ctermbg=Red gui=NONE guifg=White guibg=Red | |
1 0.000031 SynColor Todo term=standout cterm=NONE ctermfg=Black ctermbg=Yellow gui=NONE guifg=Blue guibg=Yellow | |
" Common groups that link to default highlighting. | |
" You can specify other highlighting easily. | |
1 0.000029 SynLink String Constant | |
1 0.000029 SynLink Character Constant | |
1 0.000028 SynLink Number Constant | |
1 0.000028 SynLink Boolean Constant | |
1 0.000030 SynLink Float Number | |
1 0.000028 SynLink Function Identifier | |
1 0.000028 SynLink Conditional Statement | |
1 0.000028 SynLink Repeat Statement | |
1 0.000028 SynLink Label Statement | |
1 0.000028 SynLink Operator Statement | |
1 0.000028 SynLink Keyword Statement | |
1 0.000027 SynLink Exception Statement | |
1 0.000027 SynLink Include PreProc | |
1 0.000027 SynLink Define PreProc | |
1 0.000027 SynLink Macro PreProc | |
1 0.000028 SynLink PreCondit PreProc | |
1 0.000027 SynLink StorageClass Type | |
1 0.000027 SynLink Structure Type | |
1 0.000027 SynLink Typedef Type | |
1 0.000027 SynLink Tag Special | |
1 0.000028 SynLink SpecialChar Special | |
1 0.000027 SynLink Delimiter Special | |
1 0.000028 SynLink SpecialComment Special | |
1 0.000027 SynLink Debug Special | |
1 0.000007 delcommand SynColor | |
1 0.000008 delcommand SynLink | |
SCRIPT /home/admin/.vim/bundle/colorschemes/colors/tango2.vim | |
Sourced 1 time | |
Total time: 0.006925 | |
Self time: 0.005581 | |
count total (s) self (s) | |
" ============================================================================= | |
" Name: Tango2 | |
" Purpose: Another colour scheme using the Tango colour palette | |
" Maintainer: Pranesh Srinivasan | |
" Last Modified: Saturday 04 October 2008 02:06:26 AM IST | |
" ============================================================================= | |
" Inspired from some Gnome renditions of the Tango colour scheme. | |
" ============================================================================= | |
" Preamble | |
" ============================================================================= | |
1 0.000014 set background=dark | |
1 0.001674 hi clear | |
1 0.000010 if exists("syntax-on") | |
syntax reset | |
endif | |
1 0.000011 let colors_name = "tango2" | |
" ============================================================================= | |
" Vim >= 7.0 specific colours | |
" ============================================================================= | |
1 0.000007 if version >= 700 | |
" No support for cursor line yet | |
" hi CursorLine term=underline cterm=underline guibg=#111133 | |
" hi CursorColoumn | |
" hi MatchParen | |
" hi Pmenu | |
" hi PmenuSel | |
1 0.000003 endif | |
" ============================================================================= | |
" General colours | |
" ============================================================================= | |
1 0.002204 hi Normal guibg=#2E3436 guifg=#eeeeec | |
1 0.000077 hi Cursor gui=none guibg=White guifg=Black | |
1 0.000024 hi Folded guibg=#4D585B guibg=#d2d2d2 | |
" No fold column support yet | |
" hi FoldColumn guifg=Orange guibg=DarkBlue | |
" ============================================================================= | |
" Syntax highlighting | |
" ============================================================================= | |
1 0.000021 hi Comment gui=italic guifg=#6d7e8a ctermfg=Grey | |
1 0.000018 hi Todo term=bold guifg=#EBC450 | |
1 0.000017 hi Constant guifg=#8ae234 | |
1 0.000017 hi Type guifg=#8AE234 | |
1 0.000018 hi Function gui=bold guifg=#9BCF8D | |
1 0.000017 hi Statement guifg=#729FCF | |
1 0.000016 hi Identifier guifg=#AD7FA8 | |
1 0.000017 hi PreProc guifg=#e9ba6e | |
1 0.000023 hi Special term=underline guifg=#5EAFE5 | |
1 0.000019 hi Search guibg=#81ABBD | |
" hi QtClass guifg=Orange ctermfg=LightBlue | |
SCRIPT /usr/local/share/nvim/runtime/ftplugin/c.vim | |
Sourced 1 time | |
Total time: 0.000388 | |
Self time: 0.000388 | |
count total (s) self (s) | |
" Vim filetype plugin file | |
" Language: C | |
" Maintainer: Bram Moolenaar <[email protected]> | |
" Last Change: 2012 Jul 10 | |
" Only do this when not done yet for this buffer | |
1 0.000015 if exists("b:did_ftplugin") | |
finish | |
endif | |
" Don't load another plugin for this buffer | |
1 0.000009 let b:did_ftplugin = 1 | |
" Using line continuation here. | |
1 0.000023 let s:cpo_save = &cpo | |
1 0.000026 set cpo-=C | |
1 0.000009 let b:undo_ftplugin = "setl fo< com< ofu<" | |
" Set 'formatoptions' to break comment lines but not other lines, | |
" and insert the comment leader when hitting <CR> or using "o". | |
1 0.000032 setlocal fo-=t fo+=croql | |
" Set completion with CTRL-X CTRL-O to autoloaded function. | |
1 0.000014 if exists('&ofu') | |
1 0.000013 setlocal ofu=ccomplete#Complete | |
1 0.000004 endif | |
" Set 'comments' to format dashed lists in comments. | |
1 0.000011 setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// | |
" When the matchit plugin is loaded, this makes the % command skip parens and | |
" braces in comments. | |
1 0.000014 let b:match_words = &matchpairs . ',^\s*#\s*if\(\|def\|ndef\)\>:^\s*#\s*elif\>:^\s*#\s*else\>:^\s*#\s*endif\>' | |
1 0.000009 let b:match_skip = 's:comment\|string\|character' | |
" Win32 can filter files in the browse dialog | |
1 0.000023 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") | |
if &ft == "cpp" | |
let b:browsefilter = "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" . | |
\ "C Header Files (*.h)\t*.h\n" . | |
\ "C Source Files (*.c)\t*.c\n" . | |
\ "All Files (*.*)\t*.*\n" | |
elseif &ft == "ch" | |
let b:browsefilter = "Ch Source Files (*.ch *.chf)\t*.ch;*.chf\n" . | |
\ "C Header Files (*.h)\t*.h\n" . | |
\ "C Source Files (*.c)\t*.c\n" . | |
\ "All Files (*.*)\t*.*\n" | |
else | |
let b:browsefilter = "C Source Files (*.c)\t*.c\n" . | |
\ "C Header Files (*.h)\t*.h\n" . | |
\ "Ch Source Files (*.ch *.chf)\t*.ch;*.chf\n" . | |
\ "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" . | |
\ "All Files (*.*)\t*.*\n" | |
endif | |
endif | |
1 0.000023 let &cpo = s:cpo_save | |
1 0.000008 unlet s:cpo_save | |
SCRIPT /home/admin/.vim/after/ftplugin/c/c.vim | |
Sourced 1 time | |
Total time: 0.000021 | |
Self time: 0.000021 | |
count total (s) self (s) | |
SCRIPT /usr/local/share/nvim/runtime/indent/c.vim | |
Sourced 1 time | |
Total time: 0.000075 | |
Self time: 0.000075 | |
count total (s) self (s) | |
" Vim indent file | |
" Language: C | |
" Maintainer: Bram Moolenaar <[email protected]> | |
" Last Change: 2005 Mar 27 | |
" Only load this indent file when no other was loaded. | |
1 0.000011 if exists("b:did_indent") | |
finish | |
endif | |
1 0.000008 let b:did_indent = 1 | |
" C indenting is built-in, thus this is very simple | |
1 0.000007 setlocal cindent | |
1 0.000009 let b:undo_indent = "setl cin<" | |
SCRIPT /usr/local/share/nvim/runtime/syntax/c.vim | |
Sourced 1 time | |
Total time: 0.010983 | |
Self time: 0.010983 | |
count total (s) self (s) | |
" Vim syntax file | |
" Language: C | |
" Maintainer: Bram Moolenaar <[email protected]> | |
" Last Change: 2014 Sep 23 | |
" Quit when a (custom) syntax file was already loaded | |
1 0.000014 if exists("b:current_syntax") | |
finish | |
endif | |
1 0.000028 let s:cpo_save = &cpo | |
1 0.000028 set cpo&vim | |
1 0.000044 let s:ft = matchstr(&ft, '^\([^.]\)\+') | |
" A bunch of useful C keywords | |
1 0.000146 syn keyword cStatement goto break return continue asm | |
1 0.000018 syn keyword cLabel case default | |
1 0.000016 syn keyword cConditional if else switch | |
1 0.000016 syn keyword cRepeat while for do | |
1 0.000020 syn keyword cTodo contained TODO FIXME XXX | |
" It's easy to accidentally add a space after a backslash that was intended | |
" for line continuation. Some compilers allow it, which makes it | |
" unpredictable and should be avoided. | |
1 0.000027 syn match cBadContinuation contained "\\\s\+$" | |
" cCommentGroup allows adding matches for special things in comments | |
1 0.000045 syn cluster cCommentGroup contains=cTodo,cBadContinuation | |
" String and Character constants | |
" Highlight special characters (those which have a backslash) differently | |
1 0.000032 syn match cSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)" | |
1 0.000012 if !exists("c_no_utf") | |
1 0.000032 syn match cSpecial display contained "\\\(u\x\{4}\|U\x\{8}\)" | |
1 0.000004 endif | |
1 0.000009 if !exists("c_no_cformat") | |
" Highlight % items in strings. | |
1 0.000008 if !exists("c_no_c99") " ISO C99 | |
1 0.000056 syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained | |
1 0.000005 else | |
syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained | |
endif | |
1 0.000020 syn match cFormat display "%%" contained | |
1 0.000004 endif | |
" cCppString: same as cString, but ends at end of line | |
1 0.000010 if s:ft ==# "cpp" && !exists("cpp_no_cpp11") | |
" ISO C++11 | |
syn region cString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend | |
syn region cCppString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell | |
elseif s:ft ==# "c" && !exists("c_no_c11") | |
" ISO C99 | |
1 0.000065 syn region cString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend | |
1 0.000072 syn region cCppString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell | |
1 0.000005 else | |
" older C or C++ | |
syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend | |
syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell | |
endif | |
1 0.000064 syn region cCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=cSpaceError,cCppSkip | |
1 0.000073 syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppSkip | |
1 0.000048 syn cluster cStringGroup contains=cCppString,cCppOut2,cCppSkip | |
1 0.000021 syn match cCharacter "L\='[^\\]'" | |
1 0.000036 syn match cCharacter "L'[^']*'" contains=cSpecial | |
1 0.000009 if exists("c_gnu") | |
syn match cSpecialError "L\='\\[^'\"?\\abefnrtv]'" | |
syn match cSpecialCharacter "L\='\\['\"?\\abefnrtv]'" | |
else | |
1 0.000025 syn match cSpecialError "L\='\\[^'\"?\\abfnrtv]'" | |
1 0.000024 syn match cSpecialCharacter "L\='\\['\"?\\abfnrtv]'" | |
1 0.000004 endif | |
1 0.000023 syn match cSpecialCharacter display "L\='\\\o\{1,3}'" | |
1 0.000022 syn match cSpecialCharacter display "'\\x\x\{1,2}'" | |
1 0.000022 syn match cSpecialCharacter display "L'\\x\x\+'" | |
1 0.000014 if (s:ft ==# "c" && !exists("c_no_c11")) || (s:ft ==# "cpp" && !exists("cpp_no_cpp11")) | |
" ISO C11 or ISO C++ 11 | |
1 0.000064 syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend | |
1 0.000021 syn match cCharacter "[Uu]'[^\\]'" | |
1 0.000038 syn match cCharacter "[Uu]'[^']*'" contains=cSpecial | |
1 0.000008 if exists("c_gnu") | |
syn match cSpecialError "[Uu]'\\[^'\"?\\abefnrtv]'" | |
syn match cSpecialCharacter "[Uu]'\\['\"?\\abefnrtv]'" | |
else | |
1 0.000025 syn match cSpecialError "[Uu]'\\[^'\"?\\abfnrtv]'" | |
1 0.000025 syn match cSpecialCharacter "[Uu]'\\['\"?\\abfnrtv]'" | |
1 0.000004 endif | |
1 0.000035 syn match cSpecialCharacter display "[Uu]'\\\o\{1,3}'" | |
1 0.000022 syn match cSpecialCharacter display "[Uu]'\\x\x\+'" | |
1 0.000003 endif | |
"when wanted, highlight trailing white space | |
1 0.000009 if exists("c_space_errors") | |
if !exists("c_no_trail_space_error") | |
syn match cSpaceError display excludenl "\s\+$" | |
endif | |
if !exists("c_no_tab_space_error") | |
syn match cSpaceError display " \+\t"me=e-1 | |
endif | |
endif | |
" This should be before cErrInParen to avoid problems with #define ({ xxx }) | |
1 0.000008 if exists("c_curly_error") | |
syn match cCurlyError "}" | |
syn region cBlock start="{" end="}" contains=ALLBUT,cBadBlock,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell fold | |
else | |
1 0.000024 syn region cBlock start="{" end="}" transparent fold | |
1 0.000004 endif | |
" Catch errors caused by wrong parenthesis and brackets. | |
" Also accept <% for {, %> for }, <: for [ and :> for ] (C99) | |
" But avoid matching <::. | |
1 0.000216 syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserLabel,cBitField,cOctalZero,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom | |
1 0.000010 if exists("c_no_curly_error") | |
if s:ft ==# 'cpp' && !exists("cpp_no_cpp11") | |
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,@cStringGroup,@Spell | |
" cCppParen: same as cParen but ends at end-of-line; used in cDefine | |
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell | |
syn match cParenError display ")" | |
syn match cErrInParen display contained "^^<%\|^%>" | |
else | |
syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,@cStringGroup,@Spell | |
" cCppParen: same as cParen but ends at end-of-line; used in cDefine | |
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell | |
syn match cParenError display ")" | |
syn match cErrInParen display contained "^[{}]\|^<%\|^%>" | |
endif | |
elseif exists("c_no_bracket_error") | |
if s:ft ==# 'cpp' && !exists("cpp_no_cpp11") | |
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,@cStringGroup,@Spell | |
" cCppParen: same as cParen but ends at end-of-line; used in cDefine | |
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell | |
syn match cParenError display ")" | |
syn match cErrInParen display contained "<%\|%>" | |
else | |
syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,@cStringGroup,@Spell | |
" cCppParen: same as cParen but ends at end-of-line; used in cDefine | |
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell | |
syn match cParenError display ")" | |
syn match cErrInParen display contained "[{}]\|<%\|%>" | |
endif | |
else | |
1 0.000009 if s:ft ==# 'cpp' && !exists("cpp_no_cpp11") | |
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell | |
" cCppParen: same as cParen but ends at end-of-line; used in cDefine | |
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell | |
syn match cParenError display "[\])]" | |
syn match cErrInParen display contained "<%\|%>" | |
syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,@cStringGroup,@Spell | |
else | |
1 0.000086 syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell | |
" cCppParen: same as cParen but ends at end-of-line; used in cDefine | |
1 0.000098 syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell | |
1 0.000019 syn match cParenError display "[\])]" | |
1 0.000023 syn match cErrInParen display contained "[\]{}]\|<%\|%>" | |
1 0.000142 syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cErrInParen,cCppParen,cCppBracket,@cStringGroup,@Spell | |
1 0.000006 endif | |
" cCppBracket: same as cParen but ends at end-of-line; used in cDefine | |
1 0.000099 syn region cCppBracket transparent start='\[\|<::\@!' skip='\\$' excludenl end=']\|:>' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString,@Spell | |
1 0.000023 syn match cErrInBracket display contained "[);{}]\|<%\|%>" | |
1 0.000004 endif | |
1 0.000009 if s:ft ==# 'c' || exists("cpp_no_cpp11") | |
1 0.000063 syn region cBadBlock keepend start="{" end="}" contained containedin=cParen,cBracket,cBadBlock transparent fold | |
1 0.000004 endif | |
"integer number, or floating point number without a dot and with "f". | |
1 0.000006 syn case ignore | |
1 0.000068 syn match cNumbers display transparent "\<\d\|\.\d" contains=cNumber,cFloat,cOctalError,cOctal | |
" Same, but without octal error (for comments) | |
1 0.000057 syn match cNumbersCom display contained transparent "\<\d\|\.\d" contains=cNumber,cFloat,cOctal | |
1 0.000025 syn match cNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>" | |
"hex number | |
1 0.000031 syn match cNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>" | |
" Flag the first zero of an octal number as something special | |
1 0.000038 syn match cOctal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=cOctalZero | |
1 0.000019 syn match cOctalZero display contained "\<0" | |
1 0.000020 syn match cFloat display contained "\d\+f" | |
"floating point number, with dot, optional exponent | |
1 0.000027 syn match cFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=" | |
"floating point number, starting with a dot, optional exponent | |
1 0.000025 syn match cFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>" | |
"floating point number, without dot, with exponent | |
1 0.000028 syn match cFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>" | |
1 0.000009 if !exists("c_no_c99") | |
"hexadecimal floating point number, optional leading digits, with dot, with exponent | |
1 0.000028 syn match cFloat display contained "0x\x*\.\x\+p[-+]\=\d\+[fl]\=\>" | |
"hexadecimal floating point number, with leading digits, optional dot, with exponent | |
1 0.000027 syn match cFloat display contained "0x\x\+\.\=p[-+]\=\d\+[fl]\=\>" | |
1 0.000004 endif | |
" flag an octal number with wrong digits | |
1 0.000021 syn match cOctalError display contained "0\o*[89]\d*" | |
1 0.000006 syn case match | |
1 0.000009 if exists("c_comment_strings") | |
" A comment can contain cString, cCharacter and cNumber. | |
" But a "*/" inside a cString in a cComment DOES end the comment! So we | |
" need to use a special type of cString: cCommentString, which also ends on | |
" "*/", and sees a "*" at the start of the line as comment again. | |
" Unfortunately this doesn't very well work for // type of comments :-( | |
syn match cCommentSkip contained "^\s*\*\($\|\s\+\)" | |
syn region cCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip | |
syn region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial | |
syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError,@Spell | |
if exists("c_no_comment_fold") | |
" Use "extend" here to have preprocessor lines not terminate halfway a | |
" comment. | |
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell extend | |
else | |
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell fold extend | |
endif | |
else | |
1 0.000048 syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cSpaceError,@Spell | |
1 0.000010 if exists("c_no_comment_fold") | |
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell extend | |
else | |
1 0.000061 syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell fold extend | |
1 0.000004 endif | |
1 0.000009 endif | |
" keep a // comment separately, it terminates a preproc. conditional | |
1 0.000018 syn match cCommentError display "\*/" | |
1 0.000019 syn match cCommentStartError display "/\*"me=e-1 contained | |
1 0.000014 syn keyword cOperator sizeof | |
1 0.000008 if exists("c_gnu") | |
syn keyword cStatement __asm__ | |
syn keyword cOperator typeof __real__ __imag__ | |
endif | |
1 0.000016 syn keyword cType int long short char void | |
1 0.000016 syn keyword cType signed unsigned float double | |
1 0.000010 if !exists("c_no_ansi") || exists("c_ansi_typedefs") | |
1 0.000020 syn keyword cType size_t ssize_t off_t wchar_t ptrdiff_t sig_atomic_t fpos_t | |
1 0.000020 syn keyword cType clock_t time_t va_list jmp_buf FILE DIR div_t ldiv_t | |
1 0.000023 syn keyword cType mbstate_t wctrans_t wint_t wctype_t | |
1 0.000004 endif | |
1 0.000008 if !exists("c_no_c99") " ISO C99 | |
1 0.000034 syn keyword cType _Bool bool _Complex complex _Imaginary imaginary | |
1 0.000015 syn keyword cType int8_t int16_t int32_t int64_t | |
1 0.000015 syn keyword cType uint8_t uint16_t uint32_t uint64_t | |
1 0.000015 syn keyword cType int_least8_t int_least16_t int_least32_t int_least64_t | |
1 0.000015 syn keyword cType uint_least8_t uint_least16_t uint_least32_t uint_least64_t | |
1 0.000015 syn keyword cType int_fast8_t int_fast16_t int_fast32_t int_fast64_t | |
1 0.000015 syn keyword cType uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t | |
1 0.000013 syn keyword cType intptr_t uintptr_t | |
1 0.000013 syn keyword cType intmax_t uintmax_t | |
1 0.000004 endif | |
1 0.000011 if exists("c_gnu") | |
syn keyword cType __label__ __complex__ __volatile__ | |
endif | |
1 0.000016 syn keyword cStructure struct union enum typedef | |
1 0.000018 syn keyword cStorageClass static register auto volatile extern const | |
1 0.000007 if exists("c_gnu") | |
syn keyword cStorageClass inline __attribute__ | |
endif | |
1 0.000008 if !exists("c_no_c99") | |
1 0.000013 syn keyword cStorageClass inline restrict | |
1 0.000004 endif | |
1 0.000008 if !exists("c_no_c11") | |
1 0.000014 syn keyword cStorageClass _Alignas alignas | |
1 0.000013 syn keyword cOperator _Alignof alignof | |
1 0.000013 syn keyword cStorageClass _Atomic | |
1 0.000012 syn keyword cOperator _Generic | |
1 0.000014 syn keyword cStorageClass _Noreturn noreturn | |
1 0.000014 syn keyword cOperator _Static_assert static_assert | |
1 0.000014 syn keyword cStorageClass _Thread_local thread_local | |
1 0.000015 syn keyword cType char16_t char32_t | |
1 0.000003 endif | |
1 0.000011 if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu") | |
1 0.000008 if exists("c_gnu") | |
syn keyword cConstant __GNUC__ __FUNCTION__ __PRETTY_FUNCTION__ __func__ | |
endif | |
1 0.000015 syn keyword cConstant __LINE__ __FILE__ __DATE__ __TIME__ __STDC__ | |
1 0.000012 syn keyword cConstant __STDC_VERSION__ | |
1 0.000015 syn keyword cConstant CHAR_BIT MB_LEN_MAX MB_CUR_MAX | |
1 0.000014 syn keyword cConstant UCHAR_MAX UINT_MAX ULONG_MAX USHRT_MAX | |
1 0.000016 syn keyword cConstant CHAR_MIN INT_MIN LONG_MIN SHRT_MIN | |
1 0.000018 syn keyword cConstant CHAR_MAX INT_MAX LONG_MAX SHRT_MAX | |
1 0.000017 syn keyword cConstant SCHAR_MIN SINT_MIN SLONG_MIN SSHRT_MIN | |
1 0.000017 syn keyword cConstant SCHAR_MAX SINT_MAX SLONG_MAX SSHRT_MAX | |
1 0.000008 if !exists("c_no_c99") | |
1 0.000013 syn keyword cConstant __func__ | |
1 0.000014 syn keyword cConstant LLONG_MIN LLONG_MAX ULLONG_MAX | |
1 0.000015 syn keyword cConstant INT8_MIN INT16_MIN INT32_MIN INT64_MIN | |
1 0.000015 syn keyword cConstant INT8_MAX INT16_MAX INT32_MAX INT64_MAX | |
1 0.000015 syn keyword cConstant UINT8_MAX UINT16_MAX UINT32_MAX UINT64_MAX | |
1 0.000016 syn keyword cConstant INT_LEAST8_MIN INT_LEAST16_MIN INT_LEAST32_MIN INT_LEAST64_MIN | |
1 0.000016 syn keyword cConstant INT_LEAST8_MAX INT_LEAST16_MAX INT_LEAST32_MAX INT_LEAST64_MAX | |
1 0.000016 syn keyword cConstant UINT_LEAST8_MAX UINT_LEAST16_MAX UINT_LEAST32_MAX UINT_LEAST64_MAX | |
1 0.000015 syn keyword cConstant INT_FAST8_MIN INT_FAST16_MIN INT_FAST32_MIN INT_FAST64_MIN | |
1 0.000016 syn keyword cConstant INT_FAST8_MAX INT_FAST16_MAX INT_FAST32_MAX INT_FAST64_MAX | |
1 0.000064 syn keyword cConstant UINT_FAST8_MAX UINT_FAST16_MAX UINT_FAST32_MAX UINT_FAST64_MAX | |
1 0.000048 syn keyword cConstant INTPTR_MIN INTPTR_MAX UINTPTR_MAX | |
1 0.000047 syn keyword cConstant INTMAX_MIN INTMAX_MAX UINTMAX_MAX | |
1 0.000061 syn keyword cConstant PTRDIFF_MIN PTRDIFF_MAX SIG_ATOMIC_MIN SIG_ATOMIC_MAX | |
1 0.000072 syn keyword cConstant SIZE_MAX WCHAR_MIN WCHAR_MAX WINT_MIN WINT_MAX | |
1 0.000004 endif | |
1 0.000038 syn keyword cConstant FLT_RADIX FLT_ROUNDS | |
1 0.000050 syn keyword cConstant FLT_DIG FLT_MANT_DIG FLT_EPSILON | |
1 0.000051 syn keyword cConstant DBL_DIG DBL_MANT_DIG DBL_EPSILON | |
1 0.000049 syn keyword cConstant LDBL_DIG LDBL_MANT_DIG LDBL_EPSILON | |
1 0.000064 syn keyword cConstant FLT_MIN FLT_MAX FLT_MIN_EXP FLT_MAX_EXP | |
1 0.000020 syn keyword cConstant FLT_MIN_10_EXP FLT_MAX_10_EXP | |
1 0.000016 syn keyword cConstant DBL_MIN DBL_MAX DBL_MIN_EXP DBL_MAX_EXP | |
1 0.000014 syn keyword cConstant DBL_MIN_10_EXP DBL_MAX_10_EXP | |
1 0.000015 syn keyword cConstant LDBL_MIN LDBL_MAX LDBL_MIN_EXP LDBL_MAX_EXP | |
1 0.000014 syn keyword cConstant LDBL_MIN_10_EXP LDBL_MAX_10_EXP | |
1 0.000015 syn keyword cConstant HUGE_VAL CLOCKS_PER_SEC NULL | |
1 0.000014 syn keyword cConstant LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY | |
1 0.000016 syn keyword cConstant LC_NUMERIC LC_TIME | |
1 0.000015 syn keyword cConstant SIG_DFL SIG_ERR SIG_IGN | |
1 0.000020 syn keyword cConstant SIGABRT SIGFPE SIGILL SIGHUP SIGINT SIGSEGV SIGTERM | |
" Add POSIX signals as well... | |
1 0.000019 syn keyword cConstant SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE SIGHUP | |
1 0.000019 syn keyword cConstant SIGILL SIGINT SIGKILL SIGPIPE SIGQUIT SIGSEGV | |
1 0.000019 syn keyword cConstant SIGSTOP SIGTERM SIGTRAP SIGTSTP SIGTTIN SIGTTOU | |
1 0.000014 syn keyword cConstant SIGUSR1 SIGUSR2 | |
1 0.000016 syn keyword cConstant _IOFBF _IOLBF _IONBF BUFSIZ EOF WEOF | |
1 0.000015 syn keyword cConstant FOPEN_MAX FILENAME_MAX L_tmpnam | |
1 0.000016 syn keyword cConstant SEEK_CUR SEEK_END SEEK_SET | |
1 0.000016 syn keyword cConstant TMP_MAX stderr stdin stdout | |
1 0.000015 syn keyword cConstant EXIT_FAILURE EXIT_SUCCESS RAND_MAX | |
" POSIX 2001 | |
1 0.000018 syn keyword cConstant SIGBUS SIGPOLL SIGPROF SIGSYS SIGURG | |
1 0.000016 syn keyword cConstant SIGVTALRM SIGXCPU SIGXFSZ | |
" Add POSIX errors as well | |
1 0.000018 syn keyword cConstant E2BIG EACCES EAGAIN EBADF EBADMSG EBUSY | |
1 0.000019 syn keyword cConstant ECANCELED ECHILD EDEADLK EDOM EEXIST EFAULT | |
1 0.000020 syn keyword cConstant EFBIG EILSEQ EINPROGRESS EINTR EINVAL EIO EISDIR | |
1 0.000019 syn keyword cConstant EMFILE EMLINK EMSGSIZE ENAMETOOLONG ENFILE ENODEV | |
1 0.000019 syn keyword cConstant ENOENT ENOEXEC ENOLCK ENOMEM ENOSPC ENOSYS | |
1 0.000019 syn keyword cConstant ENOTDIR ENOTEMPTY ENOTSUP ENOTTY ENXIO EPERM | |
1 0.000020 syn keyword cConstant EPIPE ERANGE EROFS ESPIPE ESRCH ETIMEDOUT EXDEV | |
" math.h | |
1 0.000016 syn keyword cConstant M_E M_LOG2E M_LOG10E M_LN2 M_LN10 M_PI M_PI_2 M_PI_4 | |
1 0.000015 syn keyword cConstant M_1_PI M_2_PI M_2_SQRTPI M_SQRT2 M_SQRT1_2 | |
1 0.000003 endif | |
1 0.000008 if !exists("c_no_c99") " ISO C99 | |
1 0.000014 syn keyword cConstant true false | |
1 0.000003 endif | |
" Accept %: for # (C99) | |
1 0.000155 syn region cPreCondit start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" keepend contains=cComment,cCommentL,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError | |
1 0.000027 syn match cPreConditMatch display "^\s*\(%:\|#\)\s*\(else\|endif\)\>" | |
1 0.000009 if !exists("c_no_if0") | |
1 0.000095 syn cluster cCppOutInGroup contains=cCppInIf,cCppInElse,cCppInElse2,cCppOutIf,cCppOutIf2,cCppOutElse,cCppInSkip,cCppOutSkip | |
1 0.000061 syn region cCppOutWrapper start="^\s*\(%:\|#\)\s*if\s\+0\+\s*\($\|//\|/\*\|&\)" end=".\@=\|$" contains=cCppOutIf,cCppOutElse,@NoSpell fold | |
1 0.000077 syn region cCppOutIf contained start="0\+" matchgroup=cCppOutWrapper end="^\s*\(%:\|#\)\s*endif\>" contains=cCppOutIf2,cCppOutElse | |
1 0.000011 if !exists("c_no_if0_fold") | |
1 0.000078 syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell fold | |
1 0.000004 else | |
syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell | |
endif | |
1 0.000056 syn region cCppOutElse contained matchgroup=cCppOutWrapper start="^\s*\(%:\|#\)\s*\(else\|elif\)" end="^\s*\(%:\|#\)\s*endif\>"me=s-1 contains=TOP,cPreCondit | |
1 0.000067 syn region cCppInWrapper start="^\s*\(%:\|#\)\s*if\s\+0*[1-9]\d*\s*\($\|//\|/\*\||\)" end=".\@=\|$" contains=cCppInIf,cCppInElse fold | |
1 0.000049 syn region cCppInIf contained matchgroup=cCppInWrapper start="\d\+" end="^\s*\(%:\|#\)\s*endif\>" contains=TOP,cPreCondit | |
1 0.000010 if !exists("c_no_if0_fold") | |
1 0.000067 syn region cCppInElse contained start="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 fold | |
1 0.000004 else | |
syn region cCppInElse contained start="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 | |
endif | |
1 0.000075 syn region cCppInElse2 contained matchgroup=cCppInWrapper start="^\s*\(%:\|#\)\s*\(else\|elif\)\([^/]\|/[^/*]\)*" end="^\s*\(%:\|#\)\s*endif\>"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell | |
1 0.000080 syn region cCppOutSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppOutSkip | |
1 0.000104 syn region cCppInSkip contained matchgroup=cCppInWrapper start="^\s*\(%:\|#\)\s*\(if\s\+\(\d\+\s*\($\|//\|/\*\||\|&\)\)\@!\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" containedin=cCppOutElse,cCppInIf,cCppInSkip contains=TOP,cPreProc | |
1 0.000004 endif | |
1 0.000030 syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+ | |
1 0.000021 syn match cIncluded display contained "<[^>]*>" | |
1 0.000047 syn match cInclude display "^\s*\(%:\|#\)\s*include\>\s*["<]" contains=cIncluded | |
"syn match cLineSkip "\\$" | |
1 0.000328 syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cParen,cBracket,cMulti,cBadBlock | |
1 0.000041 syn region cDefine start="^\s*\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell | |
1 0.000049 syn region cPreProc start="^\s*\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell | |
" Highlight User Labels | |
1 0.000271 syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString | |
1 0.000009 if s:ft ==# 'c' || exists("cpp_no_cpp11") | |
1 0.000035 syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell,@cStringGroup | |
1 0.000004 endif | |
" Avoid matching foo::bar() in C++ by requiring that the next char is not ':' | |
1 0.000021 syn cluster cLabelGroup contains=cUserLabel | |
1 0.000024 syn match cUserCont display "^\s*\I\i*\s*:$" contains=@cLabelGroup | |
1 0.000022 syn match cUserCont display ";\s*\I\i*\s*:$" contains=@cLabelGroup | |
1 0.000023 syn match cUserCont display "^\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup | |
1 0.000023 syn match cUserCont display ";\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup | |
1 0.000019 syn match cUserLabel display "\I\i*" contained | |
" Avoid recognizing most bitfields as labels | |
1 0.000035 syn match cBitField display "^\s*\I\i*\s*:\s*[1-9]"me=e-1 contains=cType | |
1 0.000035 syn match cBitField display ";\s*\I\i*\s*:\s*[1-9]"me=e-1 contains=cType | |
1 0.000009 if exists("c_minlines") | |
let b:c_minlines = c_minlines | |
else | |
1 0.000007 if !exists("c_no_if0") | |
1 0.000010 let b:c_minlines = 50 " #if 0 constructs can be long | |
1 0.000004 else | |
let b:c_minlines = 15 " mostly for () constructs | |
endif | |
1 0.000003 endif | |
1 0.000008 if exists("c_curly_error") | |
syn sync fromstart | |
else | |
1 0.000029 exec "syn sync ccomment cComment minlines=" . b:c_minlines | |
1 0.000003 endif | |
" Define the default highlighting. | |
" Only used when an item doesn't have highlighting yet | |
1 0.000020 hi def link cFormat cSpecial | |
1 0.000018 hi def link cCppString cString | |
1 0.000016 hi def link cCommentL cComment | |
1 0.000016 hi def link cCommentStart cComment | |
1 0.000026 hi def link cLabel Label | |
1 0.000020 hi def link cUserLabel Label | |
1 0.000021 hi def link cConditional Conditional | |
1 0.000020 hi def link cRepeat Repeat | |
1 0.000021 hi def link cCharacter Character | |
1 0.000018 hi def link cSpecialCharacter cSpecial | |
1 0.000019 hi def link cNumber Number | |
1 0.000019 hi def link cOctal Number | |
1 0.000021 hi def link cOctalZero PreProc " link this to Error if you want | |
1 0.000019 hi def link cFloat Float | |
1 0.000015 hi def link cOctalError cError | |
1 0.000015 hi def link cParenError cError | |
1 0.000016 hi def link cErrInParen cError | |
1 0.000273 hi def link cErrInBracket cError | |
1 0.000025 hi def link cCommentError cError | |
1 0.000016 hi def link cCommentStartError cError | |
1 0.000016 hi def link cSpaceError cError | |
1 0.000015 hi def link cSpecialError cError | |
1 0.000015 hi def link cCurlyError cError | |
1 0.000020 hi def link cOperator Operator | |
1 0.000019 hi def link cStructure Structure | |
1 0.000019 hi def link cStorageClass StorageClass | |
1 0.000018 hi def link cInclude Include | |
1 0.000019 hi def link cPreProc PreProc | |
1 0.000018 hi def link cDefine Macro | |
1 0.000022 hi def link cIncluded cString | |
1 0.000018 hi def link cError Error | |
1 0.000021 hi def link cStatement Statement | |
1 0.000015 hi def link cCppInWrapper cCppOutWrapper | |
1 0.000015 hi def link cCppOutWrapper cPreCondit | |
1 0.000021 hi def link cPreConditMatch cPreCondit | |
1 0.000019 hi def link cPreCondit PreCondit | |
1 0.000019 hi def link cType Type | |
1 0.000020 hi def link cConstant Constant | |
1 0.000017 hi def link cCommentString cString | |
1 0.000017 hi def link cComment2String cString | |
1 0.000016 hi def link cCommentSkip cComment | |
1 0.000020 hi def link cString String | |
1 0.000020 hi def link cComment Comment | |
1 0.000020 hi def link cSpecial SpecialChar | |
1 0.000020 hi def link cTodo Todo | |
1 0.000021 hi def link cBadContinuation Error | |
1 0.000015 hi def link cCppOutSkip cCppOutIf2 | |
1 0.000015 hi def link cCppInElse2 cCppOutIf2 | |
1 0.000017 hi def link cCppOutIf2 cCppOut2 " Old syntax group for #if 0 body | |
1 0.000016 hi def link cCppOut2 cCppOut " Old syntax group for #if of #if 0 | |
1 0.000019 hi def link cCppOut Comment | |
1 0.000012 let b:current_syntax = "c" | |
1 0.000006 unlet s:ft | |
1 0.000037 let &cpo = s:cpo_save | |
1 0.000005 unlet s:cpo_save | |
" vim: ts=8 | |
SCRIPT /home/admin/.vim/bundle/vim-syntax-extra/after/syntax/c.vim | |
Sourced 1 time | |
Total time: 0.011581 | |
Self time: 0.011581 | |
count total (s) self (s) | |
" Vim syntax file | |
" Language: C Additions | |
" Maintainer: Mikhail Wolfson <[email protected]> | |
" URL: http://web.mit.edu/wolfsonm | |
" Last Change: 2010 Dec. 3 | |
" Version: 0.4 | |
" | |
" Changelog: | |
" 0.4 - updates and fixes to cDelimiter to fix break with foldmethod=syntax, | |
" entirely suggested and solved by Ivan Freitas | |
" <[email protected]> | |
" 0.3 - updates and fixes to cUserFunctionPointer, thanks to | |
" Alexei <[email protected]> | |
" 0.2 - change [] to operator | |
" 0.1 - initial upload, modification from vimscript#1201, Extended c.vim | |
" Common ANSI-standard functions | |
1 0.000025 syn keyword cAnsiFunction MULU_ DIVU_ MODU_ MUL_ DIV_ MOD_ | |
1 0.000014 syn keyword cAnsiFunction main typeof | |
1 0.000018 syn keyword cAnsiFunction open close read write lseek dup dup2 | |
1 0.000013 syn keyword cAnsiFunction fcntl ioctl | |
1 0.000015 syn keyword cAnsiFunction wctrans towctrans towupper | |
1 0.000014 syn keyword cAnsiFunction towlower wctype iswctype | |
1 0.000013 syn keyword cAnsiFunction iswxdigit iswupper iswspace | |
1 0.000013 syn keyword cAnsiFunction iswpunct iswprint iswlower | |
1 0.000013 syn keyword cAnsiFunction iswgraph iswdigit iswcntrl | |
1 0.000013 syn keyword cAnsiFunction iswalpha iswalnum wcsrtombs | |
1 0.000013 syn keyword cAnsiFunction mbsrtowcs wcrtomb mbrtowc | |
1 0.000013 syn keyword cAnsiFunction mbrlen mbsinit wctob | |
1 0.000016 syn keyword cAnsiFunction btowc wcsfxtime wcsftime | |
1 0.000013 syn keyword cAnsiFunction wmemset wmemmove wmemcpy | |
1 0.000013 syn keyword cAnsiFunction wmemcmp wmemchr wcstok | |
1 0.000013 syn keyword cAnsiFunction wcsstr wcsspn wcsrchr | |
1 0.000013 syn keyword cAnsiFunction wcspbrk wcslen wcscspn | |
1 0.000050 syn keyword cAnsiFunction wcschr wcsxfrm wcsncmp | |
1 0.000014 syn keyword cAnsiFunction wcscoll wcscmp wcsncat | |
1 0.000013 syn keyword cAnsiFunction wcscat wcsncpy wcscpy | |
1 0.000014 syn keyword cAnsiFunction wcstoull wcstoul wcstoll | |
1 0.000013 syn keyword cAnsiFunction wcstol wcstold wcstof | |
1 0.000013 syn keyword cAnsiFunction wcstod ungetwc putwchar | |
1 0.000014 syn keyword cAnsiFunction putwc getwchar getwc | |
1 0.000015 syn keyword cAnsiFunction fwide fputws fputwc | |
1 0.000014 syn keyword cAnsiFunction fgetws fgetwc wscanf | |
1 0.000013 syn keyword cAnsiFunction wprintf vwscanf vwprintf | |
1 0.000013 syn keyword cAnsiFunction vswscanf vswprintf vfwscanf | |
1 0.000015 syn keyword cAnsiFunction vfwprintf swscanf swprintf | |
1 0.000015 syn keyword cAnsiFunction fwscanf fwprintf zonetime | |
1 0.000015 syn keyword cAnsiFunction strfxtime strftime localtime | |
1 0.000014 syn keyword cAnsiFunction gmtime ctime asctime | |
1 0.000014 syn keyword cAnsiFunction time mkxtime mktime | |
1 0.000015 syn keyword cAnsiFunction difftime clock strlen | |
1 0.000014 syn keyword cAnsiFunction strerror memset strtok | |
1 0.000015 syn keyword cAnsiFunction strstr strspn strrchr | |
1 0.000015 syn keyword cAnsiFunction strpbrk strcspn strchr | |
1 0.000014 syn keyword cAnsiFunction memchr strxfrm strncmp | |
1 0.000014 syn keyword cAnsiFunction strcoll strcmp memcmp | |
1 0.000015 syn keyword cAnsiFunction strncat strcat strncpy | |
1 0.000014 syn keyword cAnsiFunction strcpy memmove memcpy | |
1 0.000014 syn keyword cAnsiFunction wcstombs mbstowcs wctomb | |
1 0.000013 syn keyword cAnsiFunction mbtowc mblen lldiv | |
1 0.000013 syn keyword cAnsiFunction ldiv div llabs | |
1 0.000016 syn keyword cAnsiFunction labs abs qsort | |
1 0.000015 syn keyword cAnsiFunction bsearch system getenv | |
1 0.000014 syn keyword cAnsiFunction exit atexit abort | |
1 0.000014 syn keyword cAnsiFunction realloc malloc free | |
1 0.000014 syn keyword cAnsiFunction calloc srand rand | |
1 0.000015 syn keyword cAnsiFunction strtoull strtoul strtoll | |
1 0.000015 syn keyword cAnsiFunction strtol strtold strtof | |
1 0.000013 syn keyword cAnsiFunction strtod atoll atol | |
1 0.000013 syn keyword cAnsiFunction atoi atof perror | |
1 0.000015 syn keyword cAnsiFunction ferror feof clearerr | |
1 0.000014 syn keyword cAnsiFunction rewind ftell fsetpos | |
1 0.000015 syn keyword cAnsiFunction fseek fgetpos fwrite | |
1 0.000013 syn keyword cAnsiFunction fread ungetc puts | |
1 0.000013 syn keyword cAnsiFunction putchar putc gets | |
1 0.000014 syn keyword cAnsiFunction getchar getc fputs | |
1 0.000014 syn keyword cAnsiFunction fputc fgets fgetc | |
1 0.000013 syn keyword cAnsiFunction vsscanf vsprintf vsnprintf | |
1 0.000013 syn keyword cAnsiFunction vscanf vprintf vfscanf | |
1 0.000014 syn keyword cAnsiFunction vfprintf sscanf sprintf | |
1 0.000014 syn keyword cAnsiFunction snprintf scanf printf | |
1 0.000014 syn keyword cAnsiFunction fscanf fprintf setvbuf | |
1 0.000014 syn keyword cAnsiFunction setbuf freopen fopen | |
1 0.000014 syn keyword cAnsiFunction fflush fclose tmpnam | |
1 0.000013 syn keyword cAnsiFunction tmpfile rename remove | |
1 0.000014 syn keyword cAnsiFunction offsetof va_start va_end | |
1 0.000015 syn keyword cAnsiFunction va_copy va_arg raise signal | |
1 0.000019 syn keyword cAnsiFunction longjmp setjmp isunordered | |
1 0.000013 syn keyword cAnsiFunction islessgreater islessequal isless | |
1 0.000015 syn keyword cAnsiFunction isgreaterequal isgreater fmal | |
1 0.000015 syn keyword cAnsiFunction fmaf fma fminl | |
1 0.000015 syn keyword cAnsiFunction fminf fmin fmaxl | |
1 0.000014 syn keyword cAnsiFunction fmaxf fmax fdiml | |
1 0.000018 syn keyword cAnsiFunction fdimf fdim nextafterxl | |
1 0.000016 syn keyword cAnsiFunction nextafterxf nextafterx nextafterl | |
1 0.000015 syn keyword cAnsiFunction nextafterf nextafter nanl | |
1 0.000015 syn keyword cAnsiFunction nanf nan copysignl | |
1 0.000014 syn keyword cAnsiFunction copysignf copysign remquol | |
1 0.000013 syn keyword cAnsiFunction remquof remquo remainderl | |
1 0.000014 syn keyword cAnsiFunction remainderf remainder fmodl | |
1 0.000015 syn keyword cAnsiFunction fmodf fmod truncl | |
1 0.000014 syn keyword cAnsiFunction truncf trunc llroundl | |
1 0.000013 syn keyword cAnsiFunction llroundf llround lroundl | |
1 0.000013 syn keyword cAnsiFunction lroundf lround roundl | |
1 0.000013 syn keyword cAnsiFunction roundf round llrintl | |
1 0.000013 syn keyword cAnsiFunction llrintf llrint lrintl | |
1 0.000013 syn keyword cAnsiFunction lrintf lrint rintl | |
1 0.000014 syn keyword cAnsiFunction rintf rint nearbyintl | |
1 0.000015 syn keyword cAnsiFunction nearbyintf nearbyint floorl | |
1 0.000015 syn keyword cAnsiFunction floorf floor ceill | |
1 0.000015 syn keyword cAnsiFunction ceilf ceil tgammal | |
1 0.000014 syn keyword cAnsiFunction tgammaf tgamma lgammal | |
1 0.000013 syn keyword cAnsiFunction lgammaf lgamma erfcl | |
1 0.000015 syn keyword cAnsiFunction erfcf erfc erfl | |
1 0.000015 syn keyword cAnsiFunction erff erf sqrtl | |
1 0.000014 syn keyword cAnsiFunction sqrtf sqrt powl | |
1 0.000013 syn keyword cAnsiFunction powf pow hypotl | |
1 0.000013 syn keyword cAnsiFunction hypotf hypot fabsl | |
1 0.000015 syn keyword cAnsiFunction fabsf fabs cbrtl | |
1 0.000015 syn keyword cAnsiFunction cbrtf cbrt scalblnl | |
1 0.000015 syn keyword cAnsiFunction scalblnf scalbln scalbnl | |
1 0.000015 syn keyword cAnsiFunction scalbnf scalbn modfl | |
1 0.000013 syn keyword cAnsiFunction modff modf logbl | |
1 0.000013 syn keyword cAnsiFunction logbf logb log2l | |
1 0.000013 syn keyword cAnsiFunction log2f log2 log1pl | |
1 0.000016 syn keyword cAnsiFunction log1pf log1p log10l | |
1 0.000013 syn keyword cAnsiFunction log10f log10 logl | |
1 0.000013 syn keyword cAnsiFunction logf log ldexpl | |
1 0.000013 syn keyword cAnsiFunction ldexpf ldexp ilogbl | |
1 0.000014 syn keyword cAnsiFunction ilogbf ilogb frexpl | |
1 0.000131 syn keyword cAnsiFunction frexpf frexp expm1l | |
1 0.000172 syn keyword cAnsiFunction expm1f expm1 exp2l | |
1 0.000172 syn keyword cAnsiFunction exp2f exp2 expl | |
1 0.000171 syn keyword cAnsiFunction expf exp tanhl | |
1 0.000171 syn keyword cAnsiFunction tanhf tanh sinhl | |
1 0.000172 syn keyword cAnsiFunction sinhf sinh coshl | |
1 0.000171 syn keyword cAnsiFunction coshf cosh atanhl | |
1 0.000172 syn keyword cAnsiFunction atanhf atanh asinhl | |
1 0.000188 syn keyword cAnsiFunction asinhf asinh acoshl | |
1 0.000174 syn keyword cAnsiFunction acoshf acosh tanl | |
1 0.000174 syn keyword cAnsiFunction tanf tan sinl | |
1 0.000174 syn keyword cAnsiFunction sinf sin cosl | |
1 0.000175 syn keyword cAnsiFunction cosf cos atan2l | |
1 0.000174 syn keyword cAnsiFunction atan2f atan2 atanl | |
1 0.000190 syn keyword cAnsiFunction atanf atan asinl | |
1 0.000176 syn keyword cAnsiFunction asinf asin acosl | |
1 0.000175 syn keyword cAnsiFunction acosf acos signbit | |
1 0.000175 syn keyword cAnsiFunction isnormal isnan isinf | |
1 0.000176 syn keyword cAnsiFunction isfinite fpclassify localeconv | |
1 0.000177 syn keyword cAnsiFunction setlocale wcstoumax wcstoimax | |
1 0.000178 syn keyword cAnsiFunction strtoumax strtoimax feupdateenv | |
1 0.000179 syn keyword cAnsiFunction fesetenv feholdexcept fegetenv | |
1 0.000179 syn keyword cAnsiFunction fesetround fegetround fetestexcept | |
1 0.000180 syn keyword cAnsiFunction fesetexceptflag feraiseexcept fegetexceptflag | |
1 0.000179 syn keyword cAnsiFunction feclearexcept toupper tolower | |
1 0.000179 syn keyword cAnsiFunction isxdigit isupper isspace | |
1 0.000179 syn keyword cAnsiFunction ispunct isprint islower | |
1 0.000183 syn keyword cAnsiFunction isgraph isdigit iscntrl | |
1 0.000180 syn keyword cAnsiFunction isalpha isalnum creall | |
1 0.000182 syn keyword cAnsiFunction crealf creal cprojl | |
1 0.000182 syn keyword cAnsiFunction cprojf cproj conjl | |
1 0.000182 syn keyword cAnsiFunction conjf conj cimagl | |
1 0.000183 syn keyword cAnsiFunction cimagf cimag cargl | |
1 0.000183 syn keyword cAnsiFunction cargf carg csqrtl | |
1 0.000182 syn keyword cAnsiFunction csqrtf csqrt cpowl | |
1 0.000184 syn keyword cAnsiFunction cpowf cpow cabsl | |
1 0.000202 syn keyword cAnsiFunction cabsf cabs clogl | |
1 0.000184 syn keyword cAnsiFunction clogf clog cexpl | |
1 0.000183 syn keyword cAnsiFunction cexpf cexp ctanhl | |
1 0.000184 syn keyword cAnsiFunction ctanhf ctanh csinhl | |
1 0.000185 syn keyword cAnsiFunction csinhf csinh ccoshl | |
1 0.000185 syn keyword cAnsiFunction ccoshf ccosh catanhl | |
1 0.000186 syn keyword cAnsiFunction catanhf catanh casinhl | |
1 0.000186 syn keyword cAnsiFunction casinhf casinh cacoshl | |
1 0.000191 syn keyword cAnsiFunction cacoshf cacosh ctanl | |
1 0.000186 syn keyword cAnsiFunction ctanf ctan csinl | |
1 0.000016 syn keyword cAnsiFunction csinf csin ccosl | |
1 0.000015 syn keyword cAnsiFunction ccosf ccos catanl | |
1 0.000015 syn keyword cAnsiFunction catanf catan casinl | |
1 0.000015 syn keyword cAnsiFunction casinf casin cacosl | |
1 0.000014 syn keyword cAnsiFunction cacosf cacos assert | |
1 0.000013 syn keyword cAnsiFunction UINTMAX_C INTMAX_C UINT64_C | |
1 0.000013 syn keyword cAnsiFunction UINT32_C UINT16_C UINT8_C | |
1 0.000014 syn keyword cAnsiFunction INT64_C INT32_C INT16_C INT8_C | |
" Common ANSI-standard Names | |
1 0.000014 syn keyword cAnsiName PRId8 PRIi16 PRIo32 PRIu64 | |
1 0.000013 syn keyword cAnsiName PRId16 PRIi32 PRIo64 PRIuLEAST8 | |
1 0.000014 syn keyword cAnsiName PRId32 PRIi64 PRIoLEAST8 PRIuLEAST16 | |
1 0.000017 syn keyword cAnsiName PRId64 PRIiLEAST8 PRIoLEAST16 PRIuLEAST32 | |
1 0.000014 syn keyword cAnsiName PRIdLEAST8 PRIiLEAST16 PRIoLEAST32 PRIuLEAST64 | |
1 0.000014 syn keyword cAnsiName PRIdLEAST16 PRIiLEAST32 PRIoLEAST64 PRIuFAST8 | |
1 0.000014 syn keyword cAnsiName PRIdLEAST32 PRIiLEAST64 PRIoFAST8 PRIuFAST16 | |
1 0.000014 syn keyword cAnsiName PRIdLEAST64 PRIiFAST8 PRIoFAST16 PRIuFAST32 | |
1 0.000014 syn keyword cAnsiName PRIdFAST8 PRIiFAST16 PRIoFAST32 PRIuFAST64 | |
1 0.000015 syn keyword cAnsiName PRIdFAST16 PRIiFAST32 PRIoFAST64 PRIuMAX | |
1 0.000014 syn keyword cAnsiName PRIdFAST32 PRIiFAST64 PRIoMAX PRIuPTR | |
1 0.000013 syn keyword cAnsiName PRIdFAST64 PRIiMAX PRIoPTR PRIx8 | |
1 0.000013 syn keyword cAnsiName PRIdMAX PRIiPTR PRIu8 PRIx16 | |
1 0.000013 syn keyword cAnsiName PRIdPTR PRIo8 PRIu16 PRIx32 | |
1 0.000013 syn keyword cAnsiName PRIi8 PRIo16 PRIu32 PRIx64 | |
1 0.000016 syn keyword cAnsiName PRIxLEAST8 SCNd8 SCNiFAST32 SCNuLEAST32 | |
1 0.000016 syn keyword cAnsiName PRIxLEAST16 SCNd16 SCNiFAST64 SCNuLEAST64 | |
1 0.000015 syn keyword cAnsiName PRIxLEAST32 SCNd32 SCNiMAX SCNuFAST8 | |
1 0.000015 syn keyword cAnsiName PRIxLEAST64 SCNd64 SCNiPTR SCNuFAST16 | |
1 0.000015 syn keyword cAnsiName PRIxFAST8 SCNdLEAST8 SCNo8 SCNuFAST32 | |
1 0.000016 syn keyword cAnsiName PRIxFAST16 SCNdLEAST16 SCNo16 SCNuFAST64 | |
1 0.000015 syn keyword cAnsiName PRIxFAST32 SCNdLEAST32 SCNo32 SCNuMAX | |
1 0.000015 syn keyword cAnsiName PRIxFAST64 SCNdLEAST64 SCNo64 SCNuPTR | |
1 0.000015 syn keyword cAnsiName PRIxMAX SCNdFAST8 SCNoLEAST8 SCNx8 | |
1 0.000016 syn keyword cAnsiName PRIxPTR SCNdFAST16 SCNoLEAST16 SCNx16 | |
1 0.000015 syn keyword cAnsiName PRIX8 SCNdFAST32 SCNoLEAST32 SCNx32 | |
1 0.000015 syn keyword cAnsiName PRIX16 SCNdFAST64 SCNoLEAST64 SCNx64 | |
1 0.000016 syn keyword cAnsiName PRIX32 SCNdMAX SCNoFAST8 SCNxLEAST8 | |
1 0.000016 syn keyword cAnsiName PRIX64 SCNdPTR SCNoFAST16 SCNxLEAST16 | |
1 0.000015 syn keyword cAnsiName PRIXLEAST8 SCNi8 SCNoFAST32 SCNxLEAST32 | |
1 0.000016 syn keyword cAnsiName PRIXLEAST16 SCNi16 SCNoFAST64 SCNxLEAST64 | |
1 0.000015 syn keyword cAnsiName PRIXLEAST32 SCNi32 SCNoMAX SCNxFAST8 | |
1 0.000016 syn keyword cAnsiName PRIXLEAST64 SCNi64 SCNoPTR SCNxFAST16 | |
1 0.000015 syn keyword cAnsiName PRIXFAST8 SCNiLEAST8 SCNu8 SCNxFAST32 | |
1 0.000018 syn keyword cAnsiName PRIXFAST16 SCNiLEAST16 SCNu16 SCNxFAST64 | |
1 0.000015 syn keyword cAnsiName PRIXFAST32 SCNiLEAST32 SCNu32 SCNxMAX | |
1 0.000015 syn keyword cAnsiName PRIXFAST64 SCNiLEAST64 SCNu64 SCNxPTR | |
1 0.000014 syn keyword cAnsiName PRIXMAX SCNiFAST8 SCNuLEAST8 | |
1 0.000014 syn keyword cAnsiName PRIXPTR SCNiFAST16 SCNuLEAST16 | |
1 0.000013 syn keyword cAnsiName errno environ | |
1 0.000014 syn keyword cAnsiName STDC CX_LIMITED_RANGE | |
1 0.000014 syn keyword cAnsiName STDC FENV_ACCESS | |
1 0.000013 syn keyword cAnsiName STDC FP_CONTRACT | |
1 0.000014 syn keyword cAnsiName and bitor not_eq xor | |
1 0.000015 syn keyword cAnsiName and_eq compl or xor_eq | |
1 0.000014 syn keyword cAnsiName bitand not or_eq | |
1 0.000017 hi def link cAnsiFunction cFunction | |
1 0.000014 hi def link cAnsiName cIdentifier | |
" Operators | |
1 0.000036 syn match cOperator "\(<<\|>>\|[-+*/%&^|<>!=]\)=" | |
1 0.000023 syn match cOperator "<<\|>>\|&&\|||\|++\|--\|->" | |
1 0.000021 syn match cOperator "[.!~*&%<>^|=,+-]" | |
1 0.000034 syn match cOperator "/[^/*=]"me=e-1 | |
1 0.000018 syn match cOperator "/$" | |
1 0.000018 syn match cOperator "&&\|||" | |
1 0.000018 syn match cOperator "[][]" | |
" Preprocs | |
1 0.000027 syn keyword cDefined defined contained containedin=cDefine | |
1 0.000014 hi def link cDefined cDefine | |
" Functions | |
1 0.000056 syn match cUserFunction "\<\h\w*\>\(\s\|\n\)*("me=e-1 contains=cType,cDelimiter,cDefine | |
1 0.000045 syn match cUserFunctionPointer "(\s*\*\s*\h\w*\s*)\(\s\|\n\)*(" contains=cDelimiter,cOperator | |
1 0.000014 hi def link cUserFunction cFunction | |
1 0.000014 hi def link cUserFunctionPointer cFunction | |
" Delimiters | |
1 0.000018 syn match cDelimiter "[();\\]" | |
" foldmethod=syntax fix, courtesy of Ivan Freitas | |
1 0.000017 syn match cBraces display "[{}]" | |
" Booleans | |
1 0.000016 syn keyword cBoolean true false TRUE FALSE | |
" Links | |
1 0.000025 hi def link cFunction Function | |
1 0.000020 hi def link cIdentifier Identifier | |
1 0.000021 hi def link cDelimiter Delimiter | |
" foldmethod=syntax fix, courtesy of Ivan Freitas | |
1 0.000018 hi def link cBraces Delimiter | |
1 0.000018 hi def link cBoolean Boolean | |
SCRIPT /home/admin/.vim/plugged/vim-cpp-enhanced-highlight/after/syntax/c.vim | |
Sourced 1 time | |
Total time: 0.003685 | |
Self time: 0.003685 | |
count total (s) self (s) | |
" Vim syntax file | |
" Language: C Additions | |
" Maintainer: Jon Haggblad <[email protected]> | |
" Contributor: Mikhail Wolfson <[email protected]> | |
" URL: http://www.haeggblad.com | |
" Last Change: 6 Sep 2014 | |
" Version: 0.3 | |
" Changelog: | |
" 0.3 - integration of aftersyntaxc.vim | |
" 0.2 - Cleanup | |
" 0.1 - initial version. | |
" | |
" Syntax highlighting for functions in C. | |
" | |
" Based on: | |
" http://stackoverflow.com/questions/736701/class-function-names-highlighting-in-vim | |
" ----------------------------------------------------------------------------- | |
" Highlight function names. | |
" ----------------------------------------------------------------------------- | |
1 0.000048 syn match cCustomParen "(" contains=cParen contains=cCppParen | |
1 0.000032 syn match cCustomFunc "\w\+\s*(\@=" contains=cCustomParen | |
1 0.000020 hi def link cCustomFunc Function | |
" ----------------------------------------------------------------------------- | |
" Source: aftersyntaxc.vim | |
" ----------------------------------------------------------------------------- | |
" Common ANSI-standard functions | |
1 0.000017 syn keyword cAnsiFunction MULU_ DIVU_ MODU_ MUL_ DIV_ MOD_ | |
1 0.000017 syn keyword cAnsiFunction main typeof | |
1 0.000018 syn keyword cAnsiFunction open close read write lseek dup dup2 | |
1 0.000013 syn keyword cAnsiFunction fcntl ioctl | |
1 0.000014 syn keyword cAnsiFunction wctrans towctrans towupper | |
1 0.000013 syn keyword cAnsiFunction towlower wctype iswctype | |
1 0.000013 syn keyword cAnsiFunction iswxdigit iswupper iswspace | |
1 0.000013 syn keyword cAnsiFunction iswpunct iswprint iswlower | |
1 0.000013 syn keyword cAnsiFunction iswgraph iswdigit iswcntrl | |
1 0.000013 syn keyword cAnsiFunction iswalpha iswalnum wcsrtombs | |
1 0.000013 syn keyword cAnsiFunction mbsrtowcs wcrtomb mbrtowc | |
1 0.000013 syn keyword cAnsiFunction mbrlen mbsinit wctob | |
1 0.000013 syn keyword cAnsiFunction btowc wcsfxtime wcsftime | |
1 0.000013 syn keyword cAnsiFunction wmemset wmemmove wmemcpy | |
1 0.000013 syn keyword cAnsiFunction wmemcmp wmemchr wcstok | |
1 0.000037 syn keyword cAnsiFunction wcsstr wcsspn wcsrchr | |
1 0.000013 syn keyword cAnsiFunction wcspbrk wcslen wcscspn | |
1 0.000013 syn keyword cAnsiFunction wcschr wcsxfrm wcsncmp | |
1 0.000013 syn keyword cAnsiFunction wcscoll wcscmp wcsncat | |
1 0.000013 syn keyword cAnsiFunction wcscat wcsncpy wcscpy | |
1 0.000013 syn keyword cAnsiFunction wcstoull wcstoul wcstoll | |
1 0.000013 syn keyword cAnsiFunction wcstol wcstold wcstof | |
1 0.000013 syn keyword cAnsiFunction wcstod ungetwc putwchar | |
1 0.000014 syn keyword cAnsiFunction putwc getwchar getwc | |
1 0.000015 syn keyword cAnsiFunction fwide fputws fputwc | |
1 0.000014 syn keyword cAnsiFunction fgetws fgetwc wscanf | |
1 0.000013 syn keyword cAnsiFunction wprintf vwscanf vwprintf | |
1 0.000013 syn keyword cAnsiFunction vswscanf vswprintf vfwscanf | |
1 0.000014 syn keyword cAnsiFunction vfwprintf swscanf swprintf | |
1 0.000014 syn keyword cAnsiFunction fwscanf fwprintf zonetime | |
1 0.000014 syn keyword cAnsiFunction strfxtime strftime localtime | |
1 0.000014 syn keyword cAnsiFunction gmtime ctime asctime | |
1 0.000013 syn keyword cAnsiFunction time mkxtime mktime | |
1 0.000018 syn keyword cAnsiFunction difftime clock strlen | |
1 0.000014 syn keyword cAnsiFunction strerror memset strtok | |
1 0.000015 syn keyword cAnsiFunction strstr strspn strrchr | |
1 0.000015 syn keyword cAnsiFunction strpbrk strcspn strchr | |
1 0.000014 syn keyword cAnsiFunction memchr strxfrm strncmp | |
1 0.000014 syn keyword cAnsiFunction strcoll strcmp memcmp | |
1 0.000015 syn keyword cAnsiFunction strncat strcat strncpy | |
1 0.000014 syn keyword cAnsiFunction strcpy memmove memcpy | |
1 0.000013 syn keyword cAnsiFunction wcstombs mbstowcs wctomb | |
1 0.000013 syn keyword cAnsiFunction mbtowc mblen lldiv | |
1 0.000013 syn keyword cAnsiFunction ldiv div llabs | |
1 0.000012 syn keyword cAnsiFunction labs abs qsort | |
1 0.000014 syn keyword cAnsiFunction bsearch system getenv | |
1 0.000013 syn keyword cAnsiFunction exit atexit abort | |
1 0.000013 syn keyword cAnsiFunction realloc malloc free | |
1 0.000014 syn keyword cAnsiFunction calloc srand rand | |
1 0.000015 syn keyword cAnsiFunction strtoull strtoul strtoll | |
1 0.000015 syn keyword cAnsiFunction strtol strtold strtof | |
1 0.000014 syn keyword cAnsiFunction strtod atoll atol | |
1 0.000013 syn keyword cAnsiFunction atoi atof perror | |
1 0.000015 syn keyword cAnsiFunction ferror feof clearerr | |
1 0.000014 syn keyword cAnsiFunction rewind ftell fsetpos | |
1 0.000014 syn keyword cAnsiFunction fseek fgetpos fwrite | |
1 0.000013 syn keyword cAnsiFunction fread ungetc puts | |
1 0.000014 syn keyword cAnsiFunction putchar putc gets | |
1 0.000014 syn keyword cAnsiFunction getchar getc fputs | |
1 0.000015 syn keyword cAnsiFunction fputc fgets fgetc | |
1 0.000013 syn keyword cAnsiFunction vsscanf vsprintf vsnprintf | |
1 0.000018 syn keyword cAnsiFunction vscanf vprintf vfscanf | |
1 0.000014 syn keyword cAnsiFunction vfprintf sscanf sprintf | |
1 0.000014 syn keyword cAnsiFunction snprintf scanf printf | |
1 0.000015 syn keyword cAnsiFunction fscanf fprintf setvbuf | |
1 0.000017 syn keyword cAnsiFunction setbuf freopen fopen | |
1 0.000014 syn keyword cAnsiFunction fflush fclose tmpnam | |
1 0.000013 syn keyword cAnsiFunction tmpfile rename remove | |
1 0.000013 syn keyword cAnsiFunction offsetof va_start va_end | |
1 0.000014 syn keyword cAnsiFunction va_copy va_arg raise signal | |
1 0.000013 syn keyword cAnsiFunction longjmp setjmp isunordered | |
1 0.000014 syn keyword cAnsiFunction islessgreater islessequal isless | |
1 0.000014 syn keyword cAnsiFunction isgreaterequal isgreater fmal | |
1 0.000014 syn keyword cAnsiFunction fmaf fma fminl | |
1 0.000014 syn keyword cAnsiFunction fminf fmin fmaxl | |
1 0.000014 syn keyword cAnsiFunction fmaxf fmax fdiml | |
1 0.000014 syn keyword cAnsiFunction fdimf fdim nextafterxl | |
1 0.000015 syn keyword cAnsiFunction nextafterxf nextafterx nextafterl | |
1 0.000015 syn keyword cAnsiFunction nextafterf nextafter nanl | |
1 0.000015 syn keyword cAnsiFunction nanf nan copysignl | |
1 0.000014 syn keyword cAnsiFunction copysignf copysign remquol | |
1 0.000013 syn keyword cAnsiFunction remquof remquo remainderl | |
1 0.000014 syn keyword cAnsiFunction remainderf remainder fmodl | |
1 0.000014 syn keyword cAnsiFunction fmodf fmod truncl | |
1 0.000014 syn keyword cAnsiFunction truncf trunc llroundl | |
1 0.000013 syn keyword cAnsiFunction llroundf llround lroundl | |
1 0.000013 syn keyword cAnsiFunction lroundf lround roundl | |
1 0.000013 syn keyword cAnsiFunction roundf round llrintl | |
1 0.000013 syn keyword cAnsiFunction llrintf llrint lrintl | |
1 0.000013 syn keyword cAnsiFunction lrintf lrint rintl | |
1 0.000014 syn keyword cAnsiFunction rintf rint nearbyintl | |
1 0.000015 syn keyword cAnsiFunction nearbyintf nearbyint floorl | |
1 0.000014 syn keyword cAnsiFunction floorf floor ceill | |
1 0.000014 syn keyword cAnsiFunction ceilf ceil tgammal | |
1 0.000014 syn keyword cAnsiFunction tgammaf tgamma lgammal | |
1 0.000013 syn keyword cAnsiFunction lgammaf lgamma erfcl | |
1 0.000014 syn keyword cAnsiFunction erfcf erfc erfl | |
1 0.000017 syn keyword cAnsiFunction erff erf sqrtl | |
1 0.000014 syn keyword cAnsiFunction sqrtf sqrt powl | |
1 0.000012 syn keyword cAnsiFunction powf pow hypotl | |
1 0.000014 syn keyword cAnsiFunction hypotf hypot fabsl | |
1 0.000014 syn keyword cAnsiFunction fabsf fabs cbrtl | |
1 0.000014 syn keyword cAnsiFunction cbrtf cbrt scalblnl | |
1 0.000015 syn keyword cAnsiFunction scalblnf scalbln scalbnl | |
1 0.000014 syn keyword cAnsiFunction scalbnf scalbn modfl | |
1 0.000013 syn keyword cAnsiFunction modff modf logbl | |
1 0.000013 syn keyword cAnsiFunction logbf logb log2l | |
1 0.000013 syn keyword cAnsiFunction log2f log2 log1pl | |
1 0.000013 syn keyword cAnsiFunction log1pf log1p log10l | |
1 0.000012 syn keyword cAnsiFunction log10f log10 logl | |
1 0.000012 syn keyword cAnsiFunction logf log ldexpl | |
1 0.000013 syn keyword cAnsiFunction ldexpf ldexp ilogbl | |
1 0.000014 syn keyword cAnsiFunction ilogbf ilogb frexpl | |
1 0.000014 syn keyword cAnsiFunction frexpf frexp expm1l | |
1 0.000015 syn keyword cAnsiFunction expm1f expm1 exp2l | |
1 0.000014 syn keyword cAnsiFunction exp2f exp2 expl | |
1 0.000015 syn keyword cAnsiFunction expf exp tanhl | |
1 0.000014 syn keyword cAnsiFunction tanhf tanh sinhl | |
1 0.000014 syn keyword cAnsiFunction sinhf sinh coshl | |
1 0.000014 syn keyword cAnsiFunction coshf cosh atanhl | |
1 0.000013 syn keyword cAnsiFunction atanhf atanh asinhl | |
1 0.000012 syn keyword cAnsiFunction asinhf asinh acoshl | |
1 0.000013 syn keyword cAnsiFunction acoshf acosh tanl | |
1 0.000015 syn keyword cAnsiFunction tanf tan sinl | |
1 0.000014 syn keyword cAnsiFunction sinf sin cosl | |
1 0.000014 syn keyword cAnsiFunction cosf cos atan2l | |
1 0.000013 syn keyword cAnsiFunction atan2f atan2 atanl | |
1 0.000013 syn keyword cAnsiFunction atanf atan asinl | |
1 0.000013 syn keyword cAnsiFunction asinf asin acosl | |
1 0.000016 syn keyword cAnsiFunction acosf acos signbit | |
1 0.000013 syn keyword cAnsiFunction isnormal isnan isinf | |
1 0.000014 syn keyword cAnsiFunction isfinite fpclassify localeconv | |
1 0.000014 syn keyword cAnsiFunction setlocale wcstoumax wcstoimax | |
1 0.000015 syn keyword cAnsiFunction strtoumax strtoimax feupdateenv | |
1 0.000015 syn keyword cAnsiFunction fesetenv feholdexcept fegetenv | |
1 0.000015 syn keyword cAnsiFunction fesetround fegetround fetestexcept | |
1 0.000015 syn keyword cAnsiFunction fesetexceptflag feraiseexcept fegetexceptflag | |
1 0.000015 syn keyword cAnsiFunction feclearexcept toupper tolower | |
1 0.000013 syn keyword cAnsiFunction isxdigit isupper isspace | |
1 0.000013 syn keyword cAnsiFunction ispunct isprint islower | |
1 0.000012 syn keyword cAnsiFunction isgraph isdigit iscntrl | |
1 0.000013 syn keyword cAnsiFunction isalpha isalnum creall | |
1 0.000015 syn keyword cAnsiFunction crealf creal cprojl | |
1 0.000015 syn keyword cAnsiFunction cprojf cproj conjl | |
1 0.000015 syn keyword cAnsiFunction conjf conj cimagl | |
1 0.000015 syn keyword cAnsiFunction cimagf cimag cargl | |
1 0.000014 syn keyword cAnsiFunction cargf carg csqrtl | |
1 0.000015 syn keyword cAnsiFunction csqrtf csqrt cpowl | |
1 0.000018 syn keyword cAnsiFunction cpowf cpow cabsl | |
1 0.000014 syn keyword cAnsiFunction cabsf cabs clogl | |
1 0.000014 syn keyword cAnsiFunction clogf clog cexpl | |
1 0.000014 syn keyword cAnsiFunction cexpf cexp ctanhl | |
1 0.000014 syn keyword cAnsiFunction ctanhf ctanh csinhl | |
1 0.000015 syn keyword cAnsiFunction csinhf csinh ccoshl | |
1 0.000015 syn keyword cAnsiFunction ccoshf ccosh catanhl | |
1 0.000015 syn keyword cAnsiFunction catanhf catanh casinhl | |
1 0.000015 syn keyword cAnsiFunction casinhf casinh cacoshl | |
1 0.000014 syn keyword cAnsiFunction cacoshf cacosh ctanl | |
1 0.000015 syn keyword cAnsiFunction ctanf ctan csinl | |
1 0.000014 syn keyword cAnsiFunction csinf csin ccosl | |
1 0.000014 syn keyword cAnsiFunction ccosf ccos catanl | |
1 0.000017 syn keyword cAnsiFunction catanf catan casinl | |
1 0.000015 syn keyword cAnsiFunction casinf casin cacosl | |
1 0.000014 syn keyword cAnsiFunction cacosf cacos assert | |
1 0.000013 syn keyword cAnsiFunction UINTMAX_C INTMAX_C UINT64_C | |
1 0.000013 syn keyword cAnsiFunction UINT32_C UINT16_C UINT8_C | |
1 0.000014 syn keyword cAnsiFunction INT64_C INT32_C INT16_C INT8_C | |
" Common ANSI-standard Names | |
1 0.000013 syn keyword cAnsiName PRId8 PRIi16 PRIo32 PRIu64 | |
1 0.000013 syn keyword cAnsiName PRId16 PRIi32 PRIo64 PRIuLEAST8 | |
1 0.000014 syn keyword cAnsiName PRId32 PRIi64 PRIoLEAST8 PRIuLEAST16 | |
1 0.000014 syn keyword cAnsiName PRId64 PRIiLEAST8 PRIoLEAST16 PRIuLEAST32 | |
1 0.000014 syn keyword cAnsiName PRIdLEAST8 PRIiLEAST16 PRIoLEAST32 PRIuLEAST64 | |
1 0.000014 syn keyword cAnsiName PRIdLEAST16 PRIiLEAST32 PRIoLEAST64 PRIuFAST8 | |
1 0.000014 syn keyword cAnsiName PRIdLEAST32 PRIiLEAST64 PRIoFAST8 PRIuFAST16 | |
1 0.000014 syn keyword cAnsiName PRIdLEAST64 PRIiFAST8 PRIoFAST16 PRIuFAST32 | |
1 0.000014 syn keyword cAnsiName PRIdFAST8 PRIiFAST16 PRIoFAST32 PRIuFAST64 | |
1 0.000014 syn keyword cAnsiName PRIdFAST16 PRIiFAST32 PRIoFAST64 PRIuMAX | |
1 0.000014 syn keyword cAnsiName PRIdFAST32 PRIiFAST64 PRIoMAX PRIuPTR | |
1 0.000014 syn keyword cAnsiName PRIdFAST64 PRIiMAX PRIoPTR PRIx8 | |
1 0.000013 syn keyword cAnsiName PRIdMAX PRIiPTR PRIu8 PRIx16 | |
1 0.000013 syn keyword cAnsiName PRIdPTR PRIo8 PRIu16 PRIx32 | |
1 0.000013 syn keyword cAnsiName PRIi8 PRIo16 PRIu32 PRIx64 | |
1 0.000016 syn keyword cAnsiName PRIxLEAST8 SCNd8 SCNiFAST32 SCNuLEAST32 | |
1 0.000016 syn keyword cAnsiName PRIxLEAST16 SCNd16 SCNiFAST64 SCNuLEAST64 | |
1 0.000015 syn keyword cAnsiName PRIxLEAST32 SCNd32 SCNiMAX SCNuFAST8 | |
1 0.000015 syn keyword cAnsiName PRIxLEAST64 SCNd64 SCNiPTR SCNuFAST16 | |
1 0.000016 syn keyword cAnsiName PRIxFAST8 SCNdLEAST8 SCNo8 SCNuFAST32 | |
1 0.000016 syn keyword cAnsiName PRIxFAST16 SCNdLEAST16 SCNo16 SCNuFAST64 | |
1 0.000015 syn keyword cAnsiName PRIxFAST32 SCNdLEAST32 SCNo32 SCNuMAX | |
1 0.000015 syn keyword cAnsiName PRIxFAST64 SCNdLEAST64 SCNo64 SCNuPTR | |
1 0.000018 syn keyword cAnsiName PRIxMAX SCNdFAST8 SCNoLEAST8 SCNx8 | |
1 0.000016 syn keyword cAnsiName PRIxPTR SCNdFAST16 SCNoLEAST16 SCNx16 | |
1 0.000016 syn keyword cAnsiName PRIX8 SCNdFAST32 SCNoLEAST32 SCNx32 | |
1 0.000016 syn keyword cAnsiName PRIX16 SCNdFAST64 SCNoLEAST64 SCNx64 | |
1 0.000016 syn keyword cAnsiName PRIX32 SCNdMAX SCNoFAST8 SCNxLEAST8 | |
1 0.000016 syn keyword cAnsiName PRIX64 SCNdPTR SCNoFAST16 SCNxLEAST16 | |
1 0.000015 syn keyword cAnsiName PRIXLEAST8 SCNi8 SCNoFAST32 SCNxLEAST32 | |
1 0.000016 syn keyword cAnsiName PRIXLEAST16 SCNi16 SCNoFAST64 SCNxLEAST64 | |
1 0.000016 syn keyword cAnsiName PRIXLEAST32 SCNi32 SCNoMAX SCNxFAST8 | |
1 0.000016 syn keyword cAnsiName PRIXLEAST64 SCNi64 SCNoPTR SCNxFAST16 | |
1 0.000016 syn keyword cAnsiName PRIXFAST8 SCNiLEAST8 SCNu8 SCNxFAST32 | |
1 0.000016 syn keyword cAnsiName PRIXFAST16 SCNiLEAST16 SCNu16 SCNxFAST64 | |
1 0.000016 syn keyword cAnsiName PRIXFAST32 SCNiLEAST32 SCNu32 SCNxMAX | |
1 0.000016 syn keyword cAnsiName PRIXFAST64 SCNiLEAST64 SCNu64 SCNxPTR | |
1 0.000014 syn keyword cAnsiName PRIXMAX SCNiFAST8 SCNuLEAST8 | |
1 0.000014 syn keyword cAnsiName PRIXPTR SCNiFAST16 SCNuLEAST16 | |
1 0.000013 syn keyword cAnsiName errno environ | |
1 0.000014 syn keyword cAnsiName STDC CX_LIMITED_RANGE | |
1 0.000014 syn keyword cAnsiName STDC FENV_ACCESS | |
1 0.000013 syn keyword cAnsiName STDC FP_CONTRACT | |
1 0.000013 syn keyword cAnsiName and bitor not_eq xor | |
1 0.000014 syn keyword cAnsiName and_eq compl or xor_eq | |
1 0.000013 syn keyword cAnsiName bitand not or_eq | |
1 0.000015 hi def link cAnsiFunction cFunction | |
1 0.000014 hi def link cAnsiName cIdentifier | |
1 0.000019 hi def link cFunction Function | |
1 0.000019 hi def link cIdentifier Identifier | |
" Booleans | |
1 0.000015 syn keyword cBoolean true false TRUE FALSE | |
1 0.000018 hi def link cBoolean Boolean | |
" ----------------------------------------------------------------------------- | |
" Additional optional highlighting | |
" ----------------------------------------------------------------------------- | |
" Operators | |
"syn match cOperator "\(<<\|>>\|[-+*/%&^|<>!=]\)=" | |
"syn match cOperator "<<\|>>\|&&\|||\|++\|--\|->" | |
"syn match cOperator "[.!~*&%<>^|=,+-]" | |
"syn match cOperator "/[^/*=]"me=e-1 | |
"syn match cOperator "/$" | |
"syn match cOperator "&&\|||" | |
"syn match cOperator "[][]" | |
" | |
"" Preprocs | |
"syn keyword cDefined defined contained containedin=cDefine | |
"hi def link cDefined cDefine | |
"" Functions | |
"syn match cUserFunction "\<\h\w*\>\(\s\|\n\)*("me=e-1 contains=cType,cDelimiter,cDefine | |
"syn match cUserFunctionPointer "(\s*\*\s*\h\w*\s*)\(\s\|\n\)*(" contains=cDelimiter,cOperator | |
" | |
"hi def link cUserFunction cFunction | |
"hi def link cUserFunctionPointer cFunction | |
" | |
"" Delimiters | |
"syn match cDelimiter "[();\\]" | |
"" foldmethod=syntax fix, courtesy of Ivan Freitas | |
"syn match cBraces display "[{}]" | |
" Links | |
"hi def link cDelimiter Delimiter | |
" foldmethod=syntax fix, courtesy of Ivan Freitas | |
"hi def link cBraces Delimiter | |
SCRIPT /usr/local/share/nvim/runtime/syntax/doxygen.vim | |
Sourced 1 time | |
Total time: 0.026129 | |
Self time: 0.021551 | |
count total (s) self (s) | |
" DoxyGen syntax hilighting extension for c/c++/idl/java | |
" Language: doxygen on top of c, cpp, idl, java, php | |
" Maintainer: Michael Geddes <[email protected]> | |
" Author: Michael Geddes | |
" Last Change: Jan 2009 (\tparam by Domnique Pelle, Aug 2013) | |
" Version: 1.23 | |
" | |
" Copyright 2004-2008 Michael Geddes | |
" Please feel free to use, modify & distribute all or part of this script, | |
" providing this copyright message remains. | |
" I would appreciate being acknowledged in any derived scripts, and would | |
" appreciate and welcome any updates, modifications or suggestions. | |
" NOTE: Comments welcome! | |
" | |
" There are two variables that control the syntax highlighting produced by this | |
" script: | |
" doxygen_enhanced_colour - Use the (non-standard) original colours designed | |
" for this highlighting. | |
" doxygen_my_rendering - Disable the HTML bold/italic/underline rendering. | |
" | |
" A brief description without '.' or '!' will cause the end comment | |
" character to be marked as an error. You can define the colour of this using | |
" the highlight doxygenErrorComment. | |
" A \link without an \endlink will cause an error highlight on the end-comment. | |
" This is defined by doxygenLinkError | |
" | |
" The variable g:doxygen_codeword_font can be set to the guifont for marking \c | |
" words - a 'typewriter' like font normally. Spaces must be escaped. It can | |
" also be set to any highlight attribute. Alternatively, a highlight for doxygenCodeWord | |
" can be used to override it. | |
" | |
" By default, highlighting is done assuming you have the JAVADOC_AUTOBRIEF | |
" setting turned on in your Doxygen configuration. If you don't, you | |
" can set the variable g:doxygen_javadoc_autobrief to 0 to have the | |
" highlighting more accurately reflect the way Doxygen will interpret your | |
" comments. | |
" | |
" Support for cpp, c, idl, doxygen and php. | |
" | |
" Special thanks to: Wu Yongwei, Toby Allsopp | |
" | |
1 0.000012 if exists('b:suppress_doxygen') | |
unlet b:suppress_doxygen | |
finish | |
endif | |
1 0.000023 if exists('b:current_syntax') && b:current_syntax =~ 'doxygen' && !exists('doxygen_debug_script') | |
finish | |
endif | |
1 0.000031 let s:cpo_save = &cpo | |
1 0.000005 try | |
1 0.000029 set cpo&vim | |
" Start of Doxygen syntax hilighting: | |
" | |
" C/C++ Style line comments | |
1 0.000104 syn region doxygenComment start=+/\*\(\*/\)\@![*!]+ end=+\*/+ contains=doxygenSyncStart,doxygenStart,doxygenTODO keepend fold containedin=phpRegion | |
1 0.000062 syn region doxygenCommentL start=+//[/!]<\@!+me=e-1 end=+$+ contains=doxygenStartL,@Spell keepend skipwhite skipnl nextgroup=doxygenComment2 fold containedin=phpRegion | |
1 0.000052 syn region doxygenCommentL start=+//[/!]<+me=e-2 end=+$+ contains=doxygenStartL,@Spell keepend skipwhite skipnl fold containedin=phpRegion | |
1 0.000055 syn region doxygenCommentL start=+//@\ze[{}]+ end=+$+ contains=doxygenGroupDefine,doxygenGroupDefineSpecial,@Spell fold containedin=phpRegion | |
" Single line brief followed by multiline comment. | |
1 0.000056 syn region doxygenComment2 start=+/\*\(\*/\)\@![*!]+ end=+\*/+ contained contains=doxygenSyncStart2,doxygenStart2,doxygenTODO keepend fold | |
" This helps with sync-ing as for some reason, syncing behaves differently to a normal region, and the start pattern does not get matched. | |
1 0.000064 syn match doxygenSyncStart2 +[^*/]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenStartSpecial,doxygenSkipComment,doxygenStartSkip2 skipwhite skipnl | |
" Skip empty lines at the start for when comments start on the 2nd/3rd line. | |
1 0.000047 syn match doxygenStartSkip2 +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenBody,doxygenStartSpecial,doxygenStartSkip skipwhite skipnl | |
1 0.000053 syn match doxygenStartSkip2 +^\s*\*$+ contained nextgroup=doxygenBody,doxygenStartSpecial,,doxygenStartSkip skipwhite skipnl | |
1 0.000054 syn match doxygenStart2 +/\*[*!]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenStartSpecial,doxygenStartSkip2 skipwhite skipnl | |
" Match the Starting pattern (effectively creating the start of a BNF) | |
1 0.000019 if !exists('g:doxygen_javadoc_autobrief') || g:doxygen_javadoc_autobrief | |
1 0.000071 syn match doxygenStart +/\*[*!]+ contained nextgroup=doxygenBrief,doxygenPrev,doxygenFindBriefSpecial,doxygenStartSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl | |
1 0.000043 syn match doxygenStartL +//[/!]+ contained nextgroup=doxygenPrevL,doxygenBriefL,doxygenSpecial skipwhite | |
" Match the first sentence as a brief comment | |
1 0.000011 if ! exists('g:doxygen_end_punctuation') | |
let g:doxygen_end_punctuation='[.]' | |
endif | |
1 0.000209 exe 'syn region doxygenBrief contained start=+[\\@]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]+ start=+\(^\s*\)\@<!\*/\@!+ start=+\<\k+ skip=+'.doxygen_end_punctuation.'\S\@=+ end=+'.doxygen_end_punctuation.'+ end=+\(\s*\(\n\s*\*\=\s*\)[@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\@=+ contains=doxygenSmallSpecial,doxygenContinueComment,doxygenBriefEndComment,doxygenFindBriefSpecial,doxygenSmallSpecial,@doxygenHtmlGroup,doxygenTODO,doxygenHyperLink,doxygenHashLink,@Spell skipnl nextgroup=doxygenBody' | |
1 0.000017 syn match doxygenBriefEndComment +\*/+ contained | |
1 0.000120 exe 'syn region doxygenBriefL start=+@\k\@!\|[\\@]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@]+ start=+\<+ skip=+'.doxygen_end_punctuation.'\S+ end=+'.doxygen_end_punctuation.'\|$+ contained contains=doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell keepend' | |
1 0.000034 syn match doxygenPrevL +<+ contained nextgroup=doxygenBriefL,doxygenSpecial skipwhite | |
1 0.000004 else | |
syn match doxygenStart +/\*[*!]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenFindBriefSpecial,doxygenStartSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl | |
syn match doxygenStartL +//[/!]+ contained nextgroup=doxygenPrevL,doxygenLine,doxygenSpecial skipwhite | |
syn region doxygenLine start=+@\k\@!\|[\\@]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@<]+ start=+\<+ end='$' contained contains=doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell keepend | |
syn match doxygenPrevL +<+ contained nextgroup=doxygenLine,doxygenSpecial skipwhite | |
endif | |
" This helps with sync-ing as for some reason, syncing behaves differently to a normal region, and the start pattern does not get matched. | |
1 0.000070 syn match doxygenSyncStart +\ze[^*/]+ contained nextgroup=doxygenBrief,doxygenPrev,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl | |
1 0.000100 syn region doxygenBriefLine contained start=+\<\k+ end=+\(\n\s*\*\=\s*\([@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\|\s*$\)\@=+ contains=doxygenContinueComment,doxygenFindBriefSpecial,doxygenSmallSpecial,@doxygenHtmlGroup,doxygenTODO,doxygenHyperLink,doxygenHashLink,@Spell skipwhite keepend | |
" Match a '<' for applying a comment to the previous element. | |
1 0.000050 syn match doxygenPrev +<+ contained nextgroup=doxygenBrief,doxygenBody,doxygenSpecial,doxygenStartSkip skipwhite | |
1 0.000011 if exists("c_comment_strings") | |
" These are anti-Doxygen comments. If there are more than two asterisks or 3 '/'s | |
" then turn the comments back into normal C comments. | |
syn region cComment start="/\*\*\*" end="\*/" contains=@cCommentGroup,cCommentString,cCharacter,cNumbersCom,cSpaceError | |
syn region cCommentL start="////" skip="\\$" end="$" contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError | |
else | |
1 0.000043 syn region cComment start="/\*\*\*" end="\*/" contains=@cCommentGroup,cSpaceError | |
1 0.000045 syn region cCommentL start="////" skip="\\$" end="$" contains=@cCommentGroup,cSpaceError | |
1 0.000004 endif | |
" Special commands at the start of the area: starting with '@' or '\' | |
1 0.000061 syn region doxygenStartSpecial contained start=+[@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!+ end=+$+ end=+\*/+me=s-1,he=s-1 contains=doxygenSpecial nextgroup=doxygenSkipComment skipnl keepend | |
1 0.000054 syn match doxygenSkipComment contained +^\s*\*/\@!+ nextgroup=doxygenBrief,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenPage skipwhite | |
"syn region doxygenBodyBit contained start=+$+ | |
" The main body of a doxygen comment. | |
1 0.000088 syn region doxygenBody contained start=+\(/\*[*!]\)\@<!<\|[^<]\|$+ matchgroup=doxygenEndComment end=+\*/+re=e-2,me=e-2 contains=doxygenContinueComment,doxygenTODO,doxygenSpecial,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell | |
" These allow the skipping of comment continuation '*' characters. | |
1 0.000020 syn match doxygenContinueComment contained +^\s*\*/\@!\s*+ | |
" Catch a Brief comment without punctuation - flag it as an error but | |
" make sure the end comment is picked up also. | |
1 0.000016 syn match doxygenErrorComment contained +\*/+ | |
" Skip empty lines at the start for when comments start on the 2nd/3rd line. | |
1 0.000013 if !exists('g:doxygen_javadoc_autobrief') || g:doxygen_javadoc_autobrief | |
1 0.000064 syn match doxygenStartSkip +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenBrief,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl | |
1 0.000061 syn match doxygenStartSkip +^\s*\*$+ contained nextgroup=doxygenBrief,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl | |
1 0.000004 else | |
syn match doxygenStartSkip +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage,doxygenBody skipwhite skipnl | |
syn match doxygenStartSkip +^\s*\*$+ contained nextgroup=doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage,doxygenBody skipwhite skipnl | |
endif | |
" Match an [@\]brief so that it moves to body-mode. | |
" | |
" | |
" syn match doxygenBriefLine contained | |
1 0.000025 syn match doxygenBriefSpecial contained +[@\\]+ nextgroup=doxygenBriefWord skipwhite | |
1 0.000066 syn region doxygenFindBriefSpecial start=+[@\\]brief\>+ end=+\(\n\s*\*\=\s*\([@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\|\s*$\)\@=+ keepend contains=doxygenBriefSpecial nextgroup=doxygenBody keepend skipwhite skipnl contained | |
" Create the single word matching special identifiers. | |
1 0.000017 fun! s:DxyCreateSmallSpecial( kword, name ) | |
let mx='[-:0-9A-Za-z_%=&+*/!~>|]\@<!\([-0-9A-Za-z_%=+*/!~>|#]\+[-0-9A-Za-z_%=+*/!~>|]\@!\|\\[\\<>&.]@\|[.,][0-9a-zA-Z_]\@=\|::\|([^)]*)\|&[0-9a-zA-Z]\{2,7};\)\+' | |
exe 'syn region doxygenSpecial'.a:name.'Word contained start=+'.a:kword.'+ end=+\(\_s\+'.mx.'\)\@<=[-a-zA-Z_0-9+*/^%|~!=&\\]\@!+ skipwhite contains=doxygenContinueComment,doxygen'.a:name.'Word' | |
exe 'syn match doxygen'.a:name.'Word contained "\_s\@<='.mx.'" contains=doxygenHtmlSpecial,@Spell keepend' | |
endfun | |
1 0.000381 0.000022 call s:DxyCreateSmallSpecial('p', 'Code') | |
1 0.000346 0.000019 call s:DxyCreateSmallSpecial('c', 'Code') | |
1 0.000375 0.000048 call s:DxyCreateSmallSpecial('b', 'Bold') | |
1 0.000346 0.000019 call s:DxyCreateSmallSpecial('e', 'Emphasised') | |
1 0.000346 0.000019 call s:DxyCreateSmallSpecial('em', 'Emphasised') | |
1 0.000343 0.000019 call s:DxyCreateSmallSpecial('a', 'Argument') | |
1 0.000367 0.000019 call s:DxyCreateSmallSpecial('ref', 'Ref') | |
1 0.000011 delfun s:DxyCreateSmallSpecial | |
1 0.001225 syn match doxygenSmallSpecial contained +[@\\]\(\<[npcbea]\>\|\<em\>\|\<ref\>\|\<link\>\|f\$\|[$\\&<>#]\)\@=+ nextgroup=doxygenOtherLink,doxygenHyperLink,doxygenHashLink,doxygenFormula,doxygenSymbol,doxygenSpecial.*Word | |
" Now for special characters | |
1 0.000127 syn match doxygenSpecial contained +[@\\]\(\<[npcbea]\>\|\<em\>\|\<ref\|\<link\>\>\|\<f\$\|[$\\&<>#]\)\@!+ nextgroup=doxygenParam,doxygenRetval,doxygenBriefWord,doxygenBold,doxygenBOther,doxygenOther,doxygenOtherTODO,doxygenOtherWARN,doxygenOtherBUG,doxygenPage,doxygenGroupDefine,doxygenCodeRegion,doxygenVerbatimRegion,doxygenDotRegion | |
" doxygenOtherLink,doxygenSymbol,doxygenFormula,doxygenErrorSpecial,doxygenSpecial.*Word | |
" | |
1 0.000019 syn match doxygenGroupDefine contained +@\@<=[{}]+ | |
1 0.000019 syn match doxygenGroupDefineSpecial contained +@\ze[{}]+ | |
1 0.000015 syn match doxygenErrorSpecial contained +\s+ | |
" Match parameters and retvals (highlighting the first word as special). | |
1 0.000041 syn match doxygenParamDirection contained "\v\[(\s*in>((]\s*\[|\s*,\s*)out>)=|out>((]\s*\[|\s*,\s*)in>)=)\]" nextgroup=doxygenParamName skipwhite | |
1 0.000028 syn keyword doxygenParam contained param tparam nextgroup=doxygenParamName,doxygenParamDirection skipwhite | |
1 0.000028 syn match doxygenParamName contained +[A-Za-z0-9_:]\++ nextgroup=doxygenSpecialMultilineDesc skipwhite | |
1 0.000022 syn keyword doxygenRetval contained retval throw exception nextgroup=doxygenParamName skipwhite | |
" Match one line identifiers. | |
1 0.000065 syn keyword doxygenOther contained addindex anchor | |
\ dontinclude endhtmlonly endlatexonly showinitializer hideinitializer | |
\ example htmlonly image include ingroup internal latexonly line | |
\ overload relates relatesalso sa skip skipline | |
\ until verbinclude version addtogroup htmlinclude copydoc dotfile | |
\ xmlonly endxmlonly | |
\ nextgroup=doxygenSpecialOnelineDesc | |
1 0.000062 syn region doxygenCodeRegion contained matchgroup=doxygenOther start=+\<code\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<endcode\>+ contains=doxygenCodeRegionSpecial,doxygenContinueComment,doxygenErrorComment,@NoSpell | |
1 0.000021 syn match doxygenCodeRegionSpecial contained +[\\@]\(endcode\>\)\@=+ | |
1 0.000063 syn region doxygenVerbatimRegion contained matchgroup=doxygenOther start=+\<verbatim\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<endverbatim\>+ contains=doxygenVerbatimRegionSpecial,doxygenContinueComment,doxygenErrorComment,@NoSpell | |
1 0.000022 syn match doxygenVerbatimRegionSpecial contained +[\\@]\(endverbatim\>\)\@=+ | |
1 0.000014 if exists('b:current_syntax') | |
1 0.000015 let b:doxygen_syntax_save=b:current_syntax | |
1 0.000007 unlet b:current_syntax | |
1 0.000004 endif | |
1 0.000807 syn include @Dotx syntax/dot.vim | |
1 0.000013 if exists('b:doxygen_syntax_save') | |
1 0.000011 let b:current_syntax=b:doxygen_syntax_save | |
1 0.000007 unlet b:doxygen_syntax_save | |
1 0.000004 else | |
unlet b:current_syntax | |
endif | |
1 0.000068 syn region doxygenDotRegion contained matchgroup=doxygenOther start=+\<dot\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<enddot\>+ contains=doxygenDotRegionSpecial,doxygenErrorComment,doxygenContinueComment,@NoSpell,@Dotx | |
1 0.000021 syn match doxygenDotRegionSpecial contained +[\\@]\(enddot\>\)\@=+ | |
" Match single line identifiers. | |
1 0.000035 syn keyword doxygenBOther contained class enum file fn mainpage interface | |
\ namespace struct typedef union var def name | |
\ nextgroup=doxygenSpecialTypeOnelineDesc | |
1 0.000018 syn keyword doxygenOther contained par nextgroup=doxygenHeaderLine | |
1 0.000029 syn region doxygenHeaderLine start=+.+ end=+^+ contained skipwhite nextgroup=doxygenSpecialMultilineDesc | |
1 0.000033 syn keyword doxygenOther contained arg author date deprecated li return returns see invariant note post pre remarks since test nextgroup=doxygenSpecialMultilineDesc | |
1 0.000021 syn keyword doxygenOtherTODO contained todo attention nextgroup=doxygenSpecialMultilineDesc | |
1 0.000018 syn keyword doxygenOtherWARN contained warning nextgroup=doxygenSpecialMultilineDesc | |
1 0.000019 syn keyword doxygenOtherBUG contained bug nextgroup=doxygenSpecialMultilineDesc | |
" Handle \link, \endlink, highlighting the link-to and the link text bits separately. | |
1 0.000056 syn region doxygenOtherLink matchgroup=doxygenOther start=+\<link\>+ end=+[\@]\@<=endlink\>+ contained contains=doxygenLinkWord,doxygenContinueComment,doxygenLinkError,doxygenEndlinkSpecial | |
1 0.000020 syn match doxygenEndlinkSpecial contained +[\\@]\zeendlink\>+ | |
1 0.000034 syn match doxygenLinkWord "[_a-zA-Z:#()][_a-z0-9A-Z:#()]*\>" contained skipnl nextgroup=doxygenLinkRest,doxygenContinueLinkComment | |
1 0.000035 syn match doxygenLinkRest +[^*@\\]\|\*/\@!\|[@\\]\(endlink\>\)\@!+ contained skipnl nextgroup=doxygenLinkRest,doxygenContinueLinkComment | |
1 0.000023 syn match doxygenContinueLinkComment contained +^\s*\*\=[^/]+me=e-1 nextgroup=doxygenLinkRest | |
1 0.000014 syn match doxygenLinkError "\*/" contained | |
" #Link hilighting. | |
1 0.000038 syn match doxygenHashLink /\([a-zA-Z_][0-9a-zA-Z_]*\)\?#\(\.[0-9a-zA-Z_]\@=\|[a-zA-Z0-9_]\+\|::\|()\)\+/ contained contains=doxygenHashSpecial | |
1 0.000016 syn match doxygenHashSpecial /#/ contained | |
1 0.000042 syn match doxygenHyperLink /\(\s\|^\s*\*\?\)\@<=\(http\|https\|ftp\):\/\/[-0-9a-zA-Z_?&=+#%/.!':;@~]\+/ contained | |
" Handle \page. This does not use doxygenBrief. | |
1 0.000025 syn match doxygenPage "[\\@]page\>"me=s+1 contained skipwhite nextgroup=doxygenPagePage | |
1 0.000016 syn keyword doxygenPagePage page contained skipwhite nextgroup=doxygenPageIdent | |
1 0.000044 syn region doxygenPageDesc start=+.\++ end=+$+ contained skipwhite contains=doxygenSmallSpecial,@doxygenHtmlGroup keepend skipwhite skipnl nextgroup=doxygenBody | |
1 0.000022 syn match doxygenPageIdent "\<[a-zA-Z_0-9]\+\>" contained nextgroup=doxygenPageDesc | |
" Handle section | |
1 0.000030 syn keyword doxygenOther defgroup section subsection subsubsection weakgroup contained skipwhite nextgroup=doxygenSpecialIdent | |
1 0.000044 syn region doxygenSpecialSectionDesc start=+.\++ end=+$+ contained skipwhite contains=doxygenSmallSpecial,@doxygenHtmlGroup keepend skipwhite skipnl nextgroup=doxygenContinueComment | |
1 0.000022 syn match doxygenSpecialIdent "\<[a-zA-Z_0-9]\+\>" contained nextgroup=doxygenSpecialSectionDesc | |
" Does the one-line description for the one-line type identifiers. | |
1 0.000035 syn region doxygenSpecialTypeOnelineDesc start=+.\++ end=+$+ contained skipwhite contains=doxygenSmallSpecial,@doxygenHtmlGroup keepend | |
1 0.000037 syn region doxygenSpecialOnelineDesc start=+.\++ end=+$+ contained skipwhite contains=doxygenSmallSpecial,@doxygenHtmlGroup keepend | |
" Handle the multiline description for the multiline type identifiers. | |
" Continue until an 'empty' line (can contain a '*' continuation) or until the | |
" next whole-line @ command \ command. | |
1 0.000087 syn region doxygenSpecialMultilineDesc start=+.\++ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ contained contains=doxygenSpecialContinueComment,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell skipwhite keepend | |
1 0.000028 syn match doxygenSpecialContinueComment contained +^\s*\*/\@!\s*+ nextgroup=doxygenSpecial skipwhite | |
" Handle special cases 'bold' and 'group' | |
1 0.000018 syn keyword doxygenBold contained bold nextgroup=doxygenSpecialHeading | |
1 0.000022 syn keyword doxygenBriefWord contained brief nextgroup=doxygenBriefLine skipwhite | |
1 0.000015 syn match doxygenSpecialHeading +.\++ contained skipwhite | |
1 0.000017 syn keyword doxygenGroup contained group nextgroup=doxygenGroupName skipwhite | |
1 0.000018 syn keyword doxygenGroupName contained +\k\++ nextgroup=doxygenSpecialOnelineDesc skipwhite | |
" Handle special symbol identifiers @$, @\, @$ etc | |
1 0.000018 syn match doxygenSymbol contained +[$\\&<>#n]+ | |
" Simplistic handling of formula regions | |
1 0.000036 syn region doxygenFormula contained matchgroup=doxygenFormulaEnds start=+f\$+ end=+[@\\]f\$+ contains=doxygenFormulaSpecial,doxygenFormulaOperator | |
1 0.000027 syn match doxygenFormulaSpecial contained +[@\\]\(f[^$]\|[^f]\)+me=s+1 nextgroup=doxygenFormulaKeyword,doxygenFormulaEscaped | |
1 0.000013 syn match doxygenFormulaEscaped contained "." | |
1 0.000015 syn match doxygenFormulaKeyword contained "[a-z]\+" | |
1 0.000014 syn match doxygenFormulaOperator contained +[_^]+ | |
1 0.000038 syn region doxygenFormula contained matchgroup=doxygenFormulaEnds start=+f\[+ end=+[@\\]f]+ contains=doxygenFormulaSpecial,doxygenFormulaOperator,doxygenAtom | |
1 0.000034 syn region doxygenAtom contained transparent matchgroup=doxygenFormulaOperator start=+{+ end=+}+ contains=doxygenAtom,doxygenFormulaSpecial,doxygenFormulaOperator | |
" Add TODO hilighting. | |
1 0.000016 syn keyword doxygenTODO contained TODO README XXX FIXME | |
" Supported HTML subset. Not perfect, but okay. | |
1 0.000010 syn case ignore | |
1 0.000107 syn region doxygenHtmlTag contained matchgroup=doxygenHtmlCh start=+\v\</=\ze([biuap]|em|strong|img|br|center|code|dfn|d[ldt]|hr|h[0-3]|li|[ou]l|pre|small|sub|sup|table|tt|var|caption|src|alt|longdesc|name|height|width|usemap|ismap|href|type)>+ skip=+\\<\|\<\k\+=\("[^"]*"\|'[^']*\)+ end=+>+ contains=doxygenHtmlCmd,doxygenContinueComment,doxygenHtmlVar | |
1 0.000050 syn keyword doxygenHtmlCmd contained b i em strong u img a br p center code dfn dl dd dt hr h1 h2 h3 li ol ul pre small sub sup table tt var caption nextgroup=doxygenHtmlVar skipwhite | |
1 0.000025 syn keyword doxygenHtmlVar contained src alt longdesc name height width usemap ismap href type nextgroup=doxygenHtmlEqu skipwhite | |
1 0.000018 syn match doxygenHtmlEqu contained +=+ nextgroup=doxygenHtmlExpr skipwhite | |
1 0.000026 syn match doxygenHtmlExpr contained +"\(\\.\|[^"]\)*"\|'\(\\.\|[^']\)*'+ nextgroup=doxygenHtmlVar skipwhite | |
1 0.000006 syn case match | |
1 0.000054 syn match doxygenHtmlSpecial contained "&\(copy\|quot\|[AEIOUYaeiouy]uml\|[AEIOUYaeiouy]acute\|[AEIOUaeiouy]grave\|[AEIOUaeiouy]circ\|[ANOano]tilde\|szlig\|[Aa]ring\|nbsp\|gt\|lt\|amp\);" | |
1 0.000035 syn cluster doxygenHtmlGroup contains=doxygenHtmlCode,doxygenHtmlBold,doxygenHtmlUnderline,doxygenHtmlItalic,doxygenHtmlSpecial,doxygenHtmlTag,doxygenHtmlLink | |
1 0.000030 syn cluster doxygenHtmlTop contains=@Spell,doxygenHtmlSpecial,doxygenHtmlTag,doxygenContinueComment | |
" Html Support | |
1 0.000043 syn region doxygenHtmlLink contained start=+<[aA]\>\s*\(\n\s*\*\s*\)\=\(\(name\|href\)=\("[^"]*"\|'[^']*'\)\)\=\s*>+ end=+</[aA]>+me=e-4 contains=@doxygenHtmlTop | |
1 0.000019 hi link doxygenHtmlLink Underlined | |
1 0.000033 syn region doxygenHtmlBold contained start="\c<b\>" end="\c</b>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlBoldUnderline,doxygenHtmlBoldItalic,@Spell | |
1 0.000038 syn region doxygenHtmlBold contained start="\c<strong\>" end="\c</strong>"me=e-9 contains=@doxygenHtmlTop,doxygenHtmlBoldUnderline,doxygenHtmlBoldItalic,@Spell | |
1 0.000029 syn region doxygenHtmlBoldUnderline contained start="\c<u\>" end="\c</u>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlBoldUnderlineItalic,@Spell | |
1 0.000029 syn region doxygenHtmlBoldItalic contained start="\c<i\>" end="\c</i>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlBoldItalicUnderline,@Spell | |
1 0.000030 syn region doxygenHtmlBoldItalic contained start="\c<em\>" end="\c</em>"me=e-5 contains=@doxygenHtmlTop,doxygenHtmlBoldItalicUnderline,@Spell | |
1 0.000026 syn region doxygenHtmlBoldUnderlineItalic contained start="\c<i\>" end="\c</i>"me=e-4 contains=@doxygenHtmlTop,@Spell | |
1 0.000028 syn region doxygenHtmlBoldUnderlineItalic contained start="\c<em\>" end="\c</em>"me=e-5 contains=@doxygenHtmlTop,@Spell | |
1 0.000028 syn region doxygenHtmlBoldItalicUnderline contained start="\c<u\>" end="\c</u>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlBoldUnderlineItalic,@Spell | |
1 0.000059 syn region doxygenHtmlUnderline contained start="\c<u\>" end="\c</u>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlUnderlineBold,doxygenHtmlUnderlineItalic,@Spell | |
1 0.000030 syn region doxygenHtmlUnderlineBold contained start="\c<b\>" end="\c</b>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlUnderlineBoldItalic,@Spell | |
1 0.000033 syn region doxygenHtmlUnderlineBold contained start="\c<strong\>" end="\c</strong>"me=e-9 contains=@doxygenHtmlTop,doxygenHtmlUnderlineBoldItalic,@Spell | |
1 0.000030 syn region doxygenHtmlUnderlineItalic contained start="\c<i\>" end="\c</i>"me=e-4 contains=@doxygenHtmlTop,htmUnderlineItalicBold,@Spell | |
1 0.000029 syn region doxygenHtmlUnderlineItalic contained start="\c<em\>" end="\c</em>"me=e-5 contains=@doxygenHtmlTop,htmUnderlineItalicBold,@Spell | |
1 0.000026 syn region doxygenHtmlUnderlineItalicBold contained start="\c<b\>" end="\c</b>"me=e-4 contains=@doxygenHtmlTop,@Spell | |
1 0.000029 syn region doxygenHtmlUnderlineItalicBold contained start="\c<strong\>" end="\c</strong>"me=e-9 contains=@doxygenHtmlTop,@Spell | |
1 0.000030 syn region doxygenHtmlUnderlineBoldItalic contained start="\c<i\>" end="\c</i>"me=e-4 contains=@doxygenHtmlTop,@Spell | |
1 0.000028 syn region doxygenHtmlUnderlineBoldItalic contained start="\c<em\>" end="\c</em>"me=e-5 contains=@doxygenHtmlTop,@Spell | |
1 0.000031 syn region doxygenHtmlItalic contained start="\c<i\>" end="\c</i>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlItalicBold,doxygenHtmlItalicUnderline,@Spell | |
1 0.000027 syn region doxygenHtmlItalic contained start="\c<em\>" end="\c</em>"me=e-5 contains=@doxygenHtmlTop,@Spell | |
1 0.000029 syn region doxygenHtmlItalicBold contained start="\c<b\>" end="\c</b>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlItalicBoldUnderline,@Spell | |
1 0.000033 syn region doxygenHtmlItalicBold contained start="\c<strong\>" end="\c</strong>"me=e-9 contains=@doxygenHtmlTop,doxygenHtmlItalicBoldUnderline,@Spell | |
1 0.000027 syn region doxygenHtmlItalicBoldUnderline contained start="\c<u\>" end="\c</u>"me=e-4 contains=@doxygenHtmlTop,@Spell | |
1 0.000029 syn region doxygenHtmlItalicUnderline contained start="\c<u\>" end="\c</u>"me=e-4 contains=@doxygenHtmlTop,doxygenHtmlItalicUnderlineBold,@Spell | |
1 0.000026 syn region doxygenHtmlItalicUnderlineBold contained start="\c<b\>" end="\c</b>"me=e-4 contains=@doxygenHtmlTop,@Spell | |
1 0.000029 syn region doxygenHtmlItalicUnderlineBold contained start="\c<strong\>" end="\c</strong>"me=e-9 contains=@doxygenHtmlTop,@Spell | |
1 0.000028 syn region doxygenHtmlCode contained start="\c<code\>" end="\c</code>"me=e-7 contains=@doxygenHtmlTop,@NoSpell | |
" Prevent the doxygen contained matches from leaking into the c/rc groups. | |
1 0.001885 syn cluster cParenGroup add=doxygen.* | |
1 0.000048 syn cluster cParenGroup remove=doxygenComment,doxygenCommentL | |
1 0.002098 syn cluster cPreProcGroup add=doxygen.* | |
1 0.002081 syn cluster cMultiGroup add=doxygen.* | |
1 0.002091 syn cluster rcParenGroup add=doxygen.* | |
1 0.000045 syn cluster rcParenGroup remove=doxygenComment,doxygenCommentL | |
1 0.002059 syn cluster rcGroup add=doxygen.* | |
1 0.000010 let s:my_syncolor=0 | |
1 0.000024 if !exists(':SynColor') | |
1 0.000024 command -nargs=+ SynColor hi def <args> | |
1 0.000006 let s:my_syncolor=1 | |
1 0.000004 endif | |
1 0.000006 let s:my_synlink=0 | |
1 0.000010 if !exists(':SynLink') | |
1 0.000022 command -nargs=+ SynLink hi def link <args> | |
1 0.000006 let s:my_synlink=1 | |
1 0.000004 endif | |
1 0.000006 try | |
"let did_doxygen_syntax_inits = &background | |
1 0.000021 hi doxygen_Dummy guifg=black | |
1 0.000015 fun! s:Doxygen_Hilights_Base() | |
SynLink doxygenHtmlSpecial Special | |
SynLink doxygenHtmlVar Type | |
SynLink doxygenHtmlExpr String | |
SynLink doxygenSmallSpecial SpecialChar | |
SynLink doxygenSpecialCodeWord doxygenSmallSpecial | |
SynLink doxygenSpecialBoldWord doxygenSmallSpecial | |
SynLink doxygenSpecialEmphasisedWord doxygenSmallSpecial | |
SynLink doxygenSpecialArgumentWord doxygenSmallSpecial | |
" SynColor doxygenFormulaKeyword cterm=bold ctermfg=DarkMagenta guifg=DarkMagenta gui=bold | |
SynLink doxygenFormulaKeyword Keyword | |
"SynColor doxygenFormulaEscaped ctermfg=DarkMagenta guifg=DarkMagenta gui=bold | |
SynLink doxygenFormulaEscaped Special | |
SynLink doxygenFormulaOperator Operator | |
SynLink doxygenFormula Statement | |
SynLink doxygenSymbol Constant | |
SynLink doxygenSpecial Special | |
SynLink doxygenFormulaSpecial Special | |
"SynColor doxygenFormulaSpecial ctermfg=DarkBlue guifg=DarkBlue | |
endfun | |
1 0.000362 0.000021 call s:Doxygen_Hilights_Base() | |
1 0.000008 fun! s:Doxygen_Hilights() | |
" Pick a sensible default for 'codeword'. | |
let font='' | |
if exists('g:doxygen_codeword_font') | |
if g:doxygen_codeword_font !~ '\<\k\+=' | |
let font='font='.g:doxygen_codeword_font | |
else | |
let font=g:doxygen_codeword_font | |
endif | |
else | |
" Try and pick a font (only some platforms have been tested). | |
if has('gui_running') | |
if has('gui_gtk2') | |
if &guifont == '' | |
let font="font='FreeSerif 12'" | |
else | |
let font="font='".substitute(&guifont, '^.\{-}\([0-9]\+\)$', 'FreeSerif \1','')."'" | |
endif | |
elseif has('gui_win32') || has('gui_win16') || has('gui_win95') | |
if exists('g:doxygen_use_bitsream_vera') && g:doxygen_use_bitsream_vera | |
let font_base='Bitstream_Vera_Sans_Mono' | |
else | |
let font_base='Lucida_Console' | |
endif | |
if &guifont == '' | |
let font='font='.font_base.':h10' | |
else | |
let font='font='.matchstr(substitute(&guifont, '^[^:]*', font_base,''),'[^,]*') | |
endif | |
elseif has('gui_athena') || has('gui_gtk') || &guifont=~'^\(-[^-]\+\)\{14}' | |
if &guifont == '' | |
let font='font=-b&h-lucidatypewriter-medium-r-normal-*-*-140-*-*-m-*-iso8859-1' | |
else | |
" let font='font='.substitute(&guifont,'^\(-[^-]\+\)\{7}-\([0-9]\+\).*', '-b\&h-lucidatypewriter-medium-r-normal-*-*-\2-*-*-m-*-iso8859-1','') | |
" The above line works, but it is hard to expect the combination of | |
" the two fonts will look good. | |
endif | |
elseif has('gui_kde') | |
" let font='font=Bitstream\ Vera\ Sans\ Mono/12/-1/5/50/0/0/0/0/0' | |
endif | |
endif | |
endif | |
if font=='' | let font='gui=bold' | endif | |
exe 'SynColor doxygenCodeWord term=bold cterm=bold '.font | |
if (exists('g:doxygen_enhanced_color') && g:doxygen_enhanced_color) || (exists('g:doxygen_enhanced_colour') && g:doxygen_enhanced_colour) | |
if &background=='light' | |
SynColor doxygenComment ctermfg=DarkRed guifg=DarkRed | |
SynColor doxygenBrief cterm=bold ctermfg=Cyan guifg=DarkBlue gui=bold | |
SynColor doxygenBody ctermfg=DarkBlue guifg=DarkBlue | |
SynColor doxygenSpecialTypeOnelineDesc cterm=bold ctermfg=DarkRed guifg=firebrick3 gui=bold | |
SynColor doxygenBOther cterm=bold ctermfg=DarkMagenta guifg=#aa50aa gui=bold | |
SynColor doxygenParam ctermfg=DarkGray guifg=#aa50aa | |
SynColor doxygenParamName cterm=italic ctermfg=DarkBlue guifg=DeepSkyBlue4 gui=italic,bold | |
SynColor doxygenSpecialOnelineDesc cterm=bold ctermfg=DarkCyan guifg=DodgerBlue3 gui=bold | |
SynColor doxygenSpecialHeading cterm=bold ctermfg=DarkBlue guifg=DeepSkyBlue4 gui=bold | |
SynColor doxygenPrev ctermfg=DarkGreen guifg=DarkGreen | |
else | |
SynColor doxygenComment ctermfg=LightRed guifg=LightRed | |
SynColor doxygenBrief cterm=bold ctermfg=Cyan ctermbg=darkgrey guifg=LightBlue gui=Bold,Italic | |
SynColor doxygenBody ctermfg=Cyan guifg=LightBlue | |
SynColor doxygenSpecialTypeOnelineDesc cterm=bold ctermfg=Red guifg=firebrick3 gui=bold | |
SynColor doxygenBOther cterm=bold ctermfg=Magenta guifg=#aa50aa gui=bold | |
SynColor doxygenParam ctermfg=LightGray guifg=LightGray | |
SynColor doxygenParamName cterm=italic ctermfg=LightBlue guifg=LightBlue gui=italic,bold | |
SynColor doxygenSpecialOnelineDesc cterm=bold ctermfg=LightCyan guifg=LightCyan gui=bold | |
SynColor doxygenSpecialHeading cterm=bold ctermfg=LightBlue guifg=LightBlue gui=bold | |
SynColor doxygenPrev ctermfg=LightGreen guifg=LightGreen | |
endif | |
else | |
SynLink doxygenComment SpecialComment | |
SynLink doxygenBrief Statement | |
SynLink doxygenBody Comment | |
SynLink doxygenSpecialTypeOnelineDesc Statement | |
SynLink doxygenBOther Constant | |
SynLink doxygenParam SpecialComment | |
SynLink doxygenParamName Underlined | |
SynLink doxygenSpecialOnelineDesc Statement | |
SynLink doxygenSpecialHeading Statement | |
SynLink doxygenPrev SpecialComment | |
endif | |
endfun | |
1 0.000724 0.000020 call s:Doxygen_Hilights() | |
" This is still a proposal, but won't do any harm. | |
1 0.000008 aug doxygengroup | |
1 0.000211 au! | |
1 0.000030 au Syntax UserColor_reset nested call s:Doxygen_Hilights_Base() | |
1 0.000026 au Syntax UserColor_{on,reset,enable} nested call s:Doxygen_Hilights() | |
1 0.000004 aug END | |
1 0.000033 SynLink doxygenBody Comment | |
1 0.000019 SynLink doxygenLine doxygenBody | |
1 0.000023 SynLink doxygenTODO Todo | |
1 0.000022 SynLink doxygenOtherTODO Todo | |
1 0.000022 SynLink doxygenOtherWARN Todo | |
1 0.000022 SynLink doxygenOtherBUG Todo | |
1 0.000022 SynLink doxygenErrorSpecial Error | |
1 0.000020 SynLink doxygenErrorEnd Error | |
1 0.000023 SynLink doxygenErrorComment Error | |
1 0.000022 SynLink doxygenLinkError Error | |
1 0.000018 SynLink doxygenBriefSpecial doxygenSpecial | |
1 0.000015 SynLink doxygenHashSpecial doxygenSpecial | |
1 0.000018 SynLink doxygenGroupDefineSpecial doxygenSpecial | |
1 0.000015 SynLink doxygenEndlinkSpecial doxygenSpecial | |
1 0.000016 SynLink doxygenCodeRegionSpecial doxygenSpecial | |
1 0.000016 SynLink doxygenVerbatimRegionSpecial doxygenSpecial | |
1 0.000016 SynLink doxygenDotRegionSpecial doxygenSpecial | |
1 0.000017 SynLink doxygenGroupDefine doxygenParam | |
1 0.000016 SynLink doxygenSpecialMultilineDesc doxygenSpecialOnelineDesc | |
1 0.000015 SynLink doxygenFormulaEnds doxygenSpecial | |
1 0.000022 SynLink doxygenBold doxygenParam | |
1 0.000016 SynLink doxygenBriefWord doxygenParam | |
1 0.000016 SynLink doxygenRetval doxygenParam | |
1 0.000016 SynLink doxygenOther doxygenParam | |
1 0.000019 SynLink doxygenStart doxygenComment | |
1 0.000019 SynLink doxygenStart2 doxygenStart | |
1 0.000019 SynLink doxygenComment2 doxygenComment | |
1 0.000019 SynLink doxygenCommentL doxygenComment | |
1 0.000018 SynLink doxygenContinueComment doxygenComment | |
1 0.000016 SynLink doxygenSpecialContinueComment doxygenComment | |
1 0.000018 SynLink doxygenSkipComment doxygenComment | |
1 0.000018 SynLink doxygenEndComment doxygenComment | |
1 0.000019 SynLink doxygenStartL doxygenComment | |
1 0.000018 SynLink doxygenBriefEndComment doxygenComment | |
1 0.000018 SynLink doxygenPrevL doxygenPrev | |
1 0.000018 SynLink doxygenBriefL doxygenBrief | |
1 0.000018 SynLink doxygenBriefLine doxygenBrief | |
1 0.000014 SynLink doxygenHeaderLine doxygenSpecialHeading | |
1 0.000018 SynLink doxygenStartSkip doxygenContinueComment | |
1 0.000015 SynLink doxygenLinkWord doxygenParamName | |
1 0.000024 SynLink doxygenLinkRest doxygenSpecialMultilineDesc | |
1 0.000016 SynLink doxygenHyperLink doxygenLinkWord | |
1 0.000016 SynLink doxygenHashLink doxygenLinkWord | |
1 0.000017 SynLink doxygenPage doxygenSpecial | |
1 0.000014 SynLink doxygenPagePage doxygenBOther | |
1 0.000014 SynLink doxygenPageIdent doxygenParamName | |
1 0.000014 SynLink doxygenPageDesc doxygenSpecialTypeOnelineDesc | |
1 0.000013 SynLink doxygenSpecialIdent doxygenPageIdent | |
1 0.000015 SynLink doxygenSpecialSectionDesc doxygenSpecialMultilineDesc | |
1 0.000019 SynLink doxygenSpecialRefWord doxygenOther | |
1 0.000015 SynLink doxygenRefWord doxygenPageIdent | |
1 0.000016 SynLink doxygenContinueLinkComment doxygenComment | |
1 0.000021 SynLink doxygenHtmlCh Function | |
1 0.000022 SynLink doxygenHtmlCmd Statement | |
1 0.000013 SynLink doxygenHtmlBoldItalicUnderline doxygenHtmlBoldUnderlineItalic | |
1 0.000013 SynLink doxygenHtmlUnderlineBold doxygenHtmlBoldUnderline | |
1 0.000013 SynLink doxygenHtmlUnderlineItalicBold doxygenHtmlBoldUnderlineItalic | |
1 0.000013 SynLink doxygenHtmlUnderlineBoldItalic doxygenHtmlBoldUnderlineItalic | |
1 0.000012 SynLink doxygenHtmlItalicUnderline doxygenHtmlUnderlineItalic | |
1 0.000012 SynLink doxygenHtmlItalicBold doxygenHtmlBoldItalic | |
1 0.000012 SynLink doxygenHtmlItalicBoldUnderline doxygenHtmlBoldUnderlineItalic | |
1 0.000012 SynLink doxygenHtmlItalicUnderlineBold doxygenHtmlBoldUnderlineItalic | |
1 0.000021 SynLink doxygenHtmlLink Underlined | |
1 0.000022 SynLink doxygenParamDirection StorageClass | |
1 0.000018 if !exists("doxygen_my_rendering") && !exists("html_my_rendering") | |
1 0.000020 SynColor doxygenBoldWord term=bold cterm=bold gui=bold | |
1 0.000018 SynColor doxygenEmphasisedWord term=italic cterm=italic gui=italic | |
1 0.000017 SynLink doxygenArgumentWord doxygenEmphasisedWord | |
1 0.000014 SynLink doxygenHtmlCode doxygenCodeWord | |
1 0.000014 SynLink doxygenHtmlBold doxygenBoldWord | |
1 0.000019 SynColor doxygenHtmlBoldUnderline term=bold,underline cterm=bold,underline gui=bold,underline | |
1 0.000018 SynColor doxygenHtmlBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic | |
1 0.000021 SynColor doxygenHtmlBoldUnderlineItalic term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline | |
1 0.000016 SynColor doxygenHtmlUnderline term=underline cterm=underline gui=underline | |
1 0.000018 SynColor doxygenHtmlUnderlineItalic term=italic,underline cterm=italic,underline gui=italic,underline | |
1 0.000015 SynColor doxygenHtmlItalic term=italic cterm=italic gui=italic | |
1 0.000004 endif | |
1 0.000005 finally | |
1 0.000015 if s:my_synlink | delcommand SynLink | endif | |
1 0.000012 if s:my_syncolor | delcommand SynColor | endif | |
1 0.000005 endtry | |
1 0.000011 if &syntax=='idl' | |
syn cluster idlCommentable add=doxygenComment,doxygenCommentL | |
endif | |
"syn sync clear | |
"syn sync maxlines=500 | |
"syn sync minlines=50 | |
1 0.000039 syn sync match doxygenComment groupthere cComment "/\@<!/\*" | |
1 0.000026 syn sync match doxygenSyncComment grouphere doxygenComment "/\@<!/\*[*!]" | |
"syn sync match doxygenSyncComment grouphere doxygenComment "/\*[*!]" contains=doxygenStart,doxygenTODO keepend | |
1 0.000014 syn sync match doxygenSyncEndComment groupthere NONE "\*/" | |
1 0.000010 if !exists('b:current_syntax') | |
let b:current_syntax = "doxygen" | |
else | |
1 0.000012 let b:current_syntax = b:current_syntax.'.doxygen' | |
1 0.000004 endif | |
1 0.000004 finally | |
1 0.000033 let &cpo = s:cpo_save | |
1 0.000006 unlet s:cpo_save | |
1 0.000005 endtry | |
" vim:et sw=2 sts=2 | |
SCRIPT /usr/local/share/nvim/runtime/syntax/dot.vim | |
Sourced 1 time | |
Total time: 0.001156 | |
Self time: 0.001156 | |
count total (s) self (s) | |
" Vim syntax file | |
" Language: Dot | |
" Filenames: *.dot | |
" Maintainer: Markus Mottl <[email protected]> | |
" URL: http://www.ocaml.info/vim/syntax/dot.vim | |
" Last Change: 2011 May 17 - improved identifier matching + two new keywords | |
" 2001 May 04 - initial version | |
" For version 5.x: Clear all syntax items | |
" For version 6.x: Quit when a syntax file was already loaded | |
1 0.000010 if version < 600 | |
syntax clear | |
elseif exists("b:current_syntax") | |
finish | |
endif | |
" Errors | |
1 0.000018 syn match dotParErr ")" | |
1 0.000015 syn match dotBrackErr "]" | |
1 0.000015 syn match dotBraceErr "}" | |
" Enclosing delimiters | |
1 0.000036 syn region dotEncl transparent matchgroup=dotParEncl start="(" matchgroup=dotParEncl end=")" contains=ALLBUT,dotParErr | |
1 0.000033 syn region dotEncl transparent matchgroup=dotBrackEncl start="\[" matchgroup=dotBrackEncl end="\]" contains=ALLBUT,dotBrackErr | |
1 0.000032 syn region dotEncl transparent matchgroup=dotBraceEncl start="{" matchgroup=dotBraceEncl end="}" contains=ALLBUT,dotBraceErr | |
" Comments | |
1 0.000031 syn region dotComment start="//" end="$" contains=dotComment,dotTodo | |
1 0.000031 syn region dotComment start="/\*" end="\*/" contains=dotComment,dotTodo | |
1 0.000014 syn keyword dotTodo contained TODO FIXME XXX | |
" Strings | |
1 0.000028 syn region dotString start=+"+ skip=+\\\\\|\\"+ end=+"+ | |
" General keywords | |
1 0.000015 syn keyword dotKeyword digraph node edge subgraph | |
" Graph attributes | |
1 0.000017 syn keyword dotType center layers margin mclimit name nodesep nslimit | |
1 0.000015 syn keyword dotType ordering page pagedir rank rankdir ranksep ratio | |
1 0.000011 syn keyword dotType rotate size | |
" Node attributes | |
1 0.000016 syn keyword dotType distortion fillcolor fontcolor fontname fontsize | |
1 0.000014 syn keyword dotType height layer orientation peripheries regular | |
1 0.000015 syn keyword dotType shape shapefile sides skew width | |
" Edge attributes | |
1 0.000014 syn keyword dotType arrowhead arrowsize arrowtail constraint decorateP | |
1 0.000015 syn keyword dotType dir headclip headlabel headport labelangle labeldistance | |
1 0.000012 syn keyword dotType labelfontcolor labelfontname labelfontsize | |
1 0.000015 syn keyword dotType minlen port_label_distance samehead sametail | |
1 0.000014 syn keyword dotType tailclip taillabel tailport weight | |
" Shared attributes (graphs, nodes, edges) | |
1 0.000011 syn keyword dotType color | |
" Shared attributes (graphs and edges) | |
1 0.000012 syn keyword dotType bgcolor label URL | |
" Shared attributes (nodes and edges) | |
1 0.000014 syn keyword dotType fontcolor fontname fontsize layer style | |
" Special chars | |
1 0.000014 syn match dotKeyChar "=" | |
1 0.000014 syn match dotKeyChar ";" | |
1 0.000016 syn match dotKeyChar "->" | |
" Identifier | |
1 0.000021 syn match dotIdentifier /\<\w\+\(:\w\+\)\?\>/ | |
" Synchronization | |
1 0.000008 syn sync minlines=50 | |
1 0.000007 syn sync maxlines=500 | |
" Define the default highlighting. | |
" For version 5.7 and earlier: only when not done already | |
" For version 5.8 and later: only when an item doesn't have highlighting yet | |
1 0.000009 if version >= 508 || !exists("did_dot_syntax_inits") | |
1 0.000006 if version < 508 | |
let did_dot_syntax_inits = 1 | |
command -nargs=+ HiLink hi link <args> | |
else | |
1 0.000031 command -nargs=+ HiLink hi def link <args> | |
1 0.000003 endif | |
1 0.000038 HiLink dotParErr Error | |
1 0.000021 HiLink dotBraceErr Error | |
1 0.000020 HiLink dotBrackErr Error | |
1 0.000021 HiLink dotComment Comment | |
1 0.000020 HiLink dotTodo Todo | |
1 0.000020 HiLink dotParEncl Keyword | |
1 0.000020 HiLink dotBrackEncl Keyword | |
1 0.000023 HiLink dotBraceEncl Keyword | |
1 0.000020 HiLink dotKeyword Keyword | |
1 0.000020 HiLink dotType Type | |
1 0.000020 HiLink dotKeyChar Keyword | |
1 0.000021 HiLink dotString String | |
1 0.000021 HiLink dotIdentifier Identifier | |
1 0.000006 delcommand HiLink | |
1 0.000004 endif | |
1 0.000009 let b:current_syntax = "dot" | |
" vim: ts=8 | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/gita/argument.vim | |
Sourced 1 time | |
Total time: 0.193227 | |
Self time: 0.001120 | |
count total (s) self (s) | |
"****************************************************************************** | |
" vim-gita argument | |
" | |
" Author: Alisue <[email protected]> | |
" URL: http://hashnote.net/ | |
" License: MIT license | |
" (C) 2015, Alisue, hashnote.net | |
"****************************************************************************** | |
1 0.000062 let s:save_cpo = &cpo | |
1 0.000067 set cpo&vim | |
1 0.000483 let s:Path = gita#util#import('System.Filepath') | |
1 0.094927 0.000022 let s:ArgumentParser = gita#util#import('ArgumentParser') | |
1 0.000009 function! s:get_parser() abort " {{{ | |
if !exists('s:parser') | |
let s:parser = s:ArgumentParser.new({ | |
\ 'name': 'An altimate git interface of Vim', | |
\}) | |
call s:parser.add_argument( | |
\ 'action', | |
\ 'An action of the Gita command', { | |
\ 'terminal': 1, | |
\ }) | |
endif | |
return s:parser | |
endfunction " }}} | |
1 0.000014 function! gita#argument#parse(bang, range, ...) abort " {{{ | |
let cmdline = get(a:000, 0, '') | |
let parser = s:get_parser() | |
let opts = parser.parse(a:bang, a:range, cmdline) | |
if opts.__bang__ || !has_key(opts, 'action') || opts.action !~# s:gita_command_names_pattern | |
let opts.__name__ = get(opts, 'action', '') | |
return opts | |
endif | |
let parser = call(printf('gita#argument#%s#get_parser', opts.action), []) | |
let opts = parser.parse_args(opts.__unknown__, { | |
\ '__name__': opts.action, | |
\ '__bang__': opts.__bang__, | |
\ '__range__': opts.__range__, | |
\}) | |
return opts | |
endfunction " }}} | |
1 0.000011 function! gita#argument#complete(arglead, cmdline, cursorpos) abort " {{{ | |
let bang = a:cmdline =~# '\v^Gita!' | |
let cmdline = substitute(a:cmdline, '\v^Gita!?\s?', '', '') | |
let parser = s:get_parser() | |
let opts = parser.parse_cmdline(cmdline) | |
if bang || !has_key(opts, 'action') || opts.action !~# s:gita_command_names_pattern | |
let candidates = filter( | |
\ copy(s:git_command_names), | |
\ 'v:val =~# "^" . a:arglead', | |
\) | |
else | |
let parser = call(printf('gita#argument#%s#get_parser', opts.action), []) | |
let opts = parser.parse_args(opts.__unknown__, { | |
\ '__name__': opts.action, | |
\}) | |
let candidates = call( | |
\ parser.complete, [ | |
\ a:arglead, | |
\ join(opts.__unknown__), | |
\ a:cursorpos, | |
\ opts, | |
\ ], | |
\ parser) | |
endif | |
return candidates | |
endfunction | |
" }}} | |
1 0.000037 let s:git_command_names = [ | |
\ 'init', 'add', 'rm', 'mv', 'status', 'commit', 'clean', | |
\ 'log', 'diff', 'show', | |
\ 'branch', 'checkout', 'merge', 'rebase', 'tag', | |
\ 'clone', 'fetch', 'pull', 'push', 'remote', | |
\ 'reset', 'rebase', 'bisect', 'grep', 'stash', 'prune', | |
\ 'rev_parse', 'ls_tree', 'cat_file', 'archive', 'gc', | |
\ 'fsck', 'config', 'help', | |
\ 'browse', | |
\] | |
1 0.000035 let s:git_command_names_pattern = printf('\v%%(%s)', join(s:git_command_names, '|')) | |
1 0.000013 let s:gita_command_names = [ | |
\ 'status', 'commit', 'diff', 'browse', | |
\] | |
1 0.000019 let s:gita_command_names_pattern = printf('\v%%(%s)', join(s:gita_command_names, '|')) | |
1 0.000035 let &cpo = s:save_cpo | |
1 0.000006 unlet s:save_cpo | |
"vim: sts=2 sw=2 smarttab et ai textwidth=0 fdm=marker | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/gita/util.vim | |
Sourced 1 time | |
Total time: 0.097055 | |
Self time: 0.001742 | |
count total (s) self (s) | |
"****************************************************************************** | |
" vim-gita utility | |
" | |
" Author: Alisue <[email protected]> | |
" URL: http://hashnote.net/ | |
" License: MIT license | |
" (C) 2015, Alisue, hashnote.net | |
"****************************************************************************** | |
1 0.000047 let s:save_cpo = &cpo | |
1 0.000043 set cpo&vim | |
1 0.000020 function! s:get_vital() " {{{ | |
if !exists('s:_vital_module_Vital') | |
let s:_vital_module_Vital = vital#of('vim_gita') | |
endif | |
return s:_vital_module_Vital | |
endfunction " }}} | |
1 0.000021 function! gita#util#import(name) " {{{ | |
let cache_name = printf('_vital_module_%s', substitute(a:name, '\.', '_', 'g')) | |
if !has_key(s:, cache_name) | |
let s:[cache_name] = s:get_vital().import(a:name) | |
endif | |
return s:[cache_name] | |
endfunction " }}} | |
1 0.000034 let s:scriptfile = expand('<sfile>') | |
1 0.000668 let s:Prelude = gita#util#import('Prelude') | |
1 0.028999 0.000056 let s:List = gita#util#import('Data.List') | |
1 0.012742 0.000034 let s:Path = gita#util#import('System.Filepath') | |
" Vital | |
1 0.000015 function! gita#util#is_numeric(...) " {{{ | |
return call(s:Prelude.is_numeric, a:000, s:Prelude) | |
endfunction " }}} | |
1 0.000009 function! gita#util#is_number(...) " {{{ | |
return call(s:Prelude.is_number, a:000, s:Prelude) | |
endfunction " }}} | |
1 0.000008 function! gita#util#is_float(...) " {{{ | |
return call(s:Prelude.is_float, a:000, s:Prelude) | |
endfunction " }}} | |
1 0.000009 function! gita#util#is_string(...) " {{{ | |
return call(s:Prelude.is_string, a:000, s:Prelude) | |
endfunction " }}} | |
1 0.000009 function! gita#util#is_funcref(...) " {{{ | |
return call(s:Prelude.is_funcref, a:000, s:Prelude) | |
endfunction " }}} | |
1 0.000008 function! gita#util#is_list(...) " {{{ | |
return call(s:Prelude.is_list, a:000, s:Prelude) | |
endfunction " }}} | |
1 0.000008 function! gita#util#is_dict(...) " {{{ | |
return call(s:Prelude.is_dict, a:000, s:Prelude) | |
endfunction " }}} | |
1 0.000008 function! gita#util#flatten(...) " {{{ | |
return call(s:List.flatten, a:000, s:List) | |
endfunction " }}} | |
1 0.000009 function! gita#util#listalize(val) abort " {{{ | |
return gita#util#is_list(a:val) ? a:val : [a:val] | |
endfunction " }}} | |
" Message | |
1 0.000009 function! gita#util#echo(hl, msg) abort " {{{ | |
execute 'echohl' a:hl | |
try | |
for m in split(a:msg, '\v\r?\n') | |
echo m | |
endfor | |
finally | |
echohl None | |
endtry | |
endfunction " }}} | |
1 0.000009 function! gita#util#echomsg(hl, msg) abort " {{{ | |
execute 'echohl' a:hl | |
try | |
for m in split(a:msg, '\v\r?\n') | |
echomsg m | |
endfor | |
finally | |
echohl None | |
endtry | |
endfunction " }}} | |
1 0.000009 function! gita#util#input(hl, msg, ...) abort " {{{ | |
execute 'echohl' a:hl | |
try | |
return input(a:msg, get(a:000, 0, '')) | |
finally | |
echohl None | |
endtry | |
endfunction " }}} | |
1 0.000008 function! gita#util#debug(...) abort " {{{ | |
if !get(g:, 'gita#debug', 0) | |
return | |
endif | |
let parts = [] | |
for x in a:000 | |
call add(parts, string(x)) | |
silent unlet! x | |
endfor | |
call gita#util#echomsg('Comment', 'DEBUG: ' . join(parts)) | |
endfunction " }}} | |
1 0.000011 function! gita#util#info(message, ...) abort " {{{ | |
let title = get(a:000, 0, '') | |
if strlen(title) | |
call gita#util#echomsg('Title', title) | |
call gita#util#echomsg('None', a:message) | |
else | |
call gita#util#echomsg('Title', a:message) | |
endif | |
endfunction " }}} | |
1 0.000009 function! gita#util#warn(message, ...) abort " {{{ | |
let title = get(a:000, 0, '') | |
if strlen(title) | |
call gita#util#echomsg('WarningMsg', title) | |
call gita#util#echomsg('None', a:message) | |
else | |
call gita#util#echomsg('WarningMsg', a:message) | |
endif | |
endfunction " }}} | |
1 0.000009 function! gita#util#error(message, ...) abort " {{{ | |
let title = get(a:000, 0, '') | |
if strlen(title) | |
call gita#util#echomsg('Error', title) | |
call gita#util#echomsg('None', a:message) | |
else | |
call gita#util#echomsg('Error', a:message) | |
endif | |
endfunction " }}} | |
1 0.000009 function! gita#util#ask(message, ...) abort " {{{ | |
let result = gita#util#input('Question', a:message, get(a:000, 0, '')) | |
redraw | |
return result | |
endfunction " }}} | |
1 0.000011 function! gita#util#asktf(message, ...) abort " {{{ | |
let result = gita#util#ask( | |
\ printf('%s [yes/no]: ', a:message), | |
\ get(a:000, 0, '')) | |
while result !~? '^\%(y\%[es]\|n\%[o]\)$' | |
redraw | |
if result == '' | |
call gita#util#warn('Canceled.') | |
break | |
endif | |
call gita#util#error('Invalid input.') | |
let result = gita#util#ask(printf('%s [yes/no]: ', a:message)) | |
endwhile | |
redraw | |
return result =~? 'y\%[es]' | |
endfunction " }}} | |
" Buffer | |
1 0.000011 function! gita#util#buffer_get_name(name, ...) abort " {{{ | |
let sep = has('unix') ? ':' : '#' | |
return join(['vim-gita'] + a:000 + [a:name], sep) | |
endfunction " }}} | |
1 0.000010 function! gita#util#buffer_open(buffer, ...) abort " {{{ | |
let B = gita#util#import('Vim.Buffer') | |
let opener = get(a:000, 0, get(g:, 'gita#buffer#opener', 'edit')) | |
return B.open(a:buffer, opener) | |
endfunction " }}} | |
1 0.000010 function! gita#util#buffer_update(buflines) abort " {{{ | |
let saved_cur = getpos('.') | |
let saved_undolevels = &undolevels | |
setlocal undolevels=-1 | |
silent %delete _ | |
call setline(1, a:buflines) | |
call setpos('.', saved_cur) | |
silent execute 'setlocal undolevels=' . saved_undolevels | |
setlocal nomodified | |
endfunction " }}} | |
1 0.000009 function! gita#util#buffer_clear_undo() abort " {{{ | |
let saved_undolevels = &undolevels | |
setlocal undolevels=-1 | |
silent execute "normal a \<BS>\<ESC>" | |
silent execute 'setlocal undolevels=' . saved_undolevels | |
endfunction " }}} | |
1 0.000011 function! gita#util#buffer_is_listed_in_tabpage(expr) abort " {{{ | |
let bufnum = bufnr(a:expr) | |
if bufnum == -1 | |
return 0 | |
endif | |
let buflist = tabpagebuflist() | |
call gita#util#debug('buflist', buflist) | |
return string(bufnum) =~# printf('\v^%%(%s)$', join(buflist, '|')) | |
endfunction " }}} | |
" Invoker | |
1 0.000009 function! gita#util#invoker_get(...) abort " {{{ | |
let bufname = get(a:000, 0, '%') | |
let invoker = getbufvar(bufname, '_invoker', {}) | |
if empty(invoker) | |
let bufnum = bufnr(bufname) | |
let winnum = bufwinnr(bufnum) | |
let invoker = { | |
\ 'bufnum': bufnum, | |
\ 'winnum': winnum, | |
\} | |
endif | |
return invoker | |
endfunction " }}} | |
1 0.000010 function! gita#util#invoker_set(invoker, ...) abort " {{{ | |
let bufname = get(a:000, 0, '%') | |
call setbufvar(bufname, '_invoker', a:invoker) | |
endfunction " }}} | |
1 0.000010 function! gita#util#invoker_get_winnum(...) abort " {{{ | |
let invoker = call('gita#util#invoker_get', a:000) | |
let bufnum = invoker.bufnum | |
let winnum = bufwinnr(bufnum) | |
if winnum == -1 | |
let winnum = invoker.winnum | |
endif | |
return winnum | |
endfunction " }}} | |
1 0.000009 function! gita#util#invoker_focus(...) abort " {{{ | |
let winnum = call('gita#util#invoker_get_winnum', a:000) | |
if winnum <= winnr('$') | |
silent execute winnum . 'wincmd w' | |
else | |
silent execute 'wincmd p' | |
endif | |
endfunction " }}} | |
" Interface | |
1 0.000010 function! gita#util#interface_open(name, group, ...) abort " {{{ | |
let config = get(a:000, 0, {}) | |
let vname = printf('interface_buffer_manager_%s', a:group) | |
if !has_key(s:, vname) | |
let BM = gita#util#import('Vim.BufferManager') | |
let s:{vname} = BM.new(config) | |
endif | |
return s:{vname}.open(a:name, get(a:000, 0, {})) | |
endfunction " }}} | |
1 0.000010 function! gita#util#interface_get_misc_lines() abort " {{{ | |
let gita = gita#get() | |
let meta = gita.git.get_meta() | |
let name = fnamemodify(gita.git.worktree, ':t') | |
let branch = meta.current_branch | |
let remote_name = meta.current_branch_remote | |
let remote_branch = meta.current_remote_branch | |
let outgoing = gita.git.count_commits_ahead_of_remote() | |
let incoming = gita.git.count_commits_behind_remote() | |
let is_connected = !(empty(remote_name) || empty(remote_branch)) | |
let lines = [] | |
if is_connected | |
call add(lines, | |
\ printf('# Index and working tree status on a branch `%s/%s` <> `%s/%s`', | |
\ name, branch, remote_name, remote_branch | |
\)) | |
if outgoing > 0 && incoming > 0 | |
call add(lines, | |
\ printf('# The branch is %d commit(s) ahead and %d commit(s) behind of `%s/%s`', | |
\ outgoing, incoming, remote_name, remote_branch, | |
\)) | |
elseif outgoing > 0 | |
call add(lines, | |
\ printf('# The branch is %d commit(s) ahead of `%s/%s`', | |
\ outgoing, remote_name, remote_branch, | |
\)) | |
elseif incoming > 0 | |
call add(lines, | |
\ printf('# The branch is %d commit(s) behind `%s/%s`', | |
\ incoming, remote_name, remote_branch, | |
\)) | |
endif | |
else | |
call add(lines, | |
\ printf('# Index and working tree status on a branch `%s/%s`', | |
\ name, branch | |
\)) | |
endif | |
return lines | |
endfunction " }}} | |
1 0.000010 function! gita#util#interface_get_help(about) abort " {{{ | |
let vname = '_help_' . a:about | |
if !has_key(s:, vname) | |
let root = fnamemodify(s:scriptfile, ':h:h:h') | |
let filename = s:Path.join(root, 'help', a:about . '.txt') | |
if filereadable(filename) | |
let s:[vname] = readfile(filename) | |
else | |
let s:[vname] = [ | |
\ printf('%s is not found.', filename), | |
\] | |
endif | |
endif | |
return get(s:, vname) | |
endfunction " }}} | |
" Misc | |
1 0.000009 function! gita#util#doautocmd(name) abort " {{{ | |
let name = printf('vim-gita-%s', a:name) | |
if 703 < v:version || (v:version == 703 && has('patch438')) | |
silent execute 'doautocmd <nomodeline> User ' . name | |
else | |
silent execute 'doautocmd User ' . name | |
endif | |
endfunction " }}} | |
1 0.000010 function! gita#util#format(format, format_map, data) abort " {{{ | |
" format rule: | |
" %{<left>|<right>}<key> | |
" '<left><value><right>' if <value> != '' | |
" '' if <value> == '' | |
" %{<left>}<key> | |
" '<left><value>' if <value> != '' | |
" '' if <value> == '' | |
" %{|<right>}<key> | |
" '<value><right>' if <value> != '' | |
" '' if <value> == '' | |
if empty(a:data) | |
return '' | |
endif | |
let pattern_base = '\v\%%%%(\{([^\}\|]*)%%(\|([^\}\|]*)|)\}|)%s' | |
let str = copy(a:format) | |
for [key, value] in items(a:format_map) | |
let result = s:to_string(get(a:data, value, '')) | |
let pattern = printf(pattern_base, key) | |
let repl = strlen(result) ? printf('\1%s\2', result) : '' | |
let str = substitute(str, pattern, repl, 'g') | |
endfor | |
return substitute(str, '\v^\s+|\s+$', '', 'g') | |
endfunction | |
1 0.000008 function! s:to_string(value) | |
if gita#util#is_string(a:value) | |
return a:value | |
elseif gita#util#is_numeric(a:value) | |
return a:value ? string(a:value) : '' | |
elseif gita#util#is_list(a:value) || gita#util#is_dict(a:value) | |
return empty(a:value) ? string(a:value) : '' | |
else | |
return string(a:value) | |
endif | |
endfunction " }}} | |
1 0.000009 function! gita#util#yank(content) " {{{ | |
let @" = a:content | |
if has('clipboard') | |
call setreg(v:register, a:content) | |
endif | |
endfunction " }}} | |
1 0.000010 function! gita#util#smart_define(lhs, rhs, ...) abort " {{{ | |
let mode = get(a:000, 0, '') | |
let opts = extend({ | |
\ 'noremap': 0, | |
\ 'silent': 0, | |
\ 'buffer': 0, | |
\}, get(a:000, 1, {})) | |
if !hasmapto(a:rhs, mode) && empty(maparg(a:lhs, mode)) | |
silent execute printf('%s%smap %s%s %s %s', | |
\ mode, | |
\ opts.noremap ? 'nore' : '', | |
\ opts.silent ? '<silent>' : '', | |
\ opts.buffer ? '<buffer>' : '', | |
\ a:lhs, a:rhs, | |
\) | |
endif | |
endfunction " }}} | |
1 0.000035 let &cpo = s:save_cpo | |
1 0.000006 unlet s:save_cpo | |
"vim: sts=2 sw=2 smarttab et ai textwidth=0 fdm=marker | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital.vim | |
Sourced 1 time | |
Total time: 0.000088 | |
Self time: 0.000088 | |
count total (s) self (s) | |
function! vital#of(name) abort | |
let files = globpath(&runtimepath, 'autoload/vital/' . a:name . '.vital') | |
let file = split(files, "\n") | |
if empty(file) | |
throw 'vital: version file not found: ' . a:name | |
endif | |
let ver = readfile(file[0], 'b') | |
if empty(ver) | |
throw 'vital: invalid version file: ' . a:name | |
endif | |
return vital#_{substitute(ver[0], '\W', '', 'g')}#new() | |
endfunction | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita.vim | |
Sourced 1 time | |
Total time: 0.002083 | |
Self time: 0.002083 | |
count total (s) self (s) | |
let s:self_version = expand('<sfile>:t:r') | |
1 0.000024 let s:self_file = expand('<sfile>') | |
" Note: The extra argument to globpath() was added in Patch 7.2.051. | |
1 0.000027 let s:globpath_third_arg = v:version > 702 || v:version == 702 && has('patch51') | |
1 0.000014 let s:loaded = {} | |
1 0.000018 function! s:import(name, ...) abort | |
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 = s:_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 function! s:load(...) dict abort | |
for arg in a:000 | |
let [name; as] = type(arg) == type([]) ? arg[: 1] : [arg, arg] | |
let target = split(join(as, ''), '\W\+') | |
let dict = self | |
while 1 <= len(target) | |
let ns = remove(target, 0) | |
if !has_key(dict, ns) | |
let dict[ns] = {} | |
endif | |
if type(dict[ns]) == type({}) | |
let dict = dict[ns] | |
else | |
unlet dict | |
break | |
endif | |
endwhile | |
if exists('dict') | |
call extend(dict, s:_import(name)) | |
endif | |
unlet arg | |
endfor | |
return self | |
endfunction | |
1 0.000011 function! s:unload() abort | |
let s:loaded = {} | |
endfunction | |
1 0.000018 function! s:exists(name) abort | |
return s:_get_module_path(a:name) !=# '' | |
endfunction | |
1 0.000012 function! s:search(pattern) abort | |
let paths = s:_vital_files(a:pattern) | |
let modules = sort(map(paths, 's:_file2module(v:val)')) | |
return s:_uniq(modules) | |
endfunction | |
1 0.000015 function! s:expand_modules(entry, all) abort | |
if type(a:entry) == type([]) | |
let candidates = s:_concat(map(copy(a:entry), 's:search(v:val)')) | |
if empty(candidates) | |
throw printf('vital: Any of module %s is not found', string(a:entry)) | |
endif | |
if eval(join(map(copy(candidates), 'has_key(a:all, v:val)'), '+')) | |
let modules = [] | |
else | |
let modules = [candidates[0]] | |
endif | |
else | |
let modules = s:search(a:entry) | |
if empty(modules) | |
throw printf('vital: Module %s is not found', a:entry) | |
endif | |
endif | |
call filter(modules, '!has_key(a:all, v:val)') | |
for module in modules | |
let a:all[module] = 1 | |
endfor | |
return modules | |
endfunction | |
1 0.000012 function! s:_import(name) abort | |
if type(a:name) == type(0) | |
return s:_build_module(a:name) | |
endif | |
let path = s:_get_module_path(a:name) | |
if path ==# '' | |
throw 'vital: module not found: ' . a:name | |
endif | |
let sid = s:_get_sid_by_script(path) | |
if !sid | |
try | |
execute 'source' fnameescape(path) | |
catch /^Vim\%((\a\+)\)\?:E484/ | |
throw 'vital: module not found: ' . a:name | |
catch /^Vim\%((\a\+)\)\?:E127/ | |
" Ignore. | |
endtry | |
let sid = s:_get_sid_by_script(path) | |
endif | |
return s:_build_module(sid) | |
endfunction | |
1 0.000017 function! s:_get_module_path(name) abort | |
if s:_is_absolute_path(a:name) && filereadable(a:name) | |
return a:name | |
endif | |
if a:name ==# '' | |
let paths = [s:self_file] | |
elseif a:name =~# '\v^\u\w*%(\.\u\w*)*$' | |
let paths = s:_vital_files(a:name) | |
else | |
throw 'vital: Invalid module name: ' . a:name | |
endif | |
call filter(paths, 'filereadable(expand(v:val, 1))') | |
let path = get(paths, 0, '') | |
return path !=# '' ? path : '' | |
endfunction | |
1 0.000016 function! s:_get_sid_by_script(path) abort | |
let path = s:_unify_path(a:path) | |
for line in filter(split(s:_redir('scriptnames'), "\n"), | |
\ 'stridx(v:val, s:self_version) > 0') | |
let list = matchlist(line, '^\s*\(\d\+\):\s\+\(.\+\)\s*$') | |
if !empty(list) && s:_unify_path(list[2]) ==# path | |
return list[1] - 0 | |
endif | |
endfor | |
return 0 | |
endfunction | |
1 0.000014 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 | |
1 0.000050 if filereadable(expand('<sfile>:r') . '.VIM') | |
" resolve() is slow, so we cache results. | |
let s:_unify_path_cache = {} | |
" 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.000015 function! s:_unify_path(path) abort | |
return resolve(fnamemodify(a:path, ':p:gs?[\\/]?/?')) | |
endfunction | |
1 0.000007 endif | |
1 0.000012 if s:globpath_third_arg | |
1 0.000014 function! s:_runtime_files(path) abort | |
return split(globpath(&runtimepath, a:path, 1), "\n") | |
endfunction | |
1 0.000007 else | |
function! s:_runtime_files(path) abort | |
return split(globpath(&runtimepath, a:path), "\n") | |
endfunction | |
endif | |
1 0.000019 let s:_vital_files_cache_runtimepath = '' | |
1 0.000017 let s:_vital_files_cache = [] | |
1 0.000014 function! s:_vital_files(pattern) abort | |
if s:_vital_files_cache_runtimepath !=# &runtimepath | |
let path = printf('autoload/vital/%s/**/*.vim', s:self_version) | |
let s:_vital_files_cache = s:_runtime_files(path) | |
let mod = ':p:gs?[\\/]\+?/?' | |
call map(s:_vital_files_cache, 'fnamemodify(v:val, mod)') | |
let s:_vital_files_cache_runtimepath = &runtimepath | |
endif | |
let target = substitute(a:pattern, '\.', '/', 'g') | |
let target = substitute(target, '\*', '[^/]*', 'g') | |
let regexp = printf('autoload/vital/%s/%s.vim', s:self_version, target) | |
return filter(copy(s:_vital_files_cache), 'v:val =~# regexp') | |
endfunction | |
" Copy from System.Filepath | |
1 0.000055 if has('win16') || has('win32') || has('win64') | |
function! s:_is_absolute_path(path) abort | |
return a:path =~? '^[a-z]:[/\\]' | |
endfunction | |
else | |
1 0.000016 function! s:_is_absolute_path(path) abort | |
return a:path[0] ==# '/' | |
endfunction | |
1 0.000006 endif | |
1 0.000014 function! s:_build_module(sid) abort | |
if has_key(s:loaded, a:sid) | |
return copy(s:loaded[a:sid]) | |
endif | |
let functions = s:_get_functions(a:sid) | |
let prefix = '<SNR>' . a:sid . '_' | |
let module = {} | |
for func in functions | |
let module[func] = function(prefix . func) | |
endfor | |
if has_key(module, '_vital_loaded') | |
let V = vital#{s:self_version}#new() | |
if has_key(module, '_vital_depends') | |
let all = {} | |
let modules = | |
\ s:_concat(map(module._vital_depends(), | |
\ 's:expand_modules(v:val, all)')) | |
call call(V.load, modules, V) | |
endif | |
try | |
call module._vital_loaded(V) | |
catch | |
" FIXME: Show an error message for debug. | |
endtry | |
endif | |
if !get(g:, 'vital_debug', 0) | |
call filter(module, 'v:key =~# "^\\a"') | |
endif | |
let s:loaded[a:sid] = module | |
return copy(module) | |
endfunction | |
1 0.000020 if exists('+regexpengine') | |
1 0.000016 function! s:_get_functions(sid) abort | |
let funcs = s:_redir(printf("function /\\%%#=2^\<SNR>%d_", a:sid)) | |
let map_pat = '<SNR>' . a:sid . '_\zs\w\+' | |
return map(split(funcs, "\n"), 'matchstr(v:val, map_pat)') | |
endfunction | |
1 0.000006 else | |
function! s:_get_functions(sid) abort | |
let prefix = '<SNR>' . a:sid . '_' | |
let funcs = s:_redir('function') | |
let filter_pat = '^\s*function ' . prefix | |
let map_pat = prefix . '\zs\w\+' | |
return map(filter(split(funcs, "\n"), | |
\ 'stridx(v:val, prefix) > 0 && v:val =~# filter_pat'), | |
\ 'matchstr(v:val, map_pat)') | |
endfunction | |
endif | |
1 0.000017 if exists('*uniq') | |
1 0.000013 function! s:_uniq(list) abort | |
return uniq(a:list) | |
endfunction | |
1 0.000007 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) | |
let i -= 2 | |
else | |
let i -= 1 | |
endif | |
endwhile | |
return a:list | |
endfunction | |
endif | |
1 0.000012 function! s:_concat(lists) abort | |
let result_list = [] | |
for list in a:lists | |
let result_list += list | |
endfor | |
return result_list | |
endfunction | |
1 0.000012 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.000029 function! vital#{s:self_version}#new() abort | |
return s:_import('') | |
endfunction | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/Prelude.vim | |
Sourced 1 time | |
Total time: 0.002699 | |
Self time: 0.002699 | |
count total (s) self (s) | |
let s:save_cpo = &cpo | |
1 0.000053 set cpo&vim | |
1 0.000025 if v:version ># 703 || | |
\ (v:version is 703 && has('patch465')) | |
1 0.000020 function! s:glob(expr) abort | |
return glob(a:expr, 1, 1) | |
endfunction | |
1 0.000007 else | |
function! s:glob(expr) abort | |
let R = glob(a:expr, 1) | |
return split(R, '\n') | |
endfunction | |
endif | |
1 0.000015 function! s:globpath(path, expr) abort | |
let R = globpath(a:path, a:expr, 1) | |
return split(R, '\n') | |
endfunction | |
" Wrapper functions for type(). | |
1 0.000133 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 | |
1 0.000015 function! s:is_numeric(Value) abort | |
let _ = type(a:Value) | |
return _ ==# s:__TYPE_NUMBER | |
\ || _ ==# s:__TYPE_FLOAT | |
endfunction | |
" Number | |
1 0.000014 function! s:is_number(Value) abort | |
return type(a:Value) ==# s:__TYPE_NUMBER | |
endfunction | |
" Float | |
1 0.000013 function! s:is_float(Value) abort | |
return type(a:Value) ==# s:__TYPE_FLOAT | |
endfunction | |
" String | |
1 0.000013 function! s:is_string(Value) abort | |
return type(a:Value) ==# s:__TYPE_STRING | |
endfunction | |
" Funcref | |
1 0.000014 function! s:is_funcref(Value) abort | |
return type(a:Value) ==# s:__TYPE_FUNCREF | |
endfunction | |
" List | |
1 0.000018 function! s:is_list(Value) abort | |
return type(a:Value) ==# s:__TYPE_LIST | |
endfunction | |
" Dictionary | |
1 0.000013 function! s:is_dict(Value) abort | |
return type(a:Value) ==# s:__TYPE_DICT | |
endfunction | |
1 0.000020 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 | |
1 0.000014 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 | |
1 0.000016 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 | |
1 0.000022 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 | |
1 0.000011 if v:version >= 703 | |
" Use builtin function. | |
1 0.000014 function! s:wcswidth(str) abort | |
call s:_warn_deprecated("wcswidth", "Data.String.wcswidth") | |
return strwidth(a:str) | |
endfunction | |
1 0.000007 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 | |
1 0.000071 let s:is_windows = has('win16') || has('win32') || has('win64') || has('win95') | |
1 0.000026 let s:is_cygwin = has('win32unix') | |
1 0.000085 let s:is_mac = !s:is_windows && !s:is_cygwin | |
\ && (has('mac') || has('macunix') || has('gui_macvim') || | |
\ (!isdirectory('/proc') && executable('sw_vers'))) | |
1 0.000019 let s:is_unix = has('unix') | |
1 0.000015 function! s:is_windows() abort | |
return s:is_windows | |
endfunction | |
1 0.000013 function! s:is_cygwin() abort | |
return s:is_cygwin | |
endfunction | |
1 0.000011 function! s:is_mac() abort | |
return s:is_mac | |
endfunction | |
1 0.000012 function! s:is_unix() abort | |
return s:is_unix | |
endfunction | |
1 0.000016 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 | |
1 0.000017 function! s:smart_execute_command(action, word) abort | |
execute a:action . ' ' . (a:word == '' ? '' : '`=a:word`') | |
endfunction | |
1 0.000016 function! s:escape_file_searching(buffer_name) abort | |
return escape(a:buffer_name, '*[]?{}, ') | |
endfunction | |
1 0.000014 function! s:escape_pattern(str) abort | |
return escape(a:str, '~"\.^$[]*') | |
endfunction | |
1 0.000012 function! s:getchar(...) abort | |
let c = call('getchar', a:000) | |
return type(c) == type(0) ? nr2char(c) : c | |
endfunction | |
1 0.000013 function! s:getchar_safe(...) abort | |
let c = s:input_helper('getchar', a:000) | |
return type(c) == type("") ? c : nr2char(c) | |
endfunction | |
1 0.000013 function! s:input_safe(...) abort | |
return s:input_helper('input', a:000) | |
endfunction | |
1 0.000014 function! s:input_helper(funcname, args) abort | |
let success = 0 | |
if inputsave() !=# success | |
throw 'inputsave() failed' | |
endif | |
try | |
return call(a:funcname, a:args) | |
finally | |
if inputrestore() !=# success | |
throw 'inputrestore() failed' | |
endif | |
endtry | |
endfunction | |
1 0.000015 function! s:set_default(var, val) abort | |
if !exists(a:var) || type({a:var}) != type(a:val) | |
let {a:var} = a:val | |
endif | |
endfunction | |
1 0.000017 function! s:substitute_path_separator(path) abort | |
return s:is_windows ? substitute(a:path, '\\', '/', 'g') : a:path | |
endfunction | |
1 0.000014 function! s:path2directory(path) abort | |
return s:substitute_path_separator(isdirectory(a:path) ? a:path : fnamemodify(a:path, ':p:h')) | |
endfunction | |
1 0.000017 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 | |
1 0.000018 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 | |
1 0.000020 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 | |
1 0.000017 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 | |
1 0.000051 let &cpo = s:save_cpo | |
1 0.000017 unlet s:save_cpo | |
" vim:set et ts=2 sts=2 sw=2 tw=0: | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/Data/List.vim | |
Sourced 1 time | |
Total time: 0.002864 | |
Self time: 0.002864 | |
count total (s) self (s) | |
" Utilities for list. | |
1 0.000054 let s:save_cpo = &cpo | |
1 0.000054 set cpo&vim | |
1 0.000022 function! s:pop(list) abort | |
return remove(a:list, -1) | |
endfunction | |
1 0.000014 function! s:push(list, val) abort | |
call add(a:list, a:val) | |
return a:list | |
endfunction | |
1 0.000012 function! s:shift(list) abort | |
return remove(a:list, 0) | |
endfunction | |
1 0.000013 function! s:unshift(list, val) abort | |
return insert(a:list, a:val) | |
endfunction | |
1 0.000013 function! s:cons(x, xs) abort | |
return [a:x] + a:xs | |
endfunction | |
1 0.000013 function! s:conj(xs, x) abort | |
return a:xs + [a:x] | |
endfunction | |
" Removes duplicates from a list. | |
1 0.000012 function! s:uniq(list) abort | |
return s:uniq_by(a:list, 'v:val') | |
endfunction | |
" Removes duplicates from a list. | |
1 0.000014 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 | |
1 0.000012 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? | |
1 0.000014 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. | |
1 0.000013 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}. | |
1 0.000013 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 | |
1 0.000014 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} | |
1 0.000013 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} | |
1 0.000013 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 | |
1 0.000013 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'] | |
1 0.000014 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. | |
1 0.000012 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. | |
1 0.000014 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 | |
1 0.000012 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 | |
1 0.000013 function! s:break(f, xs) abort | |
return s:span(printf('!(%s)', a:f), a:xs) | |
endfunction | |
" similar to Haskell's Data.List.takeWhile | |
1 0.000015 function! s:take_while(f, xs) abort | |
return s:span(a:f, a:xs)[0] | |
endfunction | |
" similar to Haskell's Data.List.partition | |
1 0.000014 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 | |
1 0.000012 function! s:all(f, xs) abort | |
return !s:any(printf('!(%s)', a:f), a:xs) | |
endfunction | |
" similar to Haskell's Prelude.any | |
1 0.000012 function! s:any(f, xs) abort | |
return !empty(filter(map(copy(a:xs), a:f), 'v:val')) | |
endfunction | |
" similar to Haskell's Prelude.and | |
1 0.000013 function! s:and(xs) abort | |
return s:all('v:val', a:xs) | |
endfunction | |
" similar to Haskell's Prelude.or | |
1 0.000011 function! s:or(xs) abort | |
return s:any('v:val', a:xs) | |
endfunction | |
1 0.000015 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 | |
1 0.000013 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 | |
1 0.000013 function! s:foldl1(f, xs) abort | |
if len(a:xs) == 0 | |
throw 'foldl1' | |
endif | |
return s:foldl(a:f, a:xs[0], a:xs[1:]) | |
endfunction | |
" similar to Haskell's Prelude.foldr | |
1 0.000013 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 | |
1 0.000013 function! s:foldr1(f, xs) abort | |
if len(a:xs) == 0 | |
throw 'foldr1' | |
endif | |
return s:foldr(a:f, a:xs[-1], a:xs[0:-2]) | |
endfunction | |
" similar to python's zip() | |
1 0.000011 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. | |
1 0.000014 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. | |
1 0.000013 function! s:with_index(list, ...) abort | |
let base = a:0 > 0 ? a:1 : 0 | |
return s:zip(a:list, range(base, len(a:list)+base-1)) | |
endfunction | |
" similar to Ruby's detect or Haskell's find. | |
1 0.000013 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. | |
1 0.000014 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. | |
1 0.000016 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. | |
1 0.000015 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. | |
1 0.000018 function! s:has_common_items(list1, list2) abort | |
return !empty(filter(copy(a:list1), 'index(a:list2, v:val) isnot -1')) | |
endfunction | |
1 0.000014 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. | |
1 0.000013 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 | |
1 0.000016 function! s:_default_compare(a, b) abort | |
return a:a <# a:b ? -1 : a:a ># a:b ? 1 : 0 | |
endfunction | |
1 0.000015 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 | |
1 0.000013 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 | |
1 0.000014 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 | |
1 0.000015 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 | |
1 0.000054 let &cpo = s:save_cpo | |
1 0.000013 unlet s:save_cpo | |
" vim:set et ts=2 sts=2 sw=2 tw=0: | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/System/Filepath.vim | |
Sourced 1 time | |
Total time: 0.000879 | |
Self time: 0.000879 | |
count total (s) self (s) | |
" You should check the following related builtin functions. | |
" fnamemodify() | |
" resolve() | |
" simplify() | |
1 0.000027 let s:save_cpo = &cpo | |
1 0.000026 set cpo&vim | |
1 0.000017 let s:path_sep_pattern = (exists('+shellslash') ? '[\\/]' : '/') . '\+' | |
1 0.000035 let s:is_windows = has('win16') || has('win32') || has('win64') || has('win95') | |
1 0.000013 let s:is_cygwin = has('win32unix') | |
1 0.000042 let s:is_mac = !s:is_windows && !s:is_cygwin | |
\ && (has('mac') || has('macunix') || has('gui_macvim') || | |
\ (!isdirectory('/proc') && executable('sw_vers'))) | |
" Get the directory separator. | |
1 0.000010 function! s:separator() abort | |
return fnamemodify('.', ':p')[-1 :] | |
endfunction | |
" Get the path separator. | |
1 0.000010 let s:path_separator = s:is_windows ? ';' : ':' | |
1 0.000007 function! s:path_separator() abort | |
return s:path_separator | |
endfunction | |
" Get the path extensions | |
1 0.000007 function! s:path_extensions() abort | |
if !exists('s:path_extensions') | |
if s:is_windows | |
if exists('$PATHEXT') | |
let pathext = $PATHEXT | |
else | |
" get default PATHEXT | |
let pathext = matchstr(system('set pathext'), '^pathext=\zs.*\ze\n', 'i') | |
endif | |
let s:path_extensions = map(split(pathext, s:path_separator), 'tolower(v:val)') | |
elseif s:is_cygwin | |
" cygwin is not use $PATHEXT | |
let s:path_extensions = ['', '.exe'] | |
else | |
let s:path_extensions = [''] | |
endif | |
endif | |
return s:path_extensions | |
endfunction | |
" Convert all directory separators to "/". | |
1 0.000008 function! s:unify_separator(path) abort | |
return substitute(a:path, s:path_sep_pattern, '/', 'g') | |
endfunction | |
" Get the full path of command. | |
1 0.000009 if exists('*exepath') | |
1 0.000007 function! s:which(str) abort | |
return exepath(a:str) | |
endfunction | |
1 0.000004 else | |
function! s:which(command, ...) abort | |
let pathlist = a:command =~# s:path_sep_pattern ? [''] : | |
\ !a:0 ? split($PATH, s:path_separator) : | |
\ type(a:1) == type([]) ? copy(a:1) : | |
\ split(a:1, s:path_separator) | |
let pathext = s:path_extensions() | |
if index(pathext, '.' . tolower(fnamemodify(a:command, ':e'))) != -1 | |
let pathext = [''] | |
endif | |
let dirsep = s:separator() | |
for dir in pathlist | |
let head = dir ==# '' ? '' : dir . dirsep | |
for ext in pathext | |
let full = fnamemodify(head . a:command . ext, ':p') | |
if filereadable(full) | |
if s:is_case_tolerant() | |
let full = glob(substitute( | |
\ toupper(full), '\u:\@!', '[\0\L\0]', 'g'), 1) | |
endif | |
if full != '' | |
return full | |
endif | |
endif | |
endfor | |
endfor | |
return '' | |
endfunction | |
endif | |
" Split the path with directory separator. | |
" Note that this includes the drive letter of MS Windows. | |
1 0.000007 function! s:split(path) abort | |
return split(a:path, s:path_sep_pattern) | |
endfunction | |
" Join the paths. | |
" join('foo', 'bar') => 'foo/bar' | |
" join('foo/', 'bar') => 'foo/bar' | |
" join('/foo/', ['bar', 'buz/']) => '/foo/bar/buz/' | |
1 0.000006 function! s:join(...) abort | |
let sep = s:separator() | |
let path = '' | |
for part in a:000 | |
let path .= sep . | |
\ (type(part) is type([]) ? call('s:join', part) : | |
\ part) | |
unlet part | |
endfor | |
return substitute(path[1 :], s:path_sep_pattern, sep, 'g') | |
endfunction | |
" Check if the path is absolute path. | |
1 0.000006 if s:is_windows | |
function! s:is_absolute(path) abort | |
return a:path =~? '^[a-z]:[/\\]' | |
endfunction | |
else | |
1 0.000007 function! s:is_absolute(path) abort | |
return a:path[0] ==# '/' | |
endfunction | |
1 0.000003 endif | |
1 0.000007 function! s:is_relative(path) abort | |
return !s:is_absolute(a:path) | |
endfunction | |
" Return the parent directory of the path. | |
" NOTE: fnamemodify(path, ':h') does not return the parent directory | |
" when path[-1] is the separator. | |
1 0.000006 function! s:dirname(path) abort | |
let path = a:path | |
let orig = a:path | |
let path = s:remove_last_separator(path) | |
if path == '' | |
return orig " root directory | |
endif | |
let path = fnamemodify(path, ':h') | |
return path | |
endfunction | |
" Return the basename of the path. | |
" NOTE: fnamemodify(path, ':h') does not return basename | |
" when path[-1] is the separator. | |
1 0.000007 function! s:basename(path) abort | |
let path = a:path | |
let orig = a:path | |
let path = s:remove_last_separator(path) | |
if path == '' | |
return orig " root directory | |
endif | |
let path = fnamemodify(path, ':t') | |
return path | |
endfunction | |
" Remove the separator at the end of a:path. | |
1 0.000008 function! s:remove_last_separator(path) abort | |
let sep = s:separator() | |
let pat = (sep == '\' ? '\\' : '/') . '\+$' | |
return substitute(a:path, pat, '', '') | |
endfunction | |
" Return true if filesystem ignores alphabetic case of a filename. | |
" Return false otherwise. | |
1 0.000036 let s:is_case_tolerant = filereadable(expand('<sfile>:r') . '.VIM') | |
1 0.000008 function! s:is_case_tolerant() abort | |
return s:is_case_tolerant | |
endfunction | |
1 0.000025 let &cpo = s:save_cpo | |
1 0.000006 unlet s:save_cpo | |
" vim:set et ts=2 sts=2 sw=2 tw=0: | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/ArgumentParser.vim | |
Sourced 1 time | |
Total time: 0.001572 | |
Self time: 0.001572 | |
count total (s) self (s) | |
"****************************************************************************** | |
" High functional argument (option) parser | |
" | |
" Author: Alisue <[email protected]> | |
" URL: http://hashnote.net/ | |
" License: MIT license | |
" (C) 2014, Alisue, hashnote.net | |
"****************************************************************************** | |
1 0.000026 let s:save_cpo = &cpo | |
1 0.000026 set cpo&vim | |
1 0.000012 function! s:_vital_loaded(V) dict abort | |
let s:P = a:V.import('Prelude') | |
let s:D = a:V.import('Data.Dict') | |
let s:L = a:V.import('Data.List') | |
let s:C = a:V.import('ArgumentParser.Completer') | |
let s:const = {} | |
let s:const.types = {} | |
let s:const.types.any = 0 | |
let s:const.types.value = 1 | |
let s:const.types.switch = 2 | |
let s:const.types.choice = 3 | |
lockvar s:const | |
call extend(self, s:const) | |
endfunction | |
1 0.000008 function! s:_vital_depends() abort | |
return ['Prelude', 'Data.Dict', 'Data.List', 'ArgumentParser.Completer'] | |
endfunction | |
1 0.000007 function! s:splitargs(str) abort " {{{ | |
let single_quote = '\v''\zs[^'']+\ze''' | |
let double_quote = '\v"\zs[^"]+\ze"' | |
let bare_strings = '\v[^ \t''"]+' | |
let pattern = printf('\v%%(%s|%s|%s)', | |
\ single_quote, | |
\ double_quote, | |
\ bare_strings, | |
\) | |
return split(a:str, printf('\v%s*\zs%%(\s+|$)\ze', pattern)) | |
endfunction " }}} | |
1 0.000008 function! s:strip_quotes(str) abort " {{{ | |
if a:str =~# '\v^%(".*"|''.*'')$' | |
return a:str[1:-2] | |
else | |
return a:str | |
endif | |
endfunction " }}} | |
1 0.000005 function! s:new(...) abort " {{{ | |
let options = extend({ | |
\ 'description': '', | |
\}, get(a:000, 0, {})) | |
let parser = extend(deepcopy(s:parser), s:D.pick(options, [ | |
\ 'description', | |
\ 'enable_positional_assign', | |
\])) | |
return parser | |
endfunction " }}} | |
1 0.000041 let s:parser = { | |
\ 'hooks': {}, | |
\ 'arguments': {}, | |
\ 'positional': [], | |
\ 'required': [], | |
\ 'alias': {}, | |
\ 'validate_required': 1, | |
\ 'validate_types': 1, | |
\ 'validate_conflicts': 1, | |
\ 'validate_superordinates': 1, | |
\ 'validate_dependencies': 1, | |
\ 'validate_pattern': 1, | |
\} | |
1 0.000008 function! s:parser._call_hook(name, opts) abort " {{{ | |
let opts = a:opts | |
if has_key(self.hooks, a:name) | |
let opts = call(self.hooks[a:name], [opts], self) | |
endif | |
return opts | |
endfunction " }}} | |
1 0.000006 function! s:parser.add_argument(name, ...) abort " {{{ | |
" determind name | |
if a:name =~# '^--\?' | |
let positional = 0 | |
let name = substitute(a:name, '^--\?', '', '') | |
else | |
let positional = 1 | |
let name = a:name | |
endif | |
" determind arguments | |
if a:0 == 0 | |
let description = '' | |
let options = {} | |
elseif a:0 == 1 | |
if s:P.is_string(a:1) | |
let description = a:1 | |
let options = {} | |
else | |
let description = '' | |
let options = a:1 | |
endif | |
elseif a:0 == 2 | |
let description = a:1 | |
let options = a:2 | |
else | |
throw 'vital: ArgumentParser: too much arguments are specified' | |
endif | |
let choices = get(options, 'choices', []) | |
" create an argument instance | |
let argument = extend({ | |
\ 'name': name, | |
\ 'terminal': 0, | |
\ 'positional': positional, | |
\ 'required': 0, | |
\ 'default': '', | |
\ 'alias': '', | |
\ 'type': -1, | |
\ 'deniable': 0, | |
\ 'choices': choices, | |
\ 'pattern': '', | |
\ 'conflicts': [], | |
\ 'dependencies': [], | |
\ 'superordinates': [], | |
\}, options) | |
" automatically assign argument type | |
if argument.type == -1 | |
if !empty(argument.choices) | |
let argument.type = s:const.types.choice | |
elseif !empty(argument.pattern) | |
let argument.type = s:const.types.value | |
elseif argument.positional | |
let argument.type = s:const.types.value | |
else | |
let argument.type = s:const.types.switch | |
endif | |
endif | |
" validate options | |
if positional && argument.alias | |
throw 'vital: ArgumentParser: "alias" option cannot be specified to a positional argument' | |
elseif positional && argument.alias | |
throw 'vital: ArgumentParser: "default" option cannot be specified to a positional argument' | |
elseif positional && argument.type != s:const.types.value && argument.type != s:const.types.choice | |
throw 'vital: ArgumentParser: "type" option cannot be ANY or SWITCH for a positional argument' | |
elseif positional && !empty(argument.conflicts) | |
throw 'vital: ArgumentParser: "conflicts" option cannot be specified to a positional argument' | |
elseif positional && !empty(argument.dependencies) | |
throw 'vital: ArgumentParser: "dependencies" option cannot be specified to a positional argument' | |
elseif positional && !empty(argument.superordinates) | |
throw 'vital: ArgumentParser: "superordinates" option cannot be specified to a positional argument' | |
elseif !empty(argument.default) && argument.required | |
throw 'vital: ArgumentParser: "default" and "required" option cannot be specified together' | |
elseif empty(argument.choices) && argument.type == s:const.types.choice | |
throw 'vital: ArgumentParser: "type" is specified to "choice" but no "choices" is specified' | |
elseif !empty(argument.pattern) && argument.type == s:const.types.switch | |
throw 'vital: ArgumentParser: "pattern" option cannot be specified for SWITCH argument' | |
endif | |
" register argument | |
let self.arguments[name] = argument | |
" register positional | |
if positional | |
call add(self.positional, argument.name) | |
endif | |
" register required | |
if argument.required | |
call add(self.required, argument.name) | |
endif | |
" register alias | |
if !empty(argument.alias) | |
let self.alias[argument.alias] = argument.name | |
endif | |
" register completer | |
if !has_key(argument, 'completer') | |
if !empty(argument.choices) | |
let argument.completer = s:C.new('choice', { 'choices': argument.choices }) | |
else | |
let argument.completer = s:C.new('file') | |
endif | |
endif | |
" return an argument instance for further manipulation | |
return argument | |
endfunction " }}} | |
1 0.000007 function! s:parser.get_conflicted_arguments(name, opts) abort " {{{ | |
let conflicts = self.arguments[a:name].conflicts | |
if empty(conflicts) | |
return [] | |
endif | |
let conflicts_pattern = printf('\v^%%(%s)$', join(conflicts, '|')) | |
return filter(keys(a:opts), 'v:val =~# conflicts_pattern') | |
endfunction " }}} | |
1 0.000007 function! s:parser.get_superordinate_arguments(name, opts) abort " {{{ | |
let superordinates = self.arguments[a:name].superordinates | |
if empty(superordinates) | |
return [] | |
endif | |
let superordinates_pattern = printf('\v^%%(%s)$', join(superordinates, '|')) | |
return filter(keys(a:opts), 'v:val =~# superordinates_pattern') | |
endfunction " }}} | |
1 0.000007 function! s:parser.get_missing_dependencies(name, opts) abort " {{{ | |
let dependencies = self.arguments[a:name].dependencies | |
if empty(dependencies) | |
return [] | |
endif | |
let exists_pattern = printf('\v^%%(%s)$', join(keys(a:opts), '|')) | |
return filter(dependencies, 'v:val !~# exists_pattern') | |
endfunction " }}} | |
1 0.000006 function! s:parser.get_positional_arguments() abort " {{{ | |
return deepcopy(self.positional) | |
endfunction " }}} | |
1 0.000006 function! s:parser.get_optional_arguments() abort " {{{ | |
return map(filter(values(self.arguments), '!v:val.positional'), 'v:val.name') | |
endfunction " }}} | |
1 0.000006 function! s:parser.get_optional_argument_aliases() abort " {{{ | |
return keys(self.alias) | |
endfunction " }}} | |
1 0.000006 function! s:parser.parse(bang, range, ...) abort " {{{ | |
let cmdline = get(a:000, 0, '') | |
let opts = self.parse_cmdline(cmdline, extend({ | |
\ '__bang__': a:bang == '!', | |
\ '__range__': a:range, | |
\}, get(a:000, 1, {}))) | |
" assign default values | |
let exists_pattern = printf('\v^%%(%s)$', join(keys(opts), '|')) | |
for argument in values(self.arguments) | |
if !empty(argument.default) && argument.name !~# exists_pattern | |
let opts[argument.name] = argument.default | |
endif | |
endfor | |
" validation | |
let opts = self._call_hook('pre_validation', opts) | |
if self.validate_required | |
call self._validate_required(opts) | |
endif | |
if self.validate_types | |
call self._validate_types(opts) | |
endif | |
if self.validate_conflicts | |
call self._validate_conflicts(opts) | |
endif | |
if self.validate_superordinates | |
call self._validate_superordinates(opts) | |
endif | |
if self.validate_dependencies | |
call self._validate_dependencies(opts) | |
endif | |
if self.validate_pattern | |
call self._validate_pattern(opts) | |
endif | |
let opts = self._call_hook('post_validation', opts) | |
return opts | |
endfunction " }}} | |
1 0.000007 function! s:parser.parse_cmdline(cmdline, ...) abort " {{{ | |
let args = s:splitargs(a:cmdline) | |
return call(self.parse_args, [args] + a:000, self) | |
endfunction " }}} | |
1 0.000010 function! s:parser.parse_args(args, ...) abort " {{{ | |
let opts = extend({ | |
\ '__unknown__': [], | |
\ '__args__': [], | |
\}, get(a:000, 0, {})) | |
let opts.__args__ = extend(opts.__args__, a:args) | |
let length = len(opts.__args__) | |
let cursor = 0 | |
let arguments_pattern = printf('\v^%%(%s)$', join(keys(self.arguments), '|')) | |
let positional_length = len(self.positional) | |
let positional_cursor = 0 | |
while cursor < length | |
let cword = opts.__args__[cursor] | |
let nword = (cursor+1 < length) ? opts.__args__[cursor+1] : '' | |
if cword =~# '^--\?' | |
" optional argument | |
let m = matchlist(cword, '\v^\-\-?([^=]+|)%(\=(.*)|)') | |
let name = get(self.alias, m[1], m[1]) | |
if name =~# arguments_pattern | |
if !empty(m[2]) | |
let value = s:strip_quotes(m[2]) | |
elseif get(self, 'enable_positional_assign', 0) && !empty(nword) && nword !~# '^--\?' | |
let value = s:strip_quotes(nword) | |
let cursor += 1 | |
else | |
let value = 1 | |
endif | |
elseif substitute(name, '^no-', '', '') =~# arguments_pattern | |
let name = substitute(name, '^no-', '', '') | |
if self.arguments[name].deniable | |
let value = 0 | |
else | |
call add(opts.__unknown__, cword) | |
silent! unlet name | |
silent! unlet value | |
endif | |
else | |
call add(opts.__unknown__, cword) | |
silent! unlet name | |
silent! unlet value | |
endif | |
else | |
if positional_cursor < positional_length | |
let name = self.positional[positional_cursor] | |
let value = s:strip_quotes(cword) | |
let positional_cursor += 1 | |
else | |
call add(opts.__unknown__, cword) | |
silent! unlet name | |
silent! unlet value | |
endif | |
endif | |
if exists('name') && exists('value') | |
let opts[name] = value | |
" terminal check | |
if self.arguments[name].terminal | |
let cursor += 1 | |
break | |
endif | |
endif | |
silent! unlet name | |
silent! unlet value | |
let cursor += 1 | |
endwhile | |
" assign remaining args as unknown | |
let opts.__unknown__ = extend( | |
\ opts.__unknown__, | |
\ opts.__args__[ cursor : ], | |
\) | |
return opts | |
endfunction " }}} | |
1 0.000007 function! s:parser._validate_required(opts) abort " {{{ | |
let exists_pattern = printf('\v^%%(%s)$', join(keys(a:opts), '|')) | |
for name in self.required | |
if name !~# exists_pattern | |
throw printf( | |
\ 'vital: ArgumentParser: "%s" argument is required but not specified.', | |
\ name, | |
\) | |
endif | |
endfor | |
endfunction " }}} | |
1 0.000006 function! s:parser._validate_types(opts) abort " {{{ | |
for [name, value] in items(a:opts) | |
if name !~# '\v^__.*__$' | |
let type = self.arguments[name].type | |
if type == s:const.types.value && s:P.is_number(value) | |
throw printf( | |
\ 'vital: ArgumentParser: "%s" argument is VALUE argument but no value is specified.', | |
\ name, | |
\) | |
elseif type == s:const.types.switch && s:P.is_string(value) | |
throw printf( | |
\ 'vital: ArgumentParser: "%s" argument is SWITCH argument but "%s" is specified.', | |
\ name, | |
\ value, | |
\) | |
elseif type == s:const.types.choice | |
let pattern = printf('\v^%%(%s)$', join(self.arguments[name].choices, '|')) | |
if s:P.is_number(value) | |
throw printf( | |
\ 'vital: ArgumentParser: "%s" argument is CHOICE argument but no value is specified.', | |
\ name, | |
\) | |
elseif value !~# pattern | |
throw printf( | |
\ 'vital: ArgumentParser: "%s" argument is CHOICE argument but an invalid value "%s" is specified.', | |
\ name, | |
\ value, | |
\) | |
endif | |
endif | |
endif | |
silent! unlet name | |
silent! unlet value | |
endfor | |
endfunction " }}} | |
1 0.000007 function! s:parser._validate_conflicts(opts) abort " {{{ | |
for [name, value] in items(a:opts) | |
if name !~# '\v^__.*__$' | |
let conflicts = self.get_conflicted_arguments(name, a:opts) | |
if !empty(conflicts) | |
throw printf( | |
\ 'vital: ArgumentParser: "%s" argument conflicts with "%s"', | |
\ name, | |
\ conflicts[0], | |
\) | |
endif | |
endif | |
silent! unlet name | |
silent! unlet value | |
endfor | |
endfunction " }}} | |
1 0.000007 function! s:parser._validate_superordinates(opts) abort " {{{ | |
for [name, value] in items(a:opts) | |
if name !~# '\v^__.*__$' | |
let superordinates = self.get_superordinate_arguments(name, a:opts) | |
if !empty(self.arguments[name].superordinates) && empty(superordinates) | |
throw printf( | |
\ 'vital: ArgumentParser: No superordinate argument of "%s" is specified', | |
\ name, | |
\) | |
endif | |
endif | |
silent! unlet name | |
silent! unlet value | |
endfor | |
endfunction " }}} | |
1 0.000006 function! s:parser._validate_dependencies(opts) abort " {{{ | |
for [name, value] in items(a:opts) | |
if name !~# '\v^__.*__$' | |
let dependencies = self.get_missing_dependencies(name, a:opts) | |
if !empty(dependencies) | |
throw printf( | |
\ 'vital: ArgumentParser: "%s" argument is required for "%s" but missing', | |
\ dependencies[0], | |
\ name, | |
\) | |
endif | |
endif | |
silent! unlet name | |
silent! unlet value | |
endfor | |
endfunction " }}} | |
1 0.000006 function! s:parser._validate_pattern(opts) abort " {{{ | |
for [name, value] in items(a:opts) | |
if name !~# '\v^__.*__$' | |
let pattern = self.arguments[name].pattern | |
if !empty(pattern) && value !~# pattern | |
throw printf( | |
\ 'vital: ArgumentParser: A value of "%s" argument does not a specified pattern "%s".', | |
\ name, | |
\ pattern, | |
\) | |
endif | |
endif | |
silent! unlet name | |
silent! unlet value | |
endfor | |
endfunction " }}} | |
1 0.000007 function! s:parser.complete(arglead, cmdline, cursorpos, opts) abort " {{{ | |
if a:arglead =~# '\v^\-\-?[^=]+\=' | |
return self._complete_optional_argument_value( | |
\ a:arglead, | |
\ a:cmdline, | |
\ a:cursorpos, | |
\ a:opts, | |
\) | |
elseif a:arglead =~# '\v^\-\-?' | |
return self._complete_optional_argument( | |
\ a:arglead, | |
\ a:cmdline, | |
\ a:cursorpos, | |
\ a:opts, | |
\) | |
else | |
return self._complete_positional_argument_value( | |
\ a:arglead, | |
\ a:cmdline, | |
\ a:cursorpos, | |
\ a:opts, | |
\) | |
endif | |
endfunction " }}} | |
1 0.000009 function! s:parser._complete_optional_argument_value(arglead, cmdline, cursorpos, opts) abort " {{{ | |
let m = matchlist(a:arglead, '\v^\-\-?([^=]+)\=(.*)') | |
let name = m[1] | |
let value = m[2] | |
if has_key(self.arguments, name) | |
let candidates = self.arguments[name].completer.complete( | |
\ value, | |
\ a:cmdline, | |
\ a:cursorpos, | |
\ a:opts, | |
\) | |
else | |
let candidates = [] | |
endif | |
return candidates | |
endfunction " }}} | |
1 0.000007 function! s:parser._complete_optional_argument(arglead, cmdline, cursorpos, opts) abort " {{{ | |
let candidates = [] | |
for argument in values(self.arguments) | |
if has_key(a:opts, argument.name) || argument.positional | |
continue | |
elseif !empty(argument.conflicts) && !empty(self.get_conflicted_arguments(argument.name, a:opts)) | |
continue | |
elseif !empty(argument.superordinates) && empty(self.get_superordinate_arguments(argument.name, a:opts)) | |
continue | |
endif | |
if '--' . argument.name =~# '^' . a:arglead | |
call add(candidates, '--' . argument.name) | |
endif | |
if !empty(argument.alias) && '-' . argument.alias =~# '^' . a:arglead | |
call add(candidates, '-' . argument.alias) | |
endif | |
endfor | |
return candidates | |
endfunction " }}} | |
1 0.000009 function! s:parser._complete_positional_argument_value(arglead, cmdline, cursorpos, opts) abort " {{{ | |
let candidates = [] | |
let npositional = 0 | |
for argument in values(self.arguments) | |
if argument.positional && has_key(a:opts, argument.name) | |
let npositional += 1 | |
endif | |
endfor | |
if len(a:arglead) > 0 | |
let npositional -= 1 | |
endif | |
let cpositional = get(self.arguments, get(self.positional, npositional, -1), {}) | |
if !empty(cpositional) | |
let candidates = cpositional.completer.complete( | |
\ a:arglead, | |
\ a:cmdline, | |
\ a:cursorpos, | |
\ a:opts, | |
\) | |
endif | |
return candidates | |
endfunction " }}} | |
1 0.000025 let &cpo = s:save_cpo | |
1 0.000007 unlet s:save_cpo | |
"vim: sts=2 sw=2 smarttab et ai textwidth=0 fdm=marker | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/Data/Dict.vim | |
Sourced 1 time | |
Total time: 0.000450 | |
Self time: 0.000450 | |
count total (s) self (s) | |
" Utilities for dictionary. | |
1 0.000027 let s:save_cpo = &cpo | |
1 0.000026 set cpo&vim | |
" Makes a dict from keys and values | |
1 0.000011 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 | |
1 0.000007 function! s:swap(dict) abort | |
return s:make(values(a:dict), keys(a:dict)) | |
endfunction | |
" Makes a index dict from a list | |
1 0.000007 function! s:make_index(list, ...) abort | |
let value = a:0 ? a:1 : 1 | |
return s:make(a:list, [], value) | |
endfunction | |
1 0.000006 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 | |
1 0.000006 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 | |
1 0.000006 function! s:clear(dict) abort | |
for key in keys(a:dict) | |
call remove(a:dict, key) | |
endfor | |
return a:dict | |
endfunction | |
1 0.000007 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 | |
1 0.000007 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 | |
1 0.000007 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 | |
1 0.000007 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 | |
1 0.000007 function! s:foldl(f, init, dict) abort | |
return s:_foldl(a:f, a:init, items(a:dict)) | |
endfunction | |
1 0.000007 function! s:foldr(f, init, dict) abort | |
return s:_foldl(a:f, a:init, reverse(items(a:dict))) | |
endfunction | |
1 0.000022 let &cpo = s:save_cpo | |
1 0.000006 unlet s:save_cpo | |
" vim:set et ts=2 sts=2 sw=2 tw=0: | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/ArgumentParser/Completer.vim | |
Sourced 1 time | |
Total time: 0.000515 | |
Self time: 0.000481 | |
count total (s) self (s) | |
"****************************************************************************** | |
" Argument completer of ArgumentParser | |
" | |
" Author: Alisue <[email protected]> | |
" URL: http://hashnote.net/ | |
" License: MIT license | |
" (C) 2014, Alisue, hashnote.net | |
"****************************************************************************** | |
1 0.000030 let s:save_cpo = &cpo | |
1 0.000025 set cpo&vim | |
1 0.000012 function! s:_vital_loaded(V) dict abort | |
let s:P = a:V.import('System.Filepath') | |
call extend(self, s:const) | |
endfunction | |
1 0.000007 function! s:_vital_depends() abort | |
return ['System.Filepath'] | |
endfunction | |
1 0.000008 let s:_completers = {} | |
1 0.000006 function! s:new(name, ...) abort " {{{ | |
if !has_key(s:_completers, a:name) | |
throw printf( | |
\ 'vital: ArgumentParser.Completer: "%s" is not defined', | |
\ a:name, | |
\) | |
endif | |
let instance = call(s:_completers[a:name], a:000) | |
let instance.__name__ = a:name | |
return instance | |
endfunction " }}} | |
1 0.000008 function! s:register(name, callback) abort " {{{ | |
let s:_completers[a:name] = a:callback | |
endfunction " }}} | |
1 0.000007 function! s:unregister(name) abort " {{{ | |
unlet! s:_completers[a:name] | |
endfunction " }}} | |
1 0.000007 function! s:get_completers() abort " {{{ | |
return deepcopy(s:_completers) | |
endfunction " }}} | |
1 0.000008 function! s:get_abstract_completer() abort " {{{ | |
let completer = { | |
\ 'candidates': [], | |
\} | |
function! completer.complete(arglead, cmdline, cursorpos, args) abort | |
let candidates = self.gather_candidates( | |
\ a:arglead, | |
\ a:cmdline, | |
\ a:cursorpos, | |
\ a:args, | |
\) | |
let candidates = filter( | |
\ deepcopy(candidates), | |
\ printf('v:val =~# "^%s"', a:arglead), | |
\) | |
return candidates | |
endfunction | |
function! completer.gather_candidates(arglead, cmdline, cursorpos, args) abort | |
return self.candidates | |
endfunction | |
return completer | |
endfunction " }}} | |
1 0.000008 function! s:_new_file_completer(...) abort " {{{ | |
let options = extend({ | |
\ 'base_dir': '.', | |
\}, get(a:000, 0, {})) | |
let completer = s:get_abstract_completer() | |
function! completer.gather_candidates(arglead, cmdline, cursorpos, args) abort | |
" Ref: Vital.vim OptionParser.vim | |
let candidates = split( | |
\ glob(s:P.join(self.base_dir, a:arglead . '*'), 0), | |
\ "\n" | |
\) | |
" substitute 'base_dir' | |
call map(candidates, printf("substitute(v:val, '^%s/', '', '')", self.base_dir)) | |
" substitute /home/<username> to ~/ if ~/ is specified | |
if a:arglead =~# '^\~' | |
let home_dir = expand('~') | |
call map(candidates, printf("substitute(v:val, '^%s', '~', '')", home_dir)) | |
endif | |
call map(candidates, "escape(isdirectory(v:val) ? v:val.'/' : v:val, ' \\')") | |
return candidates | |
endfunction | |
return extend(completer, options) | |
endfunction " }}} | |
1 0.000008 function! s:_new_choice_completer(...) abort " {{{ | |
let options = extend({ | |
\ 'choices': [], | |
\}, get(a:000, 0, {})) | |
let completer = s:get_abstract_completer() | |
function! completer.gather_candidates(arglead, cmdline, cursorpos, args) abort | |
return self.choices | |
endfunction | |
return extend(completer, options) | |
endfunction " }}} | |
1 0.000044 0.000026 call s:register('file', function('s:_new_file_completer')) | |
1 0.000038 0.000022 call s:register('choice', function('s:_new_choice_completer')) | |
1 0.000023 let &cpo = s:save_cpo | |
1 0.000006 unlet s:save_cpo | |
"vim: sts=2 sw=2 smarttab et ai textwidth=0 fdm=marker | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/gita/argument/status.vim | |
Sourced 1 time | |
Total time: 0.000341 | |
Self time: 0.000225 | |
count total (s) self (s) | |
let s:save_cpo = &cpo | |
1 0.000033 set cpo&vim | |
1 0.000084 0.000020 let s:Path = gita#util#import('System.Filepath') | |
1 0.000072 0.000020 let s:ArgumentParser = gita#util#import('ArgumentParser') | |
1 0.000013 function! gita#argument#status#get_parser() abort " {{{ | |
if !exists('s:parser') | |
let s:parser = s:ArgumentParser.new({ | |
\ 'name': 'Show the working tree status in Gita interface', | |
\}) | |
let types = s:ArgumentParser.types | |
call s:parser.add_argument( | |
\ '--untracked-files', | |
\ 'show untracked files, optional modes: all, normal, no. (Default: all)', { | |
\ 'alias': 'u', | |
\ 'choices': ['all', 'normal', 'no'], | |
\ 'default': 'all', | |
\ }) | |
call s:parser.add_argument( | |
\ '--ignored', | |
\ 'show ignored files', { | |
\ }) | |
call s:parser.add_argument( | |
\ '--ignore-submodules', | |
\ 'ignore changes to submodules, optional when: all, dirty, untracked (Default: all)', { | |
\ 'choices': ['all', 'dirty', 'untracked'], | |
\ 'default': 'all', | |
\ }) | |
endif | |
return s:parser | |
endfunction " }}} | |
1 0.000028 let &cpo = s:save_cpo | |
1 0.000005 unlet s:save_cpo | |
"vim: sts=2 sw=2 smarttab et ai textwidth=0 fdm=marker | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/gita.vim | |
Sourced 1 time | |
Total time: 0.501068 | |
Self time: 0.000621 | |
count total (s) self (s) | |
"****************************************************************************** | |
" Another Git manipulation plugin | |
" | |
" Author: Alisue <[email protected]> | |
" URL: http://hashnote.net/ | |
" License: MIT license | |
" | |
" (C) 2015, Alisue, hashnote.net | |
"****************************************************************************** | |
1 0.000027 let s:save_cpo = &cpo | |
1 0.000026 set cpo&vim | |
1 0.005967 0.000021 let s:Dict = gita#util#import('Data.Dict') | |
1 0.486992 0.000023 let s:Git = gita#util#import('VCS.Git') | |
1 0.007564 0.000032 let s:GitC = gita#util#import('VCS.Git.Core') | |
1 0.000010 function! s:GitaStatus(opts) abort " {{{ | |
call gita#interface#status#open(a:opts) | |
endfunction " }}} | |
1 0.000007 function! s:GitaCommit(opts) abort " {{{ | |
call gita#interface#commit#open(a:opts) | |
endfunction " }}} | |
1 0.000007 function! s:GitaDiff(opts) abort " {{{ | |
let commit = empty(get(a:opts, '__unknown__', [])) ? '' : join(a:opts.__unknown__) | |
if empty(commit) | |
let commit = gita#util#ask('Diff to: ', 'INDEX') | |
if strlen(commit) == 0 | |
redraw || call gita#util#warn('No valid commit was selected. The operation is canceled.') | |
return | |
endif | |
endif | |
let commit = commit ==# 'INDEX' ? '' : commit | |
if get(a:opts, 'compare', 1) | |
call gita#interface#diff#compare(expand('%'), commit, a:opts) | |
else | |
call gita#interface#diff#open(expand('%'), commit, a:opts) | |
endif | |
endfunction " }}} | |
1 0.000006 function! s:GitaBrowse(opts) abort " {{{ | |
if get(a:opts, 'open', 0) | |
for filename in a:opts.filenames | |
call gita#interface#browse#open(filename, a:opts) | |
endfor | |
elseif get(a:opts, 'echo', 0) | |
for filename in a:opts.filenames | |
echo gita#interface#browse#url(filename, a:opts) | |
endfor | |
elseif get(a:opts, 'yank', 0) | |
let contents = [] | |
for filename in a:opts.filenames | |
call add(contents, gita#interface#browse#url(filename, a:opts)) | |
endfor | |
call gita#util#yank(join(contents, "\n")) | |
call gita#util#info( | |
\ len(contents) > 1 | |
\ ? printf('%d urls are yanked', len(contents)) | |
\ : 'A url is yanked', | |
\) | |
endif | |
endfunction " }}} | |
1 0.000007 function! s:GitaDefault(opts) abort " {{{ | |
let git = s:Git.find(expand('%')) | |
let result = git.exec(a:opts.__args__) | |
if result.status == 0 | |
call gita#util#info( | |
\ result.stdout, | |
\ printf('Ok: "%s"', join(result.args)) | |
\) | |
call gita#util#doautocmd(a:opts.__name__ . '-post') | |
else | |
call gita#util#info( | |
\ result.stdout, | |
\ printf('No: "%s"', join(result.args)) | |
\) | |
endif | |
endfunction " }}} | |
1 0.000012 function! gita#Gita(opts) abort " {{{ | |
if empty(a:opts) | |
" validation failed | |
return | |
elseif !gita#get().enabled | |
call gita#util#warn( | |
\ 'No git working directory is found on a current buffer', | |
\) | |
return | |
endif | |
let name = get(a:opts, '__name__', '') | |
if !a:opts.__bang__ | |
if name ==# 'status' | |
return s:GitaStatus(a:opts) | |
elseif name ==# 'commit' | |
return s:GitaCommit(a:opts) | |
elseif name ==# 'diff' | |
return s:GitaDiff(a:opts) | |
elseif name ==# 'browse' | |
return s:GitaBrowse(a:opts) | |
endif | |
endif | |
return s:GitaDefault(a:opts) | |
endfunction " }}} | |
1 0.000008 function! gita#get(...) abort " {{{ | |
let bufname = get(a:000, 0, bufname('%')) | |
if bufexists(bufname) | |
let bufnum = bufnr(bufname) | |
let buftype = getbufvar(bufnum, '&buftype') | |
let gita = getbufvar(bufnum, '_gita', deepcopy(s:gita)) | |
if empty(get(gita, 'bufname', '')) || (empty(buftype) && bufname !=# gita.bufname) | |
if empty(buftype) | |
let git = s:Git.find(fnamemodify(bufname, ':p')) | |
let gita = extend(gita, { | |
\ 'enabled': !empty(git), | |
\ 'bufname': bufname, | |
\ 'git': git, | |
\}) | |
else | |
" Not a file, use a current directory | |
let git = s:Git.find(getcwd()) | |
let gita = extend(gita, { | |
\ 'enabled': !empty(git), | |
\ 'bufname': '', | |
\ 'git': git, | |
\}) | |
endif | |
call gita#set(gita, bufname) | |
endif | |
else | |
let git = s:Git.find(fnamemodify(bufname, ':p')) | |
let gita = extend(deepcopy(s:gita), { | |
\ 'enabled': !empty(git), | |
\ 'bufname': bufname, | |
\ 'git': git, | |
\}) | |
endif | |
return gita | |
endfunction " }}} | |
1 0.000009 function! gita#set(gita, ...) abort " {{{ | |
let bufname = get(a:000, 0, bufname('%')) | |
if bufexists(bufname) | |
let bufnum = bufnr(bufname) | |
call setbufvar(bufnum, '_gita', a:gita) | |
endif | |
endfunction " }}} | |
1 0.000007 let s:gita = {} | |
1 0.000034 let &cpo = s:save_cpo | |
1 0.000006 unlet s:save_cpo | |
"vim: sts=2 sw=2 smarttab et ai textwidth=0 fdm=marker | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/VCS/Git.vim | |
Sourced 1 time | |
Total time: 0.003100 | |
Self time: 0.003100 | |
count total (s) self (s) | |
"****************************************************************************** | |
" A fundemental git manipulation library | |
" | |
" Author: Alisue <[email protected]> | |
" URL: http://hashnote.net/ | |
" License: MIT license | |
" | |
" (C) 2014, Alisue, hashnote.net | |
"****************************************************************************** | |
1 0.000027 let s:save_cpo = &cpo | |
1 0.000025 set cpo&vim | |
" Vital ====================================================================== | |
1 0.000012 function! s:_vital_loaded(V) dict abort " {{{ | |
let s:Dict = a:V.import('Data.Dict') | |
let s:List = a:V.import('Data.List') | |
let s:Prelude = a:V.import('Prelude') | |
let s:Path = a:V.import('System.Filepath') | |
let s:Cache = a:V.import('System.Cache.Simple') | |
let s:Core = a:V.import('VCS.Git.Core') | |
let s:Misc = a:V.import('VCS.Git.Misc') | |
let s:Finder = a:V.import('VCS.Git.Finder') | |
let s:SEPARATOR = s:Path.separator() | |
endfunction " }}} | |
1 0.000007 function! s:_vital_depends() abort " {{{ | |
return [ | |
\ 'System.Cache.Simple', | |
\ 'VCS.Git.Core', | |
\ 'VCS.Git.Misc', | |
\ 'VCS.Git.Finder', | |
\] | |
endfunction " }}} | |
1 0.000008 function! s:_listalize(val) abort " {{{ | |
return s:Prelude.is_list(a:val) ? a:val : [a:val] | |
endfunction " }}} | |
1 0.000006 function! s:_get_finder() abort " {{{ | |
if !exists('s:finder') | |
let s:finder = s:Finder.new(s:_get_finder_cache()) | |
endif | |
return s:finder | |
endfunction " }}} | |
1 0.000007 function! s:_get_finder_cache() abort " {{{ | |
if !exists('s:finder_cache') | |
let config = s:get_config() | |
let s:finder_cache = call( | |
\ config.cache.finder.new, | |
\ config.cache.finder_args, | |
\ config.cache.finder, | |
\) | |
endif | |
return s:finder_cache | |
endfunction " }}} | |
1 0.000008 function! s:_get_instance_cache() abort " {{{ | |
if !exists('s:instance_cache') | |
let config = s:get_config() | |
let s:instance_cache = call( | |
\ config.cache.instance.new, | |
\ config.cache.instance_args, | |
\ config.cache.instance, | |
\) | |
endif | |
return s:instance_cache | |
endfunction " }}} | |
1 0.000008 let s:config = {} | |
1 0.000007 function! s:get_config() abort " {{{ | |
let default = { | |
\ 'cache': { | |
\ 'finder': s:Cache, | |
\ 'instance': s:Cache, | |
\ 'repository': s:Cache, | |
\ 'uptime': s:Cache, | |
\ 'finder_args': [], | |
\ 'instance_args': [], | |
\ 'repository_args': [], | |
\ 'uptime_args': [], | |
\ }, | |
\} | |
return extend(default, deepcopy(s:config)) | |
endfunction " }}} | |
1 0.000007 function! s:set_config(config) abort " {{{ | |
let s:config = extend(s:config, a:config) | |
" clear settings | |
unlet! s:finder_cache | |
unlet! s:finder | |
unlet! s:instance_cache | |
" apply settings | |
call s:Core.set_config(s:config) | |
endfunction " }}} | |
1 0.000007 function! s:new(worktree, repository, ...) abort " {{{ | |
let opts = extend({ 'no_cache': 0 }, get(a:000, 0, {})) | |
let cache = s:_get_instance_cache() | |
let git = cache.get(a:worktree, {}) | |
if !empty(git) && !opts.no_cache | |
return git | |
endif | |
let config = s:get_config() | |
let git = extend(deepcopy(s:git), { | |
\ 'worktree': a:worktree, | |
\ 'repository': a:repository, | |
\ 'cache': { | |
\ 'repository': call( | |
\ config.cache.repository.new, | |
\ config.cache.repository_args, | |
\ config.cache.repository | |
\ ), | |
\ 'uptime': call( | |
\ config.cache.uptime.new, | |
\ config.cache.uptime_args, | |
\ config.cache.uptime | |
\ ), | |
\ } | |
\}) | |
call cache.set(a:worktree, git) | |
return git | |
endfunction " }}} | |
1 0.000007 function! s:find(path, ...) abort " {{{ | |
let options = get(a:000, 0, {}) | |
let finder = s:_get_finder() | |
let found = finder.find(a:path, options) | |
if empty(found) | |
return {} | |
endif | |
return s:new(found.worktree, found.repository, options) | |
endfunction " }}} | |
" Object ===================================================================== | |
1 0.000006 let s:git = {} | |
1 0.000008 function! s:git.is_updated(pathspec, ...) abort " {{{ | |
let pathspec = s:_listalize(a:pathspec) | |
let path = s:Path.join(pathspec) | |
let name = printf('%s%s%s', path, s:SEPARATOR, get(a:000, 0, '')) | |
let cached = self.cache.uptime.get(name, -1) | |
let actual = getftime(s:Path.join(self.repository, path)) | |
call self.cache.uptime.set(name, actual) | |
return actual == -1 || actual > cached | |
endfunction " }}} | |
1 0.000006 function! s:git._get_call_opts(...) abort " {{{ | |
return extend({ | |
\ 'cwd': self.worktree, | |
\}, get(a:000, 0, {})) | |
endfunction " }}} | |
" VCS.Git.Core | |
1 0.000006 function! s:git.get_relative_path(path) abort " {{{ | |
return s:Core.get_relative_path(self.worktree, a:path) | |
endfunction " }}} | |
1 0.000006 function! s:git.get_absolute_path(path) abort " {{{ | |
return s:Core.get_absolute_path(self.worktree, a:path) | |
endfunction " }}} | |
1 0.000005 function! s:git.get_head(...) abort " {{{ | |
let options = extend({ | |
\ 'no_cache': 0, | |
\}, get(a:000, 0, {})) | |
let name = 'HEAD' | |
let cache = self.cache.repository | |
if self.is_updated(name) || options.no_cache || !cache.has(name) | |
let result = s:Core.get_head(self.repository) | |
call cache.set(name, result) | |
endif | |
return cache.get(name) | |
endfunction " }}} | |
1 0.000005 function! s:git.get_fetch_head(...) abort " {{{ | |
let options = extend({ | |
\ 'no_cache': 0, | |
\}, get(a:000, 0, {})) | |
let name = 'FETCH_HEAD' | |
let cache = self.cache.repository | |
if self.is_updated(name) || options.no_cache || !cache.has(name) | |
let result = s:Core.get_fetch_head(self.repository) | |
call cache.set(name, result) | |
endif | |
return cache.get(name) | |
endfunction " }}} | |
1 0.000005 function! s:git.get_orig_head(...) abort " {{{ | |
let options = extend({ | |
\ 'no_cache': 0, | |
\}, get(a:000, 0, {})) | |
let name = 'ORIG_HEAD' | |
let cache = self.cache.repository | |
if self.is_updated(name) || options.no_cache || !cache.has(name) | |
let result = s:Core.get_orig_head(self.repository) | |
call cache.set(name, result) | |
endif | |
return cache.get(name) | |
endfunction " }}} | |
1 0.000005 function! s:git.get_merge_head(...) abort " {{{ | |
let options = extend({ | |
\ 'no_cache': 0, | |
\}, get(a:000, 0, {})) | |
let name = 'MERGE_HEAD' | |
let cache = self.cache.repository | |
if self.is_updated(name) || options.no_cache || !cache.has(name) | |
let result = s:Core.get_merge_head(self.repository) | |
call cache.set(name, result) | |
endif | |
return cache.get(name) | |
endfunction " }}} | |
1 0.000006 function! s:git.get_commit_editmsg(...) abort " {{{ | |
let options = extend({ | |
\ 'no_cache': 0, | |
\}, get(a:000, 0, {})) | |
let name = 'COMMIT_EDITMSG' | |
let cache = self.cache.repository | |
if self.is_updated(name) || options.no_cache || !cache.has(name) | |
let result = s:Core.get_commit_editmsg(self.repository) | |
call cache.set(name, result) | |
endif | |
return cache.get(name) | |
endfunction " }}} | |
1 0.000005 function! s:git.get_merge_msg(...) abort " {{{ | |
let options = extend({ | |
\ 'no_cache': 0, | |
\}, get(a:000, 0, {})) | |
let name = 'MERGE_MSG' | |
let cache = self.cache.repository | |
if self.is_updated(name) || options.no_cache || !cache.has(name) | |
let result = s:Core.get_merge_msg(self.repository) | |
call cache.set(name, result) | |
endif | |
return cache.get(name) | |
endfunction " }}} | |
1 0.000006 function! s:git.get_local_hash(branch, ...) abort " {{{ | |
let options = extend({ | |
\ 'no_cache': 0, | |
\}, get(a:000, 0, {})) | |
let name = s:Path.join('refs', 'heads', a:branch) | |
let cache = self.cache.repository | |
if self.is_updated(name) || options.no_cache || !cache.has(name) | |
let result = s:Core.get_local_hash(self.repository, a:branch) | |
call cache.set(name, result) | |
endif | |
return cache.get(name) | |
endfunction " }}} | |
1 0.000007 function! s:git.get_remote_hash(remote, branch, ...) abort " {{{ | |
let options = extend({ | |
\ 'no_cache': 0, | |
\}, get(a:000, 0, {})) | |
let name = s:Path.join('refs', 'remotes', a:remote, a:branch) | |
let cache = self.cache.repository | |
if self.is_updated(name) || options.no_cache || !cache.has(name) | |
let result = s:Core.get_remote_hash(self.repository, a:remote, a:branch) | |
call cache.set(name, result) | |
endif | |
return cache.get(name) | |
endfunction " }}} | |
1 0.000006 function! s:git.get_repository_config(...) abort " {{{ | |
let options = extend({ | |
\ 'no_cache': 0, | |
\}, get(a:000, 0, {})) | |
let name = 'config' | |
let cache = self.cache.repository | |
if self.is_updated(name) || options.no_cache || !cache.has(name) | |
let result = s:Core.get_repository_config(self.repository) | |
call cache.set(name, result) | |
endif | |
return cache.get(name) | |
endfunction " }}} | |
1 0.000007 function! s:git.get_branch_remote(branch, ...) abort " {{{ | |
let config = call(self.get_repository_config, a:000, self) | |
return s:Core.get_branch_remote(config, a:branch) | |
endfunction " }}} | |
1 0.000006 function! s:git.get_branch_merge(branch, ...) abort " {{{ | |
let config = call(self.get_repository_config, a:000, self) | |
return s:Core.get_branch_merge(config, a:branch) | |
endfunction " }}} | |
1 0.000006 function! s:git.get_remote_fetch(remote, ...) abort " {{{ | |
let config = call(self.get_repository_config, a:000, self) | |
return s:Core.get_remote_fetch(config, a:remote) | |
endfunction " }}} | |
1 0.000006 function! s:git.get_remote_url(remote, ...) abort " {{{ | |
let config = call(self.get_repository_config, a:000, self) | |
return s:Core.get_remote_url(config, a:remote) | |
endfunction " }}} | |
1 0.000006 function! s:git.get_comment_char(...) abort " {{{ | |
let config = call(self.get_repository_config, a:000, self) | |
return s:Core.get_comment_char(config) | |
endfunction " }}} | |
1 0.000006 function! s:git.exec(args, ...) abort " {{{ | |
let opts = extend(self._get_call_opts(), get(a:000, 0, {})) | |
return s:Core.exec(a:args, opts) | |
endfunction " }}} | |
" VCS.Git.Misc | |
1 0.000009 function! s:git.get_parsed_status(...) abort " {{{ | |
let options = self._get_call_opts(extend({ | |
\ 'no_cache': 0, | |
\}, get(a:000, 0, {}))) | |
let opts = s:Dict.omit(options, ['no_cache']) | |
let name = s:Path.join('index', 'parsed_status', string(opts)) | |
let cache = self.cache.repository | |
let result = (self.is_updated('index', 'status') || options.no_cache) | |
\ ? {} | |
\ : cache.get(name, {}) | |
if empty(result) | |
let result = s:Misc.get_parsed_status(opts) | |
call cache.set(name, result) | |
endif | |
return result | |
endfunction " }}} | |
1 0.000006 function! s:git.get_parsed_commit(...) abort " {{{ | |
let options = self._get_call_opts(extend({ | |
\ 'no_cache': 0, | |
\}, get(a:000, 0, {}))) | |
let opts = s:Dict.omit(options, ['no_cache']) | |
let name = s:Path.join('index', 'parsed_commit', string(opts)) | |
let cache = self.cache.repository | |
let result = (self.is_updated('index', 'commit') || options.no_cache) | |
\ ? {} | |
\ : cache.get(name, {}) | |
if empty(result) | |
let result = s:Misc.get_parsed_commit(opts) | |
call cache.set(name, result) | |
endif | |
return result | |
endfunction " }}} | |
1 0.000009 function! s:git.get_parsed_config(...) abort " {{{ | |
let options = self._get_call_opts(extend({ | |
\ 'no_cache': 0, | |
\}, get(a:000, 0, {}))) | |
let opts = s:Dict.omit(options, ['no_cache']) | |
let name = s:Path.join('index', 'parsed_config', string(opts)) | |
let cache = self.cache.repository | |
let result = (self.is_updated('index', 'config') || options.no_cache) | |
\ ? {} | |
\ : cache.get(name, {}) | |
if empty(result) | |
let result = s:Misc.get_parsed_config(opts) | |
call cache.set(name, result) | |
endif | |
return result | |
endfunction " }}} | |
1 0.000006 function! s:git.get_last_commitmsg(...) abort " {{{ | |
let options = self._get_call_opts(extend({ | |
\ 'no_cache': 0, | |
\}, get(a:000, 0, {}))) | |
let opts = s:Dict.omit(options, ['no_cache']) | |
let name = s:Path.join('index', 'last_commitmsg', string(opts)) | |
let cache = self.cache.repository | |
let result = (self.is_updated('index', 'last_commitmsg') || options.no_cache) | |
\ ? [] | |
\ : cache.get(name, []) | |
if empty(result) | |
unlet! result | |
let result = s:Misc.get_last_commitmsg(opts) | |
call cache.set(name, result) | |
endif | |
return result | |
endfunction " }}} | |
1 0.000007 function! s:git.count_commits_ahead_of_remote(...) abort " {{{ | |
let options = self._get_call_opts(extend({ | |
\ 'no_cache': 0, | |
\}, get(a:000, 0, {}))) | |
let opts = s:Dict.omit(options, ['no_cache']) | |
let name = s:Path.join('index', 'commits_ahead_of_remote', string(opts)) | |
let cache = self.cache.repository | |
let result = (self.is_updated('index', 'commits_ahead_of_remote') || options.no_cache) | |
\ ? -1 | |
\ : cache.get(name, -1) | |
if result == -1 | |
let result = s:Misc.count_commits_ahead_of_remote(opts) | |
call cache.set(name, result) | |
endif | |
return result | |
endfunction " }}} | |
1 0.000007 function! s:git.count_commits_behind_remote(...) abort " {{{ | |
let options = self._get_call_opts(extend({ | |
\ 'no_cache': 0, | |
\}, get(a:000, 0, {}))) | |
let opts = s:Dict.omit(options, ['no_cache']) | |
let name = s:Path.join('index', 'commits_behind_remote', string(opts)) | |
let cache = self.cache.repository | |
let result = (self.is_updated('index', 'commits_behind_remote') || options.no_cache) | |
\ ? -1 | |
\ : cache.get(name, -1) | |
if result == -1 | |
let result = s:Misc.count_commits_behind_remote(opts) | |
call cache.set(name, result) | |
endif | |
return result | |
endfunction " }}} | |
" Helper | |
1 0.000005 function! s:git.get_meta() abort " {{{ | |
let meta = {} | |
let meta.head = self.get_head() | |
let meta.fetch_head = self.get_fetch_head() | |
let meta.orig_head = self.get_orig_head() | |
let meta.merge_head = self.get_merge_head() | |
let meta.commit_editmsg = self.get_commit_editmsg() | |
let meta.last_commitmsg = | |
\ empty(meta.commit_editmsg) | |
\ ? self.get_last_commitmsg() | |
\ : meta.commit_editmsg | |
let meta.merge_msg = self.get_merge_msg() | |
let meta.current_branch = meta.head =~? 'refs/heads/' | |
\ ? matchstr(meta.head, 'refs/heads/\zs.\+$') | |
\ : meta.head[:6] | |
let meta.current_branch_hash = self.get_local_hash(meta.current_branch) | |
let meta.repository_config = self.get_repository_config() | |
let meta.current_branch_remote = self.get_branch_remote(meta.current_branch) | |
let meta.current_branch_merge = self.get_branch_merge(meta.current_branch) | |
let meta.current_remote_fetch = self.get_remote_fetch(meta.current_branch_remote) | |
let meta.current_remote_url = self.get_remote_url(meta.current_branch_remote) | |
let meta.comment_char = self.get_comment_char() | |
let meta.current_remote_branch = matchstr(meta.current_branch_merge, 'refs/heads/\zs.\+$') | |
let meta.current_remote_branch_hash = self.get_remote_hash( | |
\ meta.current_branch_remote, | |
\ meta.current_remote_branch, | |
\) | |
let meta.commits_ahead_of_remote = self.count_commits_ahead_of_remote() | |
let meta.commits_behind_remote = self.count_commits_behind_remote() | |
return meta | |
endfunction " }}} | |
" Git commands | |
1 0.000006 function! s:git.add(options, ...) abort " {{{ | |
let defaults = { | |
\ 'dry_run': 0, | |
\ 'verbose': 0, | |
\ 'force': 0, | |
\ 'interactive': 0, | |
\ 'patch': 0, | |
\ 'edit': 0, | |
\ 'update': 0, | |
\ 'all': 0, | |
\ 'intent_to_add': 0, | |
\ 'refresh': 0, | |
\ 'ignore_errors': 0, | |
\ 'ignore_missing': 0, | |
\} | |
let opts = s:Dict.omit(a:options, keys(defaults)) | |
let args = extend(['add'], s:Misc.opts2args(a:options, defaults)) | |
let filenames = s:_listalize(get(a:000, 0, [])) | |
if len(filenames) > 0 | |
call add(args, ['--', filenames]) | |
endif | |
return self.exec(args, opts) | |
endfunction " }}} | |
1 0.000006 function! s:git.rm(options, ...) abort " {{{ | |
let defaults = { | |
\ 'force': 0, | |
\ 'dry_run': 0, | |
\ 'r': 0, | |
\ 'cached': 0, | |
\ 'ignore_unmatch': 0, | |
\ 'quiet': 0, | |
\} | |
let opts = s:Dict.omit(a:options, keys(defaults)) | |
let args = extend(['rm'], s:Misc.opts2args(a:options, defaults)) | |
let filenames = s:_listalize(get(a:000, 0, [])) | |
if len(filenames) > 0 | |
call add(args, ['--', filenames]) | |
endif | |
return self.exec(args, opts) | |
endfunction " }}} | |
1 0.000007 function! s:git.reset(options, commit, ...) abort " {{{ | |
let defaults = { | |
\ 'quiet': 0, | |
\ 'patch': 0, | |
\ 'intent_to_add': 0, | |
\ 'mixed': 0, | |
\ 'soft': 0, | |
\ 'merge': 0, | |
\ 'keep': 0, | |
\} | |
let opts = s:Dict.omit(a:options, keys(defaults)) | |
let args = extend(['reset'], s:Misc.opts2args(a:options, defaults)) | |
if strlen(a:commit) | |
call add(args, a:commit) | |
endif | |
let filenames = s:_listalize(get(a:000, 0, [])) | |
if len(filenames) > 0 | |
call add(args, ['--', filenames]) | |
endif | |
return self.exec(args, opts) | |
endfunction " }}} | |
1 0.000007 function! s:git.checkout(options, commit, ...) abort " {{{ | |
let defaults = { | |
\ 'quiet': 0, | |
\ 'force': 0, | |
\ 'ours': 0, | |
\ 'theirs': 0, | |
\ 'b': '', | |
\ 'B': '', | |
\ 'track': 0, | |
\ 'no_track': 0, | |
\ 'l': 0, | |
\ 'detach': 0, | |
\ 'orphan': '', | |
\ 'merge': 0, | |
\ 'conflict': '=merge', | |
\ 'patch': 0, | |
\} | |
let opts = s:Dict.omit(a:options, keys(defaults)) | |
let args = extend(['checkout'], s:Misc.opts2args(a:options, defaults)) | |
if strlen(a:commit) | |
call add(args, a:commit) | |
endif | |
let filenames = s:_listalize(get(a:000, 0, [])) | |
if len(filenames) > 0 | |
call add(args, ['--', filenames]) | |
endif | |
return self.exec(args, opts) | |
endfunction " }}} | |
1 0.000007 function! s:git.status(options, ...) abort " {{{ | |
let defaults = { | |
\ 'short': 0, | |
\ 'branch': 0, | |
\ 'porcelain': 0, | |
\ 'untracked_files': '=all', | |
\ 'ignore_submodules': '=all', | |
\ 'ignored': 0, | |
\ 'z': 0, | |
\} | |
let opts = s:Dict.omit(a:options, keys(defaults)) | |
let args = extend(['status'], s:Misc.opts2args(a:options, defaults)) | |
let filenames = s:_listalize(get(a:000, 0, [])) | |
if len(filenames) > 0 | |
call add(args, ['--', filenames]) | |
endif | |
return self.exec(args, opts) | |
endfunction " }}} | |
1 0.000006 function! s:git.commit(options, ...) abort " {{{ | |
let defaults = { | |
\ 'all': 0, | |
\ 'patch': 0, | |
\ 'reuse_message': '=', | |
\ 'reedit_message': '=', | |
\ 'fixup': '=', | |
\ 'squash': '=', | |
\ 'reset_author': 0, | |
\ 'short': 0, | |
\ 'porcelain': 0, | |
\ 'z': 0, | |
\ 'file': '=', | |
\ 'author': '=', | |
\ 'date': '=', | |
\ 'message': '=', | |
\ 'template': '=', | |
\ 'signoff': 0, | |
\ 'no_verify': 0, | |
\ 'allow_empty': 0, | |
\ 'allow_empty_message': 0, | |
\ 'cleanup': '=default', | |
\ 'edit': 0, | |
\ 'amend': 0, | |
\ 'include': 0, | |
\ 'only': 0, | |
\ 'untracked_files': '=all', | |
\ 'verbose': 0, | |
\ 'quiet': 0, | |
\ 'dry_run': 0, | |
\ 'status': 0, | |
\ 'no_status': 0, | |
\} | |
let opts = s:Dict.omit(a:options, keys(defaults)) | |
let args = extend(['commit'], s:Misc.opts2args(a:options, defaults)) | |
let filenames = s:_listalize(get(a:000, 0, [])) | |
if len(filenames) > 0 | |
call add(args, ['--', filenames]) | |
endif | |
return self.exec(args, opts) | |
endfunction " }}} | |
1 0.000007 function! s:git.diff(options, commit, ...) abort " {{{ | |
let defaults = { | |
\ 'patch': 0, | |
\ 'unified': '=', | |
\ 'raw': 0, | |
\ 'patch_with_raw': 0, | |
\ 'minimal': 0, | |
\ 'patience': 0, | |
\ 'histogram': 0, | |
\ 'stat': '=', | |
\ 'numstat': 0, | |
\ 'shortstat': 0, | |
\ 'dirstat': '=', | |
\ 'summary': 0, | |
\ 'patch_with_stat': 0, | |
\ 'z': 0, | |
\ 'name_only': 0, | |
\ 'name_status': 0, | |
\ 'submodule': '=log', | |
\ 'color': '=never', | |
\ 'no_color': 0, | |
\ 'word_diff': '=plain', | |
\ 'word_diff_regex': '=', | |
\ 'color_words': '=', | |
\ 'no_renames': 0, | |
\ 'check': 0, | |
\ 'full_index': 0, | |
\ 'binary': 0, | |
\ 'abbrev': '=', | |
\ 'break_rewrites': '=', | |
\ 'find_renames': '=', | |
\ 'find_copies': '=', | |
\ 'find_copies_harder': 0, | |
\ 'irreversible_delete': 0, | |
\ 'l': '=', | |
\ 'diff_filter': '=', | |
\ 'S': '=', | |
\ 'G': '=', | |
\ 'pickaxe_all': 0, | |
\ 'pickaxe_regex': 0, | |
\ 'O': '=', | |
\ 'R': 0, | |
\ 'relative': '=', | |
\ 'text': 0, | |
\ 'ignore_space_at_eol': 0, | |
\ 'ignore_space_change': 0, | |
\ 'ignore_all_space': 0, | |
\ 'inter_hunk_context': '=', | |
\ 'function_context': 0, | |
\ 'exit_code': 0, | |
\ 'quiet': 0, | |
\ 'ext_diff': 0, | |
\ 'no_ext_diff': 0, | |
\ 'textconv': 0, | |
\ 'no_textconv': 0, | |
\ 'ignore_submodules': '=all', | |
\ 'src_prefix': '=', | |
\ 'dst_prefix': '=', | |
\ 'no_prefix': 0, | |
\} | |
let opts = s:Dict.omit(a:options, keys(defaults)) | |
let args = extend(['diff'], s:Misc.opts2args(a:options, defaults)) | |
if get(a:options, 'cached', 0) | |
call add(args, '--cached') | |
endif | |
if strlen(a:commit) > 0 | |
call add(args, a:commit) | |
endif | |
let filenames = s:_listalize(get(a:000, 0, [])) | |
if len(filenames) > 0 | |
call add(args, ['--', filenames]) | |
endif | |
return self.exec(args, opts) | |
endfunction " }}} | |
1 0.000032 let &cpo = s:save_cpo | |
1 0.000008 unlet s:save_cpo | |
"vim: sts=2 sw=2 smarttab et ai textwidth=0 fdm=marker | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/System/Cache/Simple.vim | |
Sourced 1 time | |
Total time: 0.000842 | |
Self time: 0.000842 | |
count total (s) self (s) | |
"****************************************************************************** | |
" A simple cache system which store cached values in instances | |
" | |
" Author: Alisue <lambdalisue@cache_keynote.net> | |
" URL: http://cache_keynote.net/ | |
" License: MIT license | |
" (C) 2014, Alisue, cache_keynote.net | |
"****************************************************************************** | |
1 0.000029 let s:save_cpo = &cpo | |
1 0.000025 set cpo&vim | |
1 0.000012 function! s:_vital_loaded(V) dict abort " {{{ | |
let s:Base = a:V.import('System.Cache.Base') | |
endfunction " }}} | |
1 0.000008 function! s:_vital_depends() abort " {{{ | |
return ['System.Cache.Base'] | |
endfunction " }}} | |
1 0.000012 let s:cache = { '_cached': {} } | |
1 0.000006 function! s:new() abort " {{{ | |
return extend(s:Base.new(), deepcopy(s:cache)) | |
endfunction " }}} | |
1 0.000008 function! s:cache.has(name) abort " {{{ | |
let cache_key = self.cache_key(a:name) | |
return has_key(self._cached, cache_key) | |
endfunction " }}} | |
1 0.000006 function! s:cache.get(name, ...) abort " {{{ | |
let default = get(a:000, 0, '') | |
let cache_key = self.cache_key(a:name) | |
if has_key(self._cached, cache_key) | |
return self._cached[cache_key] | |
else | |
return default | |
endif | |
endfunction " }}} | |
1 0.000007 function! s:cache.set(name, value) abort " {{{ | |
let cache_key = self.cache_key(a:name) | |
let self._cached[cache_key] = a:value | |
endfunction " }}} | |
1 0.000006 function! s:cache.remove(name) abort " {{{ | |
let cache_key = self.cache_key(a:name) | |
if has_key(self._cached, cache_key) | |
unlet self._cached[cache_key] | |
endif | |
endfunction " }}} | |
1 0.000006 function! s:cache.keys() abort " {{{ | |
return keys(self._cached) | |
endfunction " }}} | |
1 0.000006 function! s:cache.clear() abort " {{{ | |
let self._cached = {} | |
endfunction " }}} | |
1 0.000026 let &cpo = s:save_cpo | |
1 0.000008 unlet s:save_cpo | |
"vim: sts=2 sw=2 smarttab et ai textwidth=0 fdm=marker | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/System/Cache/Base.vim | |
Sourced 1 time | |
Total time: 0.001007 | |
Self time: 0.001007 | |
count total (s) self (s) | |
"****************************************************************************** | |
" An abstract class of unified cache system | |
" | |
" Author: Alisue <[email protected]> | |
" URL: http://hashnote.net/ | |
" License: MIT license | |
" (C) 2015, Alisue, hashnote.net | |
"****************************************************************************** | |
1 0.000027 let s:save_cpo = &cpo | |
1 0.000025 set cpo&vim | |
1 0.000012 function! s:_vital_loaded(V) dict abort " {{{ | |
let s:Prelude = a:V.import('Prelude') | |
let s:String = a:V.import('Data.String') | |
endfunction " }}} | |
1 0.000008 function! s:_vital_depends() abort " {{{ | |
return ['Prelude', 'Data.String'] | |
endfunction " }}} | |
1 0.000007 function! s:hash(obj) abort " {{{ | |
let str = s:Prelude.is_string(a:obj) ? a:obj : string(a:obj) | |
if strlen(str) < 150 | |
" hash might be a filename thus. | |
let hash = str | |
let hash = substitute(hash, ':', '=-', 'g') | |
let hash = substitute(hash, '[/\\]', '=+', 'g') | |
else | |
let hash = s:String.hash(str) | |
endif | |
return hash | |
endfunction " }}} | |
1 0.000008 let s:cache = {} | |
1 0.000006 function! s:new() abort " {{{ | |
return deepcopy(s:cache) | |
endfunction " }}} | |
1 0.000008 function! s:cache.cache_key(obj) abort " {{{ | |
return s:hash(a:obj) | |
endfunction " }}} | |
1 0.000007 function! s:cache.has(name) abort " {{{ | |
throw "System.Cache.Base: has({name}) is not implemented" | |
endfunction " }}} | |
1 0.000007 function! s:cache.get(name, ...) abort " {{{ | |
throw "System.Cache.Base: get({name}[, {default}]) is not implemented" | |
endfunction " }}} | |
1 0.000007 function! s:cache.set(name, value) abort " {{{ | |
throw "System.Cache.Base: set({name}, {value}[, {default}]) is not implemented" | |
endfunction " }}} | |
1 0.000006 function! s:cache.keys() abort " {{{ | |
throw "System.Cache.Base: keys() is not implemented" | |
endfunction " }}} | |
1 0.000006 function! s:cache.remove(name) abort " {{{ | |
throw "System.Cache.Base: remove({name}) is not implemented" | |
endfunction " }}} | |
1 0.000006 function! s:cache.clear() abort " {{{ | |
throw "System.Cache.Base: clear() is not implemented" | |
endfunction " }}} | |
1 0.000027 let &cpo = s:save_cpo | |
1 0.000007 unlet s:save_cpo | |
"vim: sts=2 sw=2 smarttab et ai textwidth=0 fdm=marker | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/Data/String.vim | |
Sourced 1 time | |
Total time: 0.004971 | |
Self time: 0.004971 | |
count total (s) self (s) | |
" Utilities for string. | |
1 0.000029 let s:save_cpo = &cpo | |
1 0.000027 set cpo&vim | |
1 0.000012 function! s:_vital_loaded(V) abort | |
let s:V = a:V | |
let s:P = s:V.import('Prelude') | |
let s:L = s:V.import('Data.List') | |
endfunction | |
1 0.000008 function! s:_vital_depends() abort | |
return ['Prelude', 'Data.List'] | |
endfunction | |
" Substitute a:from => a:to by string. | |
" To substitute by pattern, use substitute() instead. | |
1 0.000008 function! s:replace(str, from, to) abort | |
return s:_replace(a:str, a:from, a:to, 'g') | |
endfunction | |
" Substitute a:from => a:to only once. | |
" cf. s:replace() | |
1 0.000008 function! s:replace_first(str, from, to) abort | |
return s:_replace(a:str, a:from, a:to, '') | |
endfunction | |
" implement of replace() and replace_first() | |
1 0.000009 function! s:_replace(str, from, to, flags) abort | |
return substitute(a:str, '\V'.escape(a:from, '\'), escape(a:to, '\'), a:flags) | |
endfunction | |
1 0.000007 function! s:scan(str, pattern) abort | |
let list = [] | |
call substitute(a:str, a:pattern, '\=add(list, submatch(0)) == [] ? "" : ""', 'g') | |
return list | |
endfunction | |
1 0.000007 function! s:reverse(str) abort | |
return join(reverse(split(a:str, '.\zs')), '') | |
endfunction | |
1 0.000007 function! s:common_head(strs) abort | |
if empty(a:strs) | |
return '' | |
endif | |
let len = len(a:strs) | |
if len == 1 | |
return a:strs[0] | |
endif | |
let strs = len == 2 ? a:strs : sort(copy(a:strs)) | |
let pat = substitute(strs[0], '.', '\="[" . escape(submatch(0), "^\\") . "]"', 'g') | |
return pat == '' ? '' : matchstr(strs[-1], '\C^\%[' . pat . ']') | |
endfunction | |
" Split to two elements of List. ([left, right]) | |
" e.g.: s:split3('neocomplcache', 'compl') returns ['neo', 'compl', 'cache'] | |
1 0.000008 function! s:split_leftright(expr, pattern) abort | |
let [left, _, right] = s:split3(a:expr, a:pattern) | |
return [left, right] | |
endfunction | |
1 0.000011 function! s:split3(expr, pattern) abort | |
let ERROR = ['', '', ''] | |
if a:expr ==# '' || a:pattern ==# '' | |
return ERROR | |
endif | |
let begin = match(a:expr, a:pattern) | |
if begin is -1 | |
return ERROR | |
endif | |
let end = matchend(a:expr, a:pattern) | |
let left = begin <=# 0 ? '' : a:expr[: begin - 1] | |
let right = a:expr[end :] | |
return [left, a:expr[begin : end-1], right] | |
endfunction | |
" Slices into strings determines the number of substrings. | |
" e.g.: s:nsplit("neo compl cache", 2, '\s') returns ['neo', 'compl cache'] | |
1 0.000008 function! s:nsplit(expr, n, ...) abort | |
let pattern = get(a:000, 0, '\s') | |
let keepempty = get(a:000, 1, 1) | |
let ret = [] | |
let expr = a:expr | |
if a:n <= 1 | |
return [expr] | |
endif | |
while 1 | |
let pos = match(expr, pattern) | |
if pos == -1 | |
if expr !~ pattern || keepempty | |
call add(ret, expr) | |
endif | |
break | |
elseif pos >= 0 | |
let left = pos > 0 ? expr[:pos-1] : '' | |
if pos > 0 || keepempty | |
call add(ret, left) | |
endif | |
let ml = len(matchstr(expr, pattern)) | |
if pos == 0 && ml == 0 | |
let pos = 1 | |
endif | |
let expr = expr[pos+ml :] | |
endif | |
if len(expr) == 0 | |
break | |
endif | |
if len(ret) == a:n - 1 | |
call add(ret, expr) | |
break | |
endif | |
endwhile | |
return ret | |
endfunction | |
" Returns the number of character in a:str. | |
" NOTE: This returns proper value | |
" even if a:str contains multibyte character(s). | |
" s:strchars(str) {{{ | |
1 0.000015 if exists('*strchars') | |
1 0.000007 function! s:strchars(str) abort | |
return strchars(a:str) | |
endfunction | |
1 0.000004 else | |
function! s:strchars(str) abort | |
return strlen(substitute(copy(a:str), '.', 'x', 'g')) | |
endfunction | |
endif "}}} | |
" Returns the bool of contains any multibyte character in s:str | |
1 0.000008 function! s:contains_multibyte(str) abort "{{{ | |
return strlen(a:str) != s:strchars(a:str) | |
endfunction "}}} | |
" Remove last character from a:str. | |
" NOTE: This returns proper value | |
" even if a:str contains multibyte character(s). | |
1 0.000006 function! s:chop(str) abort "{{{ | |
return substitute(a:str, '.$', '', '') | |
endfunction "}}} | |
" Remove last \r,\n,\r\n from a:str. | |
1 0.000007 function! s:chomp(str) abort "{{{ | |
return substitute(a:str, '\%(\r\n\|[\r\n]\)$', '', '') | |
endfunction "}}} | |
" wrap() and its internal functions | |
" * _split_by_wcswidth_once() | |
" * _split_by_wcswidth() | |
" * _concat() | |
" * wrap() | |
" | |
" NOTE _concat() is just a copy of Data.List.concat(). | |
" FIXME don't repeat yourself | |
1 0.000010 function! s:_split_by_wcswidth_once(body, x) abort | |
let fst = s:P.strwidthpart(a:body, a:x) | |
let snd = s:P.strwidthpart_reverse(a:body, s:P.wcswidth(a:body) - s:P.wcswidth(fst)) | |
return [fst, snd] | |
endfunction | |
1 0.000008 function! s:_split_by_wcswidth(body, x) abort | |
let memo = [] | |
let body = a:body | |
while s:P.wcswidth(body) > a:x | |
let [tmp, body] = s:_split_by_wcswidth_once(body, a:x) | |
call add(memo, tmp) | |
endwhile | |
call add(memo, body) | |
return memo | |
endfunction | |
1 0.000006 function! s:trim(str) abort | |
return matchstr(a:str,'^\s*\zs.\{-}\ze\s*$') | |
endfunction | |
1 0.000006 function! s:wrap(str,...) abort | |
let _columns = a:0 > 0 ? a:1 : &columns | |
return s:L.concat( | |
\ map(split(a:str, '\r\n\|[\r\n]'), 's:_split_by_wcswidth(v:val, _columns - 1)')) | |
endfunction | |
1 0.000007 function! s:nr2byte(nr) abort | |
if a:nr < 0x80 | |
return nr2char(a:nr) | |
elseif a:nr < 0x800 | |
return nr2char(a:nr/64+192).nr2char(a:nr%64+128) | |
else | |
return nr2char(a:nr/4096%16+224).nr2char(a:nr/64%64+128).nr2char(a:nr%64+128) | |
endif | |
endfunction | |
1 0.000008 function! s:nr2enc_char(charcode) abort | |
if &encoding == 'utf-8' | |
return nr2char(a:charcode) | |
endif | |
let char = s:nr2byte(a:charcode) | |
if strlen(char) > 1 | |
let char = strtrans(iconv(char, 'utf-8', &encoding)) | |
endif | |
return char | |
endfunction | |
1 0.000006 function! s:nr2hex(nr) abort | |
let n = a:nr | |
let r = "" | |
while n | |
let r = '0123456789ABCDEF'[n % 16] . r | |
let n = n / 16 | |
endwhile | |
return r | |
endfunction | |
" If a ==# b, returns -1. | |
" If a !=# b, returns first index of different character. | |
1 0.000007 function! s:diffidx(a, b) abort | |
return a:a ==# a:b ? -1 : strlen(s:common_head([a:a, a:b])) | |
endfunction | |
1 0.000008 function! s:substitute_last(expr, pat, sub) abort | |
return substitute(a:expr, printf('.*\zs%s', a:pat), a:sub, '') | |
endfunction | |
1 0.000007 function! s:dstring(expr) abort | |
let x = substitute(string(a:expr), "^'\\|'$", '', 'g') | |
let x = substitute(x, "''", "'", 'g') | |
return printf('"%s"', escape(x, '"')) | |
endfunction | |
1 0.000006 function! s:lines(str) abort | |
return split(a:str, '\r\?\n') | |
endfunction | |
1 0.000009 function! s:_pad_with_char(str, left, right, char) abort | |
return repeat(a:char, a:left). a:str. repeat(a:char, a:right) | |
endfunction | |
1 0.000007 function! s:pad_left(str, width, ...) abort | |
let char = get(a:, 1, ' ') | |
if strdisplaywidth(char) != 1 | |
throw "vital: Data.String: Can't use non-half-width characters for padding." | |
endif | |
let left = max([0, a:width - strdisplaywidth(a:str)]) | |
return s:_pad_with_char(a:str, left, 0, char) | |
endfunction | |
1 0.000007 function! s:pad_right(str, width, ...) abort | |
let char = get(a:, 1, ' ') | |
if strdisplaywidth(char) != 1 | |
throw "vital: Data.String: Can't use non-half-width characters for padding." | |
endif | |
let right = max([0, a:width - strdisplaywidth(a:str)]) | |
return s:_pad_with_char(a:str, 0, right, char) | |
endfunction | |
1 0.000008 function! s:pad_both_sides(str, width, ...) abort | |
let char = get(a:, 1, ' ') | |
if strdisplaywidth(char) != 1 | |
throw "vital: Data.String: Can't use non-half-width characters for padding." | |
endif | |
let space = max([0, a:width - strdisplaywidth(a:str)]) | |
let left = space / 2 | |
let right = space - left | |
return s:_pad_with_char(a:str, left, right, char) | |
endfunction | |
1 0.000009 function! s:pad_between_letters(str, width, ...) abort | |
let char = get(a:, 1, ' ') | |
if strdisplaywidth(char) != 1 | |
throw "vital: Data.String: Can't use non-half-width characters for padding." | |
endif | |
let letters = split(a:str, '\zs') | |
let each_width = a:width / len(letters) | |
let str = join(map(letters, 's:pad_both_sides(v:val, each_width, char)'), '') | |
if a:width - strdisplaywidth(str) > 0 | |
return char. s:pad_both_sides(str, a:width - 1, char) | |
endif | |
return str | |
endfunction | |
1 0.000009 function! s:justify_equal_spacing(str, width, ...) abort | |
let char = get(a:, 1, ' ') | |
if strdisplaywidth(char) != 1 | |
throw "vital: Data.String: Can't use non-half-width characters for padding." | |
endif | |
let letters = split(a:str, '\zs') | |
let first_letter = letters[0] | |
" {width w/o the first letter} / {length w/o the first letter} | |
let each_width = (a:width - strdisplaywidth(first_letter)) / (len(letters) - 1) | |
let remainder = (a:width - strdisplaywidth(first_letter)) % (len(letters) - 1) | |
return first_letter. join(s:L.concat([ | |
\ map(letters[1:remainder], 's:pad_left(v:val, each_width + 1, char)'), | |
\ map(letters[remainder + 1:], 's:pad_left(v:val, each_width, char)') | |
\ ]), '') | |
endfunction | |
1 0.000009 function! s:levenshtein_distance(str1, str2) abort | |
let letters1 = split(a:str1, '\zs') | |
let letters2 = split(a:str2, '\zs') | |
let length1 = len(letters1) | |
let length2 = len(letters2) | |
let distances = map(range(1, length1 + 1), 'map(range(1, length2 + 1), "0")') | |
for i1 in range(0, length1) | |
let distances[i1][0] = i1 | |
endfor | |
for i2 in range(0, length2) | |
let distances[0][i2] = i2 | |
endfor | |
for i1 in range(1, length1) | |
for i2 in range(1, length2) | |
let cost = (letters1[i1 - 1] ==# letters2[i2 - 1]) ? 0 : 1 | |
let distances[i1][i2] = min([ | |
\ distances[i1 - 1][i2 ] + 1, | |
\ distances[i1 ][i2 - 1] + 1, | |
\ distances[i1 - 1][i2 - 1] + cost, | |
\]) | |
endfor | |
endfor | |
return distances[length1][length2] | |
endfunction | |
1 0.000017 function! s:padding_by_displaywidth(expr, width, float) abort | |
let padding_char = ' ' | |
let n = a:width - strdisplaywidth(a:expr) | |
if n <= 0 | |
let n = 0 | |
endif | |
if a:float < 0 | |
return a:expr . repeat(padding_char, n) | |
elseif 0 < a:float | |
return repeat(padding_char, n) . a:expr | |
else | |
if n % 2 is 0 | |
return repeat(padding_char, n / 2) . a:expr . repeat(padding_char, n / 2) | |
else | |
return repeat(padding_char, (n - 1) / 2) . a:expr . repeat(padding_char, (n - 1) / 2) . padding_char | |
endif | |
endif | |
endfunction | |
1 0.000010 function! s:split_by_displaywidth(expr, width, float, is_wrap) abort | |
if a:width is 0 | |
return [''] | |
endif | |
let lines = [] | |
let cs = split(a:expr, '\zs') | |
let cs_index = 0 | |
let text = '' | |
while cs_index < len(cs) | |
if cs[cs_index] is "\n" | |
let text = s:padding_by_displaywidth(text, a:width, a:float) | |
let lines += [text] | |
let text = '' | |
else | |
let w = strdisplaywidth(text . cs[cs_index]) | |
if w < a:width | |
let text .= cs[cs_index] | |
elseif a:width < w | |
let text = s:padding_by_displaywidth(text, a:width, a:float) | |
else | |
let text .= cs[cs_index] | |
endif | |
if a:width <= w | |
let lines += [text] | |
let text = '' | |
if a:is_wrap | |
if a:width < w | |
if a:width < strdisplaywidth(cs[cs_index]) | |
while get(cs, cs_index, "\n") isnot "\n" | |
let cs_index += 1 | |
endwhile | |
continue | |
else | |
let text = cs[cs_index] | |
endif | |
endif | |
else | |
while get(cs, cs_index, "\n") isnot "\n" | |
let cs_index += 1 | |
endwhile | |
continue | |
endif | |
endif | |
endif | |
let cs_index += 1 | |
endwhile | |
if !empty(text) | |
let lines += [ s:padding_by_displaywidth(text, a:width, a:float) ] | |
endif | |
return lines | |
endfunction | |
1 0.000007 function! s:hash(str) abort | |
if exists('*sha256') | |
return sha256(a:str) | |
else | |
" This gives up sha256ing but just adds up char with index. | |
let sum = 0 | |
for i in range(len(a:str)) | |
let sum += char2nr(a:str[i]) * (i + 1) | |
endfor | |
return printf('%x', sum) | |
endif | |
endfunction | |
1 0.000007 function! s:truncate(str, width) abort | |
" Original function is from mattn. | |
" http://github.com/mattn/googlereader-vim/tree/master | |
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 | |
1 0.000012 function! s:truncate_skipping(str, max, footer_width, separator) abort | |
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 | |
1 0.000112 function! s:strwidthpart(str, width) abort | |
if a:width <= 0 | |
return '' | |
endif | |
let strarr = split(a:str, '\zs') | |
let width = s:wcswidth(a:str) | |
let index = len(strarr) | |
let diff = (index + 1) / 2 | |
let rightindex = index - 1 | |
while width > a:width | |
let index = max([rightindex - diff + 1, 0]) | |
let partwidth = s:wcswidth(join(strarr[(index):(rightindex)], '')) | |
if width - partwidth >= a:width || diff <= 1 | |
let width -= partwidth | |
let rightindex = index - 1 | |
endif | |
if diff > 1 | |
let diff = diff / 2 | |
endif | |
endwhile | |
return index ? join(strarr[:index - 1], '') : '' | |
endfunction | |
1 0.000009 function! s:strwidthpart_reverse(str, width) abort | |
if a:width <= 0 | |
return '' | |
endif | |
let strarr = split(a:str, '\zs') | |
let width = s:wcswidth(a:str) | |
let strlen = len(strarr) | |
let diff = (strlen + 1) / 2 | |
let leftindex = 0 | |
let index = -1 | |
while width > a:width | |
let index = min([leftindex + diff, strlen]) - 1 | |
let partwidth = s:wcswidth(join(strarr[(leftindex):(index)], '')) | |
if width - partwidth >= a:width || diff <= 1 | |
let width -= partwidth | |
let leftindex = index + 1 | |
endif | |
if diff > 1 | |
let diff = diff / 2 | |
endif | |
endwhile | |
return index < strlen ? join(strarr[(index + 1):], '') : '' | |
endfunction | |
1 0.000012 if v:version >= 703 | |
" Use builtin function. | |
1 0.000008 function! s:wcswidth(str) abort | |
return strwidth(a:str) | |
endfunction | |
1 0.000006 else | |
function! s:wcswidth(str) abort | |
if a:str =~# '^[\x00-\x7f]*$' | |
return strlen(a:str) | |
endif | |
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 | |
1 0.000039 let &cpo = s:save_cpo | |
1 0.000007 unlet s:save_cpo | |
" vim:set et ts=2 sts=2 sw=2 tw=0: | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/VCS/Git/Core.vim | |
Sourced 1 time | |
Total time: 0.002681 | |
Self time: 0.002681 | |
count total (s) self (s) | |
"****************************************************************************** | |
" Core functions of Git manipulation. | |
" | |
" Author: Alisue <[email protected]> | |
" URL: http://hashnote.net/ | |
" License: MIT license | |
" | |
" (C) 2014, Alisue, hashnote.net | |
"****************************************************************************** | |
1 0.000027 let s:save_cpo = &cpo | |
1 0.000026 set cpo&vim | |
" Vital ====================================================================== | |
1 0.000008 let s:_config = {} | |
1 0.000010 let s:_config.executable = 'git' | |
1 0.000010 let s:_config.arguments = ['-c', 'color.ui=false'] | |
1 0.000011 function! s:_vital_loaded(V) dict abort " {{{ | |
let s:V = a:V | |
let s:Prelude = a:V.import('Prelude') | |
let s:Process = a:V.import('Process') | |
let s:List = a:V.import('Data.List') | |
let s:Path = a:V.import('System.Filepath') | |
let s:INI = a:V.import('Text.INI') | |
endfunction " }}} | |
1 0.000008 function! s:_vital_depends() abort " {{{ | |
return [ | |
\ 'Prelude', | |
\ 'Process', | |
\ 'Data.List', | |
\ 'System.Filepath', | |
\ 'Text.INI', | |
\] | |
endfunction " }}} | |
1 0.000009 function! s:_fnamemodify(path, mods) abort " {{{ | |
let path = a:path !=# '' ? fnamemodify(a:path, a:mods) : '' | |
return s:Path.remove_last_separator(path) | |
endfunction " }}} | |
1 0.000008 function! s:_readfile(path) abort " {{{ | |
if !filereadable(a:path) | |
return [] | |
endif | |
return readfile(a:path) | |
endfunction " }}} | |
1 0.000008 function! s:_readline(path) abort " {{{ | |
let contents = s:_readfile(a:path) | |
return empty(contents) ? '' : contents[0] | |
endfunction " }}} | |
1 0.000006 function! s:get_config() abort " {{{ | |
return s:_config | |
endfunction " }}} | |
1 0.000007 function! s:set_config(config) abort " {{{ | |
let s:_config = extend(s:_config, a:config) | |
endfunction " }}} | |
" Repository | |
1 0.000007 function! s:find_worktree(path) abort " {{{ | |
let path = s:_fnamemodify(s:Prelude.path2directory(a:path), ':p') | |
let d = s:_fnamemodify(finddir('.git', path . ';'), ':p:h') | |
let f = s:_fnamemodify(findfile('.git', path . ';'), ':p') | |
" inside '.git' directory is not a working directory | |
let d = path =~# printf('\v^%s', d) ? '' : d | |
" use deepest dotgit found | |
let dotgit = strlen(d) >= strlen(f) ? d : f | |
return strlen(dotgit) ? s:_fnamemodify(dotgit, ':h') : '' | |
endfunction " }}} | |
1 0.000009 function! s:find_repository(worktree) abort " {{{ | |
let dotgit = s:Path.join([s:_fnamemodify(a:worktree, ':p'), '.git']) | |
if isdirectory(dotgit) | |
return dotgit | |
elseif filereadable(dotgit) | |
" in case if the found '.git' is a file which was created via | |
" '--separate-git-dir' option | |
let lines = readfile(dotgit) | |
if !empty(lines) | |
let gitdir = matchstr(lines[0], '^gitdir:\s*\zs.\+$') | |
let is_abs = s:Path.is_absolute(gitdir) | |
return s:_fnamemodify((is_abs ? gitdir : dotgit[:-5] . gitdir), ':p:h') | |
endif | |
endif | |
return '' | |
endfunction " }}} | |
1 0.000009 function! s:get_relative_path(worktree, path) abort " {{{ | |
if !s:Path.is_absolute(a:path) | |
return a:path | |
endif | |
let prefix = a:worktree . s:Path.separator() | |
return substitute(a:path, prefix, '', '') | |
endfunction " }}} | |
1 0.000009 function! s:get_absolute_path(worktree, path) abort " {{{ | |
if !s:Path.is_relative(a:path) | |
return a:path | |
endif | |
return s:Path.join([a:worktree, a:path]) | |
endfunction " }}} | |
" Meta (without using 'git rev-parse'. read '.git/*' directory) | |
1 0.000007 function! s:get_head(repository) abort " {{{ | |
" The current ref that you’re looking at. | |
let filename = s:Path.join(a:repository, 'HEAD') | |
return s:_readline(filename) | |
endfunction " }}} | |
1 0.000008 function! s:get_fetch_head(repository) abort " {{{ | |
" The SHAs of branch/remote heads that were updated during the last git fetch | |
let filename = s:Path.join(a:repository, 'FETCH_HEAD') | |
return s:_readfile(filename) | |
endfunction " }}} | |
1 0.000007 function! s:get_orig_head(repository) abort " {{{ | |
" When doing a merge, this is the SHA of the branch you’re merging into. | |
let filename = s:Path.join(a:repository, 'ORIG_HEAD') | |
return s:_readline(filename) | |
endfunction " }}} | |
1 0.000008 function! s:get_merge_head(repository) abort " {{{ | |
" When doing a merge, this is the SHA of the branch you’re merging from. | |
let filename = s:Path.join(a:repository, 'MERGE_HEAD') | |
return s:_readline(filename) | |
endfunction " }}} | |
1 0.000008 function! s:get_merge_mode(repository) abort " {{{ | |
" Used to communicate constraints that were originally given to git merge to | |
" git commit when a merge conflicts, and a separate git commit is needed to | |
" conclude it. Currently --no-ff is the only constraints passed this way. | |
let filename = s:Path.join(a:repository, 'MERGE_MODE') | |
return s:_readline(filename) | |
endfunction " }}} | |
1 0.000013 function! s:get_commit_editmsg(repository) abort " {{{ | |
" This is the last commit’s message. It’s not actually used by Git at all, | |
" but it’s there mostly for your reference after you made a commit. | |
let filename = s:Path.join(a:repository, 'COMMIT_EDITMSG') | |
return s:_readfile(filename) | |
endfunction " }}} | |
1 0.000008 function! s:get_merge_msg(repository) abort " {{{ | |
" Enumerates conflicts that happen during your current merge. | |
let filename = s:Path.join(a:repository, 'MERGE_MSG') | |
return s:_readfile(filename) | |
endfunction " }}} | |
1 0.000009 function! s:get_local_hash(repository, branch) abort " {{{ | |
let filename = s:Path.join(a:repository, 'refs', 'heads', a:branch) | |
return s:_readline(filename) | |
endfunction " }}} | |
1 0.000009 function! s:get_remote_hash(repository, remote, branch) abort " {{{ | |
let filename = s:Path.join(a:repository, 'refs', 'remotes', a:remote, a:branch) | |
let hash = s:_readline(filename) | |
if empty(hash) | |
" sometime the file is missing | |
let filename = s:Path.join(a:repository, 'packed-refs') | |
let packed_refs = join(s:_readfile(filename), "\n") | |
" Note: | |
" Vim document said '.' does not hit a new line but it is a LIE. | |
" And the behavior of regexpengine=1 is quite annoying thus the | |
" following discusting regex is required... | |
let pattern = printf('\v(\w|\s)*\ze\srefs/remotes/%s/%s', a:remote, a:branch) | |
let hash = matchstr(packed_refs, pattern) | |
endif | |
return hash | |
endfunction " }}} | |
" Config (without using 'git config'. read '.git/config' directly) | |
1 0.000009 function! s:get_repository_config(repository) abort " {{{ | |
let filename = s:Path.join(a:repository, 'config') | |
if !filereadable(filename) | |
return {} | |
endif | |
return s:INI.parse_file(filename) | |
endfunction " }}} | |
1 0.000009 function! s:get_branch_remote(config, local_branch) abort " {{{ | |
" a name of remote which the {local_branch} connect | |
let section = get(a:config, printf('branch "%s"', a:local_branch), {}) | |
if empty(section) | |
return '' | |
endif | |
return get(section, 'remote', '') | |
endfunction " }}} | |
1 0.000009 function! s:get_branch_merge(config, local_branch, ...) abort " {{{ | |
" a branch name of remote which {local_branch} connect | |
let truncate = get(a:000, 0, 0) | |
let section = get(a:config, printf('branch "%s"', a:local_branch), {}) | |
if empty(section) | |
return '' | |
endif | |
let merge = get(section, 'merge', '') | |
return truncate ? substitute(merge, '\v^refs/heads/', '', '') : merge | |
endfunction " }}} | |
1 0.000009 function! s:get_remote_fetch(config, remote) abort " {{{ | |
" a url of {remote} | |
let section = get(a:config, printf('remote "%s"', a:remote), {}) | |
if empty(section) | |
return '' | |
endif | |
return get(section, 'fetch', '') | |
endfunction " }}} | |
1 0.000008 function! s:get_remote_url(config, remote) abort " {{{ | |
" a url of {remote} | |
let section = get(a:config, printf('remote "%s"', a:remote), {}) | |
if empty(section) | |
return '' | |
endif | |
return get(section, 'url', '') | |
endfunction " }}} | |
1 0.000008 function! s:get_comment_char(config, ...) abort " {{{ | |
let default = get(a:000, 0, '#') | |
let section = get(a:config, 'core', {}) | |
if empty(section) | |
return default | |
endif | |
return get(section, 'commentchar', default) | |
endfunction " }}} | |
" Execution | |
1 0.000007 function! s:system(args, ...) abort " {{{ | |
let saved_cwd = getcwd() | |
let args = s:List.flatten(a:args) | |
let opts = extend({ | |
\ 'stdin': '', | |
\ 'timeout': 0, | |
\ 'cwd': saved_cwd, | |
\}, get(a:000, 0, {})) | |
let original_opts = deepcopy(opts) | |
" prevent E677 | |
if strlen(opts.stdin) | |
let opts.input = opts.stdin | |
endif | |
try | |
let cwd = s:Prelude.path2directory(opts.cwd) | |
silent execute 'lcd' fnameescape(cwd) | |
let stdout = s:Process.system(args, opts) | |
finally | |
silent execute 'lcd' fnameescape(saved_cwd) | |
endtry | |
" remove trailing newline | |
let stdout = substitute(stdout, '\v%(\r?\n)$', '', '') | |
let status = s:Process.get_last_status() | |
return { 'stdout': stdout, 'status': status, 'args': args, 'opts': original_opts } | |
endfunction " }}} | |
1 0.000007 function! s:exec(args, ...) abort " {{{ | |
let args = [s:_config.executable, s:_config.arguments, a:args] | |
let opts = get(a:000, 0, {}) | |
return s:system(args, opts) | |
endfunction " }}} | |
1 0.000031 let &cpo = s:save_cpo | |
1 0.000007 unlet s:save_cpo | |
"vim: sts=2 sw=2 smarttab et ai textwidth=0 fdm=marker | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/Process.vim | |
Sourced 1 time | |
Total time: 0.001161 | |
Self time: 0.001161 | |
count total (s) self (s) | |
" TODO: move all comments to doc file. | |
" | |
" | |
" FIXME: This module name should be Vital.System ? | |
" But the name has been already taken. | |
1 0.000029 let s:save_cpo = &cpo | |
1 0.000025 set cpo&vim | |
" FIXME: Unfortunately, can't use s:_vital_loaded() for this purpose. | |
" Because these variables are used when this script file is loaded. | |
1 0.000037 let s:is_windows = has('win16') || has('win32') || has('win64') || has('win95') | |
1 0.000009 let s:is_unix = has('unix') | |
" As of 7.4.122, the system()'s 1st argument is converted internally by Vim. | |
" Note that Patch 7.4.122 does not convert system()'s 2nd argument and | |
" return-value. We must convert them manually. | |
1 0.000027 let s:need_trans = v:version < 704 || (v:version == 704 && !has('patch122')) | |
1 0.000010 let s:TYPE_DICT = type({}) | |
1 0.000009 let s:TYPE_LIST = type([]) | |
1 0.000009 let s:TYPE_STRING = type("") | |
" Execute program in the background from Vim. | |
" Return an empty string always. | |
" | |
" If a:expr is a List, shellescape() each argument. | |
" If a:expr is a String, the arguments are passed as-is. | |
" | |
" Windows: | |
" Using :!start , execute program without via cmd.exe. | |
" Spawning 'expr' with 'noshellslash' | |
" keep special characters from unwanted expansion. | |
" (see :help shellescape()) | |
" | |
" Unix: | |
" using :! , execute program in the background by shell. | |
1 0.000011 function! s:spawn(expr, ...) abort | |
let shellslash = 0 | |
if s:is_windows | |
let shellslash = &l:shellslash | |
setlocal noshellslash | |
endif | |
try | |
if type(a:expr) is s:TYPE_LIST | |
let special = 1 | |
let cmdline = join(map(a:expr, 'shellescape(v:val, special)'), ' ') | |
elseif type(a:expr) is s:TYPE_STRING | |
let cmdline = a:expr | |
if a:0 && a:1 | |
" for :! command | |
let cmdline = substitute(cmdline, '\([!%#]\|<[^<>]\+>\)', '\\\1', 'g') | |
endif | |
else | |
throw 'Process.spawn(): invalid argument (value type:'.type(a:expr).')' | |
endif | |
if s:is_windows | |
silent execute '!start' cmdline | |
else | |
silent execute '!' cmdline '&' | |
endif | |
finally | |
if s:is_windows | |
let &l:shellslash = shellslash | |
endif | |
endtry | |
return '' | |
endfunction | |
" iconv() wrapper for safety. | |
1 0.000008 function! s:iconv(expr, from, to) abort | |
if a:from == '' || a:to == '' || a:from ==? a:to | |
return a:expr | |
endif | |
let result = iconv(a:expr, a:from, a:to) | |
return result != '' ? result : a:expr | |
endfunction | |
" Check vimproc. | |
1 0.000007 function! s:has_vimproc() abort | |
if !exists('s:exists_vimproc') | |
try | |
call vimproc#version() | |
let s:exists_vimproc = 1 | |
catch | |
let s:exists_vimproc = 0 | |
endtry | |
endif | |
return s:exists_vimproc | |
endfunction | |
" * {command} [, {input} [, {timeout}]] | |
" * {command} [, {dict}] | |
" {dict} = { | |
" use_vimproc: bool, | |
" input: string, | |
" timeout: bool, | |
" background: bool, | |
" } | |
1 0.000007 function! s:system(str, ...) abort | |
" Process optional arguments at first | |
" because use_vimproc is required later | |
" for a:str argument. | |
let input = '' | |
let use_vimproc = s:has_vimproc() | |
let background = 0 | |
let args = [] | |
if a:0 ==# 1 | |
" {command} [, {dict}] | |
" a:1 = {dict} | |
if type(a:1) is s:TYPE_DICT | |
if has_key(a:1, 'use_vimproc') | |
let use_vimproc = a:1.use_vimproc | |
endif | |
if has_key(a:1, 'input') | |
let args += [s:iconv(a:1.input, &encoding, 'char')] | |
endif | |
if use_vimproc && has_key(a:1, 'timeout') | |
" ignores timeout unless you have vimproc. | |
let args += [a:1.timeout] | |
endif | |
if has_key(a:1, 'background') | |
let background = a:1.background | |
endif | |
elseif type(a:1) is s:TYPE_STRING | |
let args += [s:iconv(a:1, &encoding, 'char')] | |
else | |
throw 'Process.system(): invalid argument (value type:'.type(a:1).')' | |
endif | |
elseif a:0 >= 2 | |
" {command} [, {input} [, {timeout}]] | |
" a:000 = [{input} [, {timeout}]] | |
let [input; rest] = a:000 | |
let input = s:iconv(input, &encoding, 'char') | |
let args += [input] + rest | |
endif | |
" Process a:str argument. | |
if type(a:str) is s:TYPE_LIST | |
let expr = use_vimproc ? '"''" . v:val . "''"' : 's:shellescape(v:val)' | |
let command = join(map(copy(a:str), expr), ' ') | |
elseif type(a:str) is s:TYPE_STRING | |
let command = a:str | |
else | |
throw 'Process.system(): invalid argument (value type:'.type(a:str).')' | |
endif | |
if s:need_trans | |
let command = s:iconv(command, &encoding, 'char') | |
endif | |
let args = [command] + args | |
if background && (use_vimproc || !s:is_windows) | |
let args[0] = args[0] . ' &' | |
endif | |
let funcname = use_vimproc ? 'vimproc#system' : 'system' | |
let output = call(funcname, args) | |
let output = s:iconv(output, 'char', &encoding) | |
return output | |
endfunction | |
1 0.000008 function! s:get_last_status() abort | |
return s:has_vimproc() ? | |
\ vimproc#get_last_status() : v:shell_error | |
endfunction | |
1 0.000007 if s:is_windows | |
function! s:shellescape(command) abort | |
return substitute(a:command, '[&()[\]{}^=;!''+,`~]', '^\0', 'g') | |
endfunction | |
else | |
1 0.000007 function! s:shellescape(...) abort | |
return call('shellescape', a:000) | |
endfunction | |
1 0.000004 endif | |
1 0.000032 let &cpo = s:save_cpo | |
1 0.000007 unlet s:save_cpo | |
" vim:set et ts=2 sts=2 sw=2 tw=0: | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/Text/INI.vim | |
Sourced 1 time | |
Total time: 0.000501 | |
Self time: 0.000501 | |
count total (s) self (s) | |
let s:save_cpo = &cpo | |
1 0.000026 set cpo&vim | |
1 0.000008 let s:default_section = '_' | |
1 0.000008 let s:comment_pattern = '\v[#;].*$' | |
1 0.000009 let s:section_pattern = '\v^\s*\[\s*(.{-1,})\s*\]\s*$' | |
1 0.000010 let s:parameter_pattern = '\v^\s*([^\=]{-1,})\s*\=\s*(.{-})\s*$' | |
1 0.000011 function! s:parse_record(line) abort | |
" remove comment string | |
let line = substitute(a:line, s:comment_pattern, '', 'g') | |
" is empty line? | |
if line =~# '\v^\s*$' | |
return {'type': 'emptyline'} | |
endif | |
" is parameter line? | |
let m = matchlist(line, s:parameter_pattern) | |
if len(m) > 0 | |
return {'type': 'parameter', 'key': m[1], 'value': m[2]} | |
endif | |
" is section line? | |
let m = matchlist(line, s:section_pattern) | |
if len(m) > 0 | |
return {'type': 'section', 'name': m[1]} | |
endif | |
" unknown format | |
return {'type': 'unknown', 'value': line} | |
endfunction | |
1 0.000007 function! s:parse(ini, ...) abort | |
let fail_silently = get(a:000, 0, 1) | |
let sections = {} | |
let sections[s:default_section] = {} | |
let current_section = s:default_section | |
for line in split(a:ini, '\v%(\r?\n)+') | |
let record = s:parse_record(line) | |
if record.type ==# 'section' | |
let current_section = record.name | |
let sections[current_section] = get(sections, current_section, {}) | |
elseif record.type ==# 'parameter' | |
let sections[current_section][record.key] = record.value | |
elseif record.type ==# 'unknown' && !fail_silently | |
throw 'vital: Text.INI: Parsing a record failed: ' . record.value | |
endif | |
endfor | |
return sections | |
endfunction | |
1 0.000008 function! s:parse_file(file, ...) abort | |
let fail_silently = get(a:000, 0, 1) | |
return s:parse(join(readfile(a:file), "\n"), fail_silently) | |
endfunction | |
1 0.000026 let &cpo = s:save_cpo | |
1 0.000007 unlet s:save_cpo | |
"vim: sts=2 sw=2 smarttab et ai textwidth=0 fdm=marker | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/VCS/Git/Misc.vim | |
Sourced 1 time | |
Total time: 0.001098 | |
Self time: 0.001098 | |
count total (s) self (s) | |
"****************************************************************************** | |
" Git misc | |
" | |
" Author: Alisue <[email protected]> | |
" URL: http://hashnote.net/ | |
" License: MIT license | |
" (C) 2014, Alisue, hashnote.net | |
"****************************************************************************** | |
1 0.000028 let s:save_cpo = &cpo | |
1 0.000025 set cpo&vim | |
1 0.000011 function! s:_vital_loaded(V) dict abort " {{{ | |
let s:V = a:V | |
let s:Prelude = a:V.import('Prelude') | |
let s:Dict = a:V.import('Data.Dict') | |
let s:Core = a:V.import('VCS.Git.Core') | |
let s:StatusParser = a:V.import('VCS.Git.StatusParser') | |
let s:ConfigParser = a:V.import('VCS.Git.ConfigParser') | |
endfunction " }}} | |
1 0.000008 function! s:_vital_depends() abort " {{{ | |
return [ | |
\ 'Prelude', | |
\ 'Data.Dict', | |
\ 'VCS.Git.Core', | |
\ 'VCS.Git.StatusParser', | |
\ 'VCS.Git.ConfigParser', | |
\] | |
endfunction " }}} | |
1 0.000008 function! s:opts2args(opts, defaults) abort " {{{ | |
let args = [] | |
for [key, default] in items(a:defaults) | |
if has_key(a:opts, key) | |
let val = get(a:opts, key) | |
if s:Prelude.is_number(default) && val | |
if strlen(key) == 1 | |
call add(args, printf('-%s', key)) | |
else | |
call add(args, printf('--%s', substitute(key, '_', '-', 'g'))) | |
endif | |
elseif s:Prelude.is_string(default) && default =~# '\v^\=' | |
if (s:Prelude.is_number(val) && val == 1) | |
unlet! val | |
let val = default[1:] | |
endif | |
if strlen(key) == 1 | |
call add(args, printf('-%s%s', key, val)) | |
else | |
call add(args, printf('--%s=%s', substitute(key, '_', '-', 'g'), val)) | |
endif | |
elseif s:Prelude.is_string(default) && default !~# '\v^\=' && default !=# val | |
if strlen(key) == 1 | |
call add(args, printf('-%s', key)) | |
else | |
call add(args, printf('--%s', substitute(key, '_', '-', 'g'))) | |
endif | |
call add(args, val) | |
endif | |
unlet val | |
endif | |
unlet default | |
endfor | |
return args | |
endfunction " }}} | |
1 0.000008 function! s:get_parsed_status(...) " {{{ | |
let defs = { | |
\ 'branch': 0, | |
\ 'untracked_files': '=all', | |
\ 'ignore_submodules': '=all', | |
\ 'ignored': 0, | |
\ 'z': 0, | |
\} | |
let opts = get(a:000, 0, {}) | |
let args = ['status', '--porcelain'] + s:opts2args(opts, defs) | |
let result = s:Core.exec(args, s:Dict.omit(opts, keys(defs))) | |
if result.status != 0 | |
return result | |
endif | |
return s:StatusParser.parse(result.stdout, { 'fail_silently': 1 }) | |
endfunction " }}} | |
1 0.000008 function! s:get_parsed_commit(...) " {{{ | |
let defs = { | |
\ 'all': 0, | |
\ 'patch': 0, | |
\ 'reuse_message': '=', | |
\ 'reedit_message': '=', | |
\ 'fixup': '=', | |
\ 'squash': '=', | |
\ 'reset_author': 0, | |
\ 'short': 0, | |
\ 'z': 0, | |
\ 'file': '=', | |
\ 'author': '=', | |
\ 'date': '=', | |
\ 'message': '=', | |
\ 'template': '=', | |
\ 'signoff': 0, | |
\ 'no_verify': 0, | |
\ 'allow_empty': 0, | |
\ 'allow_empty_message': 0, | |
\ 'cleanup': '=default', | |
\ 'edit': 0, | |
\ 'amend': 0, | |
\ 'include': 0, | |
\ 'only': 0, | |
\ 'untracked_files': '=all', | |
\ 'verbose': 0, | |
\ 'quiet': 0, | |
\ 'status': 0, | |
\} | |
let opts = get(a:000, 0, {}) | |
let args = ['commit', '--dry-run', '--porcelain', '--no-status'] + s:opts2args(opts, defs) | |
let result = s:Core.exec(args, s:Dict.omit(opts, keys(defs))) | |
" Note: | |
" I'm not sure but apparently the exit status is 1 | |
if result.status != 1 | |
return result | |
endif | |
return s:StatusParser.parse(result.stdout, { 'fail_silently': 1 }) | |
endfunction " }}} | |
1 0.000008 function! s:get_parsed_config(...) " {{{ | |
let defs = { | |
\ 'local': 0, | |
\ 'global': 0, | |
\ 'system': 0, | |
\ 'file': '', | |
\ 'blob': '', | |
\ 'bool': 0, | |
\ 'int': 0, | |
\ 'bool_or_int': 0, | |
\ 'path': 0, | |
\ 'includes': 0, | |
\} | |
let opts = get(a:000, 0, {}) | |
let args = ['config', '--list'] + s:opts2args(opts, defs) | |
let result = s:Core.exec(args, s:Dict.omit(opts, keys(defs))) | |
if result.status != 0 | |
return result | |
endif | |
return s:ConfigParser.parse(result.stdout) | |
endfunction " }}} | |
1 0.000008 function! s:get_last_commitmsg(...) " {{{ | |
let opts = get(a:000, 0, {}) | |
let result = s:Core.exec(['log', '-1', '--pretty=%B'], opts) | |
if result.status == 0 | |
return split(result.stdout, '\v\r?\n') | |
else | |
return result | |
endif | |
endfunction " }}} | |
1 0.000009 function! s:count_commits_ahead_of_remote(...) " {{{ | |
let opts = get(a:000, 0, {}) | |
let result = s:Core.exec(['log', '--oneline', '@{upstream}..'], opts) | |
return result.status == 0 ? len(split(result.stdout, '\v%(\r?\n)')) : 0 | |
endfunction " }}} | |
1 0.000008 function! s:count_commits_behind_remote(...) " {{{ | |
let opts = get(a:000, 0, {}) | |
let result = s:Core.exec(['log', '--oneline', '..@{upstream}'], opts) | |
return result.status == 0 ? len(split(result.stdout, '\v%(\r?\n)')) : 0 | |
endfunction " }}} | |
1 0.000027 let &cpo = s:save_cpo | |
1 0.000007 unlet s:save_cpo | |
"vim: sts=2 sw=2 smarttabb et ai textwidth=0 fdm=marker | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/VCS/Git/StatusParser.vim | |
Sourced 1 time | |
Total time: 0.001098 | |
Self time: 0.001098 | |
count total (s) self (s) | |
"****************************************************************************** | |
" Git status (--porcelain) parser | |
" | |
" Author: Alisue <[email protected]> | |
" URL: http://hashnote.net/ | |
" License: MIT license | |
" | |
" (C) 2015, Alisue, hashnote.net | |
"****************************************************************************** | |
1 0.000030 let s:save_cpo = &cpo | |
1 0.000030 set cpo&vim | |
" Vital ====================================================================== | |
1 0.000007 let s:const = {} | |
1 0.000020 let s:const.status_patterns = [ | |
\ '\v^([ MDARCU\?!])([ MDUA\?!])\s("[^"]+"|[^ ]+)%(\s-\>\s("[^"]+"|[^ ]+)|)$', | |
\ '\v^([ MDARCU\?!])([ MDUA\?!])\s("[^"]+"|.+)$', | |
\] | |
1 0.000014 let s:const.header_patterns = [ | |
\ '\v^##\s([^.]+)\.\.\.([^ ]+).*$', | |
\ '\v^##\s([^ ]+).*$', | |
\] | |
1 0.000009 let s:const.conflicted_pattern = '\v^%(DD|AU|UD|UA|DU|AA|UU)$' | |
1 0.000009 let s:const.staged_pattern = '\v^%([MARC][ MD]|D[ M])$' | |
1 0.000009 let s:const.unstaged_pattern = '\v^%([ MARC][MD]|DM)$' | |
1 0.000008 let s:const.untracked_pattern = '\v^\?\?$' | |
1 0.000008 let s:const.ignored_pattern = '\v^!!$' | |
1 0.000011 function! s:_vital_loaded(V) dict abort | |
" define constant variables | |
call extend(self, s:const) | |
endfunction | |
1 0.000008 function! s:parse_record(line, ...) abort " {{{ | |
let opts = extend({ | |
\ 'fail_silently': 0, | |
\}, get(a:000, 0, {})) | |
for pattern in s:const.status_patterns | |
let m = matchlist(a:line, pattern) | |
let result = {} | |
if len(m) > 5 && m[4] !=# '' | |
" 'XY PATH1 -> PATH2' pattern | |
let result.index = m[1] | |
let result.worktree = m[2] | |
let result.path = substitute(m[3], '\v%(^"|"$)', '', 'g') | |
let result.path2 = substitute(m[4], '\v%(^"|"$)', '', 'g') | |
let result.record = a:line | |
let result.sign = m[1] . m[2] | |
let result.is_conflicted = s:is_conflicted(result.sign) | |
let result.is_staged = s:is_staged(result.sign) | |
let result.is_unstaged = s:is_unstaged(result.sign) | |
let result.is_untracked = s:is_untracked(result.sign) | |
let result.is_ignored = s:is_ignored(result.sign) | |
return result | |
elseif len(m) > 4 && m[3] !=# '' | |
" 'XY PATH' pattern | |
let result.index = m[1] | |
let result.worktree = m[2] | |
let result.path = substitute(m[3], '\v%(^"|"$)', '', 'g') | |
let result.record = a:line | |
let result.sign = m[1] . m[2] | |
let result.is_conflicted = s:is_conflicted(result.sign) | |
let result.is_staged = s:is_staged(result.sign) | |
let result.is_unstaged = s:is_unstaged(result.sign) | |
let result.is_untracked = s:is_untracked(result.sign) | |
let result.is_ignored = s:is_ignored(result.sign) | |
return result | |
endif | |
endfor | |
for pattern in s:const.header_patterns | |
let m = matchlist(a:line, pattern) | |
if len(m) > 2 && m[1] !=# '' | |
return { | |
\ 'current_branch': m[1], | |
\ 'remote_branch': m[2], | |
\} | |
elseif len(m) > 1 && m[0] !=# '' | |
return { | |
\ 'current_branch': m[1], | |
\ 'remote_branch': '', | |
\} | |
endif | |
endfor | |
if opts.fail_silently | |
return {} | |
endif | |
throw printf('vital: VCS.Git.StatusParser: Parsing a record failed: "%s"', a:line) | |
endfunction " }}} | |
1 0.000008 function! s:parse(status, ...) abort " {{{ | |
let opts = extend({ | |
\ 'fail_silently': 0, | |
\}, get(a:000, 0, {})) | |
let obj = { | |
\ 'all': [], | |
\ 'conflicted': [], | |
\ 'staged': [], | |
\ 'unstaged': [], | |
\ 'untracked': [], | |
\ 'ignored': [], | |
\} | |
for line in split(a:status, '\v%(\r?\n)+') | |
let result = s:parse_record(line, opts) | |
if empty(result) && opts.fail_silently | |
continue | |
elseif has_key(result, 'current_branch') | |
let obj.current_branch = result.current_branch | |
let obj.remote_branch = result.remote_branch | |
else | |
call add(obj.all, result) | |
if result.is_conflicted | |
call add(obj.conflicted, result) | |
elseif result.is_staged && result.is_unstaged | |
call add(obj.staged, result) | |
call add(obj.unstaged, result) | |
elseif result.is_staged | |
call add(obj.staged, result) | |
elseif result.is_unstaged | |
call add(obj.unstaged, result) | |
elseif result.is_untracked | |
call add(obj.untracked, result) | |
elseif result.is_ignored | |
call add(obj.ignored, result) | |
endif | |
endif | |
endfor | |
return obj | |
endfunction " }}} | |
1 0.000008 function! s:is_conflicted(sign) " {{{ | |
return a:sign =~# s:const.conflicted_pattern | |
endfunction " }}} | |
1 0.000007 function! s:is_staged(sign) " {{{ | |
return a:sign =~# s:const.staged_pattern | |
endfunction " }}} | |
1 0.000007 function! s:is_unstaged(sign) " {{{ | |
return a:sign =~# s:const.unstaged_pattern | |
endfunction " }}} | |
1 0.000007 function! s:is_untracked(sign) " {{{ | |
return a:sign =~# s:const.untracked_pattern | |
endfunction " }}} | |
1 0.000007 function! s:is_ignored(sign) " {{{ | |
return a:sign =~# s:const.ignored_pattern | |
endfunction " }}} | |
1 0.000027 let &cpo = s:save_cpo | |
1 0.000007 unlet s:save_cpo | |
"vim: sts=2 sw=2 smarttab et ai textwidth=0 fdm=marker | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/VCS/Git/ConfigParser.vim | |
Sourced 1 time | |
Total time: 0.000617 | |
Self time: 0.000617 | |
count total (s) self (s) | |
"****************************************************************************** | |
" Git config parser (parser for 'git config --local -l') | |
" | |
" Author: Alisue <[email protected]> | |
" URL: http://hashnote.net/ | |
" License: MIT license | |
" (C) 2014, Alisue, hashnote.net | |
"****************************************************************************** | |
1 0.000028 let s:save_cpo = &cpo | |
1 0.000026 set cpo&vim | |
1 0.000009 let s:parameter_pattern = '\v^([^\=]+)\=(.*)$' | |
1 0.000013 function! s:_make_nested_dict(keys, value) abort | |
if len(a:keys) == 1 | |
return {a:keys[0]: a:value} | |
else | |
return {a:keys[0]: s:_make_nested_dict(a:keys[1:], a:value)} | |
endif | |
endfunction | |
1 0.000010 function! s:_extend_nested_dict(expr1, expr2) abort | |
let expr1 = deepcopy(a:expr1) | |
for [key, value] in items(a:expr2) | |
if has_key(expr1, key) | |
if type(value) == 4 && type(expr1[key]) == 4 | |
let expr1[key] = s:_extend_nested_dict(expr1[key], value) | |
else | |
let expr1[key] = value | |
endif | |
else | |
let expr1[key] = value | |
endif | |
endfor | |
return expr1 | |
endfunction | |
1 0.000008 function! s:parse_record(line) abort | |
let m = matchlist(a:line, s:parameter_pattern) | |
if len(m) < 3 | |
throw 'vital: VCS.Git.ConfigParser: Parsing a record failed: ' . a:line | |
endif | |
" create a nested object | |
let keys = split(m[1], '\.') | |
let value = m[2] | |
return s:_make_nested_dict(keys, value) | |
endfunction | |
1 0.000006 function! s:parse(config) abort | |
let obj = {} | |
for line in split(a:config, '\v%(\r?\n)+') | |
let obj = s:_extend_nested_dict(obj, s:parse_record(line)) | |
endfor | |
return obj | |
endfunction | |
1 0.000027 let &cpo = s:save_cpo | |
1 0.000007 unlet s:save_cpo | |
"vim: sts=2 sw=2 smarttabb et ai textwidth=0 fdm=marker | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/VCS/Git/Finder.vim | |
Sourced 1 time | |
Total time: 0.000403 | |
Self time: 0.000403 | |
count total (s) self (s) | |
"****************************************************************************** | |
" Git repository finder which use file based cache system to improve response | |
" | |
" Author: Alisue <[email protected]> | |
" URL: http://hashnote.net/ | |
" License: MIT license | |
" (C) 2014, Alisue, hashnote.net | |
"****************************************************************************** | |
1 0.000030 let s:save_cpo = &cpo | |
1 0.000026 set cpo&vim | |
1 0.000012 function! s:_vital_loaded(V) dict abort " {{{ | |
let s:V = a:V | |
let s:Prelude = a:V.import('Prelude') | |
let s:Path = a:V.import('System.Filepath') | |
let s:Core = a:V.import('VCS.Git.Core') | |
endfunction " }}} | |
1 0.000007 function! s:_vital_depends() abort " {{{ | |
return [ | |
\ 'Prelude', | |
\ 'System.Filepath', | |
\ 'VCS.Git.Core', | |
\] | |
endfunction " }}} | |
1 0.000007 let s:finder = {} | |
1 0.000007 function! s:finder.find(path, ...) abort " {{{ | |
let options = extend({ 'no_cache': 0 }, get(a:000, 0, {})) | |
let abspath = s:Prelude.path2directory(fnamemodify(a:path, ':p')) | |
let metainfo = self.cache.get(abspath, {}) | |
if !empty(metainfo) && metainfo.path == abspath && !options.no_cache | |
if strlen(metainfo.worktree) | |
return { 'worktree': metainfo.worktree, 'repository': metainfo.repository } | |
else | |
return {} | |
endif | |
endif | |
let worktree = s:Core.find_worktree(abspath) | |
let repository = strlen(worktree) ? s:Core.find_repository(worktree) : '' | |
let metainfo = { | |
\ 'path': abspath, | |
\ 'worktree': worktree, | |
\ 'repository': repository, | |
\} | |
call self.cache.set(abspath, metainfo) | |
if strlen(metainfo.worktree) | |
return { 'worktree': metainfo.worktree, 'repository': metainfo.repository } | |
else | |
return {} | |
endif | |
endfunction " }}} | |
1 0.000006 function! s:finder.clear() abort " {{{ | |
call self.cache.clear() | |
endfunction " }}} | |
1 0.000006 function! s:finder.gc() abort " {{{ | |
let opts = extend({ | |
\ 'verbose': 1, | |
\}, get(a:000, 0, {})) | |
let keys = self.cache.keys() | |
let n = len(keys) | |
let c = 1 | |
for key in keys | |
let metainfo = self.cache.get(key) | |
if isdirectory(metainfo.path) | |
let metainfo.worktree = s:Core.find_worktree(metainfo.path) | |
let metainfo.repository = s:Core.find_repository(metainfo.worktree) | |
if opts.verbose | |
redraw | |
echomsg printf("%d/%d: '%s' is a %s", | |
\ c, n, metainfo.path, | |
\ strlen(metainfo.worktree) ? 'worktree' : 'not worktree', | |
\) | |
endif | |
call self.cache.set(key, metainfo) | |
else | |
" missing path | |
call self.cache.remove(key) | |
if opts.verbose | |
redraw | |
echomsg printf("%d/%d: '%s' is missing", | |
\ c, n, metainfo.path, | |
\) | |
endif | |
endif | |
let c += 1 | |
endfor | |
endfunction " }}} | |
1 0.000007 function! s:new(cache) abort " {{{ | |
" validate cache instance | |
let required_methods = ['get', 'set', 'keys', 'remove', 'clear'] | |
for method in required_methods | |
if !has_key(a:cache, method) | |
throw "VCS.Git.Finder: the cache instance does not have required method." | |
endif | |
endfor | |
return extend(deepcopy(s:finder), { 'cache': a:cache }) | |
endfunction " }}} | |
1 0.000023 let &cpo = s:save_cpo | |
1 0.000006 unlet s:save_cpo | |
"vim: sts=2 sw=2 smarttabb et ai textwidth=0 fdm=marker | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/gita/interface/status.vim | |
Sourced 1 time | |
Total time: 0.054674 | |
Self time: 0.002999 | |
count total (s) self (s) | |
"****************************************************************************** | |
" vim-gita interface/status | |
" | |
" Author: Alisue <[email protected]> | |
" URL: http://hashnote.net/ | |
" License: MIT license | |
" (C) 2015, Alisue, hashnote.net | |
"****************************************************************************** | |
1 0.000031 let s:save_cpo = &cpo | |
1 0.000029 set cpo&vim | |
1 0.000007 let s:const = {} | |
1 0.000015 let s:const.bufname = has('unix') ? 'gita:status' : 'gita_status' | |
1 0.000008 let s:const.filetype = 'gita-status' | |
1 0.000082 0.000019 let s:Prelude = gita#util#import('Prelude') | |
1 0.000071 0.000018 let s:List = gita#util#import('Data.List') | |
1 0.051580 0.000021 let s:Conflict = gita#util#import('VCS.Git.Conflict') | |
1 0.000011 function! s:ensure_list(x) abort " {{{ | |
return s:Prelude.is_list(a:x) ? a:x : [a:x] | |
endfunction " }}} | |
1 0.000007 function! s:get_gita(...) abort " {{{ | |
let gita = call('gita#get', a:000) | |
let gita.interface = get(gita, 'interface', {}) | |
let gita.interface.status = get(gita.interface, 'status', {}) | |
return gita | |
endfunction " }}} | |
1 0.000007 function! s:get_selected_status() abort " {{{ | |
let gita = s:get_gita() | |
let statuses_map = get(gita.interface.status, 'statuses_map', {}) | |
let selected_line = getline('.') | |
return get(statuses_map, selected_line, {}) | |
endfunction " }}} | |
1 0.000007 function! s:get_selected_statuses() abort " {{{ | |
let gita = s:get_gita() | |
let statuses_map = get(gita.interface.status, 'statuses_map', {}) | |
let selected_lines = getline(getpos("'<")[1], getpos("'>")[1]) | |
let selected_statuses = [] | |
for selected_line in selected_lines | |
let status = get(statuses_map, selected_line, {}) | |
if !empty(status) | |
call add(selected_statuses, status) | |
endif | |
endfor | |
return selected_statuses | |
endfunction " }}} | |
1 0.000006 function! s:get_help(about) abort " {{{ | |
let varname = printf('_help_%s', a:about) | |
if get(b:, varname, 0) | |
return gita#util#interface_get_help(a:about) | |
else | |
return [] | |
endif | |
endfunction " }}} | |
1 0.000007 function! s:smart_map(lhs, rhs) abort " {{{ | |
return empty(s:get_selected_status()) ? a:lhs : a:rhs | |
endfunction " }}} | |
1 0.000007 function! s:validate_filetype(name) abort " {{{ | |
if &filetype !=# s:const.filetype | |
call gita#util#error( | |
\ printf('%s required to be called on %s buffer', a:name, s:const.bufname), | |
\ 'FileType miss match', | |
\) | |
return 1 | |
endif | |
return 0 | |
endfunction " }}} | |
1 0.000008 function! s:validate_status_add(status, options) abort " {{{ | |
if a:status.is_unstaged || a:status.is_untracked | |
return 0 | |
elseif a:status.is_ignored && get(a:options, 'force', 0) | |
return 0 | |
elseif a:status.is_ignored | |
call gita#util#info(printf( | |
\ 'An ignored file "%s" cannot be added. Use <Plug>(gita-action-ADD) instead.', | |
\ a:status.path, | |
\)) | |
return 1 | |
elseif a:status.is_conflicted | |
if a:status.sign ==# 'DD' | |
call gita#util#error(printf( | |
\ 'A both deleted conflict file "%s" cannot be added. Use <Plug>(gita-action-rm) instead.', | |
\ a:status.path, | |
\)) | |
return 1 | |
else | |
return 0 | |
endif | |
else | |
call gita#util#info(printf( | |
\ 'No changes of "%s" exist on working tree.', | |
\ a:status.path, | |
\)) | |
return 1 | |
endif | |
endfunction " }}} | |
1 0.000008 function! s:validate_status_rm(status, options) abort " {{{ | |
if (a:status.is_staged || a:status.is_unstaged) && a:status.worktree ==# 'D' | |
" already removed from filesystem | |
return 0 | |
elseif a:status.is_staged || a:status.is_unstaged | |
if get(a:options, 'force', 0) | |
return 0 | |
else | |
call gita#util#info(printf( | |
\ 'A file "%s" has changes and cannot be deleted. Use <Plug>(gita-action-RM) instead.', | |
\ a:status.path, | |
\)) | |
return 1 | |
endif | |
elseif a:status.is_untracked || a:status.is_ignored | |
call gita#util#info(printf( | |
\ 'An untracked/ignored file "%s" cannot be deleted.', | |
\ a:status.path, | |
\)) | |
return 1 | |
elseif a:status.is_conflicted | |
if a:status.sign ==# 'AU' | |
call gita#util#error(printf( | |
\ 'A added by us conflict file "%s" cannot be deleted. Use <Plug>(git-action-add) instead.', | |
\ a:status.path, | |
\)) | |
return 1 | |
elseif a:status.sign ==# 'UA' | |
call gita#util#error(printf( | |
\ 'A added by them conflict file "%s" cannot be deleted. Use <Plug>(git-action-add) instead.', | |
\ a:status.path, | |
\)) | |
return 1 | |
elseif a:status.sign ==# 'AA' | |
call gita#util#error(printf( | |
\ 'A both added conflict file "%s" cannot be deleted. Use <Plug>(git-action-add) instead.', | |
\ a:status.path, | |
\)) | |
return 1 | |
elseif a:status.sign ==# 'UU' | |
call gita#util#error(printf( | |
\ 'A both modified conflict file "%s" cannot be deleted. Use <Plug>(git-action-add) instead.', | |
\ a:status.path, | |
\)) | |
return 1 | |
else | |
return 0 | |
endif | |
else | |
" it should not be called | |
call gita#util#error(printf( | |
\ 'An unexpected pattern "%s" is called for "rm". Report it as an issue on GitHub.', | |
\ a:status.sign, | |
\)) | |
return 1 | |
endif | |
endfunction " }}} | |
1 0.000009 function! s:validate_status_reset(status, options) abort " {{{ | |
if a:status.is_staged | |
return 0 | |
elseif a:status.is_untracked || a:status.is_ignored | |
call gita#util#info(printf( | |
\ 'An untracked/ignored file "%s" cannot be reset.', | |
\ a:status.path, | |
\)) | |
return 1 | |
elseif a:status.is_conflicted | |
call gita#util#error(printf( | |
\ 'A conflicted file "%s" cannot be reset. ', | |
\ a:status.path, | |
\)) | |
return 1 | |
else | |
call gita#util#info(printf( | |
\ 'No changes of "%s" exist on index.', | |
\ a:status.path, | |
\)) | |
return 1 | |
endif | |
endfunction " }}} | |
1 0.000009 function! s:validate_status_checkout(status, options) abort " {{{ | |
if a:status.is_unstaged | |
if get(a:options, 'force', 0) | |
return 0 | |
else | |
call gita#util#info(printf( | |
\ 'A file "%s" has unstaged changes. Use <Plug>(gita-action-CHECKOUT) instead.', | |
\ a:status.path, | |
\)) | |
return 1 | |
endif | |
elseif a:status.is_untracked || a:status.is_ignored | |
call gita#util#info(printf( | |
\ 'An untracked/ignored file "%s" cannot be checked out.', | |
\ a:status.path, | |
\)) | |
return 1 | |
elseif a:status.is_conflicted | |
call gita#util#error(printf( | |
\ 'A conflicted file "%s" cannot be checked out. Use <Plug>(gita-action-ours) or <Plug>(gita-action-theirs) instead.', | |
\ a:status.path, | |
\)) | |
return 1 | |
else | |
return 0 | |
endif | |
endfunction " }}} | |
1 0.000009 function! s:validate_status_ours(status, options) abort " {{{ | |
if !a:status.is_conflicted | |
call gita#util#info(printf( | |
\ 'No ours version of a non conflicted file "%s" is available. Use <Plug>(gita-action-checkout) instead.', | |
\ a:status.path, | |
\)) | |
return 1 | |
else | |
if a:status.sign ==# 'DD' | |
call gita#util#info(printf( | |
\ 'No ours version of a both deleted conflict file "%s" is available. Use <Plug>(gita-action-rm) instead.', | |
\ a:status.path, | |
\)) | |
return 1 | |
elseif a:status.sign ==# 'DU' | |
call gita#util#info(printf( | |
\ 'No ours version of a deleted by us conflict file "%s" is available. Use <Plug>(gita-action-add) or <Plug>(gita-action-rm) instead.', | |
\ a:status.path, | |
\)) | |
return 1 | |
else | |
return 0 | |
endif | |
endif | |
endfunction " }}} | |
1 0.000009 function! s:validate_status_theirs(status, options) abort " {{{ | |
if !a:status.is_conflicted | |
call gita#util#info(printf( | |
\ 'No theirs version of a non conflicted file "%s" is available. Use <Plug>(gita-action-checkout) instead.', | |
\ a:status.path, | |
\)) | |
return 1 | |
else | |
if a:status.sign ==# 'DD' | |
call gita#util#info(printf( | |
\ 'No theirs version of a both deleted conflict file "%s" is available. Use <Plug>(gita-action-rm) instead.', | |
\ a:status.path, | |
\)) | |
return 1 | |
elseif a:status.sign ==# 'UD' | |
call gita#util#info(printf( | |
\ 'No theirs version of a deleted by them conflict file "%s" is available. Use <Plug>(gita-action-add) or <Plug>(gita-action-rm) instead.', | |
\ a:status.path, | |
\)) | |
return 1 | |
else | |
return 0 | |
endif | |
endif | |
endfunction " }}} | |
1 0.000010 function! s:validate_status_conflict(status, options) abort " {{{ | |
if !a:status.is_conflicted | |
call gita#util#info(printf( | |
\ 'A conflict action cannot be performed on a non conflicted file "%s".', | |
\ a:status.path, | |
\)) | |
return 1 | |
else | |
if a:status.sign ==# 'DD' | |
call gita#util#info(printf( | |
\ 'A conflic action cannot be performed on a both deleted conflict file "%s".', | |
\ a:status.path, | |
\)) | |
return 1 | |
elseif a:status.sign ==# 'DU' | |
call gita#util#info(printf( | |
\ 'A conflic action cannot be performed on a deleted by us conflict file "%s".', | |
\ a:status.path, | |
\)) | |
return 1 | |
elseif a:status.sign ==# 'UD' | |
call gita#util#info(printf( | |
\ 'A conflic action cannot be performed on a deleted by them conflict file "%s".', | |
\ a:status.path, | |
\)) | |
return 1 | |
else | |
return 0 | |
endif | |
endif | |
endfunction " }}} | |
1 0.000007 function! s:action(name, ...) abort " {{{ | |
let multiple = get(a:000, 0, 0) | |
let options = get(a:000, 1, {}) | |
if s:Prelude.is_dict(multiple) | |
let options = multiple | |
unlet! multiple | let multiple = 0 | |
endif | |
let options = extend(deepcopy(b:_options), options) | |
if multiple | |
let statuses = s:get_selected_statuses() | |
let args = [statuses, options] | |
else | |
let status = s:get_selected_status() | |
let args = [status, options] | |
endif | |
call call(printf('s:action_%s', a:name), args) | |
endfunction " }}} | |
1 0.000008 function! s:action_help(status, options) abort " {{{ | |
let varname = printf('_help_%s', a:options.about) | |
let b:[varname] = !get(b:, varname, 0) | |
call s:update(a:options) | |
endfunction " }}} | |
1 0.000008 function! s:action_update(status, options) abort " {{{ | |
call s:update(a:options) | |
redraw! | |
endfunction " }}} | |
1 0.000008 function! s:action_open_commit(status, options) abort " {{{ | |
call gita#interface#commit#open(a:options) | |
endfunction " }}} | |
1 0.000008 function! s:action_open(status, options) abort " {{{ | |
let options = extend({ | |
\ 'opener': 'edit', | |
\}, a:options) | |
let bufname = bufname('%') | |
call gita#util#invoker_focus() | |
call gita#util#buffer_open( | |
\ get(a:status, 'path2', a:status.path), | |
\ options.opener | |
\) | |
" update invoker | |
call gita#util#invoker_set(gita#util#invoker_get(), bufname) | |
endfunction " }}} | |
1 0.000008 function! s:action_diff_open(status, options) abort " {{{ | |
let options = extend({ | |
\ 'opener': 'edit', | |
\}, a:options) | |
let bufname = bufname('%') | |
if !has_key(options, 'commit') | |
let commit = gita#util#ask('Checkout from: ', 'INDEX') | |
if strlen(commit) == 0 | |
redraw || call gita#util#warn('No valid commit was selected. The operation is canceled.') | |
return | |
endif | |
else | |
let commit = options.commit | |
endif | |
let commit = commit ==# 'INDEX' ? '' : commit | |
call gita#util#invoker_focus() | |
call gita#interface#diff#open(a:status, commit, options) | |
" update invoker | |
call gita#util#invoker_set(gita#util#invoker_get(), bufname) | |
endfunction " }}} | |
1 0.000009 function! s:action_diff_compare(status, options) abort " {{{ | |
let options = extend({}, a:options) | |
if !has_key(options, 'commit') | |
let commit = gita#util#ask('Checkout from: ', 'INDEX') | |
if strlen(commit) == 0 | |
redraw || call gita#util#warn('No valid commit was selected. The operation is canceled.') | |
return | |
endif | |
else | |
let commit = options.commit | |
endif | |
let commit = commit ==# 'INDEX' ? '' : commit | |
call gita#util#invoker_focus() | |
call gita#interface#diff#compare(a:status, commit, options) | |
endfunction " }}} | |
1 0.000008 function! s:action_solve2(status, options) abort " {{{ | |
let options = extend({ | |
\ 'opener': 'edit', | |
\}, a:options) | |
if s:validate_status_conflict(a:status, options) | |
return | |
endif | |
call gita#util#invoker_focus() | |
call gita#interface#conflict#open2(a:status, options) | |
endfunction " }}} | |
1 0.000008 function! s:action_solve3(status, options) abort " {{{ | |
let options = extend({ | |
\ 'opener': 'edit', | |
\}, a:options) | |
if s:validate_status_conflict(a:status, options) | |
return | |
endif | |
call gita#util#invoker_focus() | |
call gita#interface#conflict#open3(a:status, options) | |
endfunction " }}} | |
1 0.000008 function! s:action_add(statuses, options) abort " {{{ | |
let statuses = s:ensure_list(a:statuses) | |
let options = extend({ 'force': 0 }, a:options) | |
let valid_statuses = [] | |
for status in statuses | |
if s:validate_status_add(status, options) | |
continue | |
endif | |
call add(valid_statuses, status) | |
endfor | |
if empty(valid_statuses) | |
if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( | |
\ 'No valid files were selected for add action', | |
\) | |
endif | |
return | |
endif | |
let result = s:get_gita().git.add(options, map(valid_statuses, 'v:val.path')) | |
if result.status | |
call gita#util#error( | |
\ result.stdout, | |
\ printf('Fail: %s', join(result.args)), | |
\) | |
else | |
call gita#util#doautocmd('add-post') | |
endif | |
call s:update() | |
endfunction " }}} | |
1 0.000008 function! s:action_rm(statuses, options) abort " {{{ | |
let statuses = s:ensure_list(a:statuses) | |
let options = extend({ 'force': 0 }, a:options) | |
let valid_statuses = [] | |
for status in statuses | |
if s:validate_status_rm(status, options) | |
continue | |
endif | |
call add(valid_statuses, status) | |
endfor | |
if empty(valid_statuses) | |
if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( | |
\ 'No valid files were selected for rm action', | |
\) | |
endif | |
return | |
endif | |
let result = s:get_gita().git.rm(options, map(valid_statuses, 'v:val.path')) | |
if result.status | |
call gita#util#error( | |
\ result.stdout, | |
\ printf('Fail: %s', join(result.args)), | |
\) | |
else | |
call gita#util#doautocmd('rm-post') | |
endif | |
call s:update() | |
endfunction " }}} | |
1 0.000008 function! s:action_reset(statuses, options) abort " {{{ | |
let statuses = s:ensure_list(a:statuses) | |
let options = extend({ | |
\ 'quiet': 1, | |
\ }, a:options) | |
let valid_statuses = [] | |
for status in statuses | |
if s:validate_status_reset(status, options) | |
continue | |
endif | |
call add(valid_statuses, status) | |
endfor | |
if empty(valid_statuses) | |
if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( | |
\ 'No valid files were selected for reset action', | |
\) | |
endif | |
return | |
endif | |
let result = s:get_gita().git.reset(options, '', map(valid_statuses, 'v:val.path')) | |
if result.status | |
call gita#util#error( | |
\ result.stdout, | |
\ printf('Fail: %s', join(result.args)), | |
\) | |
else | |
call gita#util#doautocmd('reset-post') | |
endif | |
call s:update() | |
endfunction " }}} | |
1 0.000008 function! s:action_checkout(statuses, options) abort " {{{ | |
let statuses = s:ensure_list(a:statuses) | |
let options = extend({}, a:options) | |
if !has_key(options, 'commit') | |
let commit = gita#util#ask('Checkout from: ', 'INDEX') | |
if strlen(commit) == 0 | |
redraw || call gita#util#warn('No valid commit was selected. The operation is canceled.') | |
return | |
endif | |
else | |
let commit = options.commit | |
endif | |
let commit = commit ==# 'INDEX' ? '' : commit | |
let valid_statuses = [] | |
for status in statuses | |
if s:validate_status_checkout(status, options) | |
continue | |
endif | |
call add(valid_statuses, status) | |
endfor | |
if empty(valid_statuses) | |
if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( | |
\ 'No valid files were selected for checkout action', | |
\) | |
endif | |
return | |
endif | |
let result = s:get_gita().git.checkout(options, commit, map(valid_statuses, 'v:val.path')) | |
if result.status == 0 | |
call gita#util#doautocmd('checkout-post') | |
else | |
call gita#util#error( | |
\ result.stdout, | |
\ printf('Fail: %s', join(result.args)), | |
\) | |
endif | |
call s:update() | |
endfunction " }}} | |
1 0.000008 function! s:action_ours(statuses, options) abort " {{{ | |
let statuses = s:ensure_list(a:statuses) | |
let options = extend({}, a:options) | |
let options.ours = 1 | |
let valid_statuses = [] | |
for status in statuses | |
if s:validate_status_ours(status, options) | |
continue | |
endif | |
call add(valid_statuses, status) | |
endfor | |
if empty(valid_statuses) | |
if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( | |
\ 'No valid files were selected for ours action', | |
\) | |
endif | |
return | |
endif | |
let result = s:get_gita().git.checkout(options, '', map(valid_statuses, 'v:val.path')) | |
if result.status == 0 | |
call gita#util#doautocmd('checkout-post') | |
else | |
call gita#util#error( | |
\ result.stdout, | |
\ printf('Fail: %s', join(result.args)), | |
\) | |
endif | |
call s:update() | |
endfunction " }}} | |
1 0.000009 function! s:action_theirs(statuses, options) abort " {{{ | |
let statuses = s:ensure_list(a:statuses) | |
let options = extend({}, a:options) | |
let options.theirs = 1 | |
let valid_statuses = [] | |
for status in statuses | |
if s:validate_status_theirs(status, options) | |
continue | |
endif | |
call add(valid_statuses, status) | |
endfor | |
if empty(valid_statuses) | |
if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( | |
\ 'No valid files were selected for ours action', | |
\) | |
endif | |
return | |
endif | |
let result = s:get_gita().git.checkout(options, '', map(valid_statuses, 'v:val.path')) | |
if result.status == 0 | |
call gita#util#doautocmd('checkout-post') | |
else | |
call gita#util#error( | |
\ result.stdout, | |
\ printf('Fail: %s', join(result.args)), | |
\) | |
endif | |
call s:update() | |
endfunction " }}} | |
1 0.000008 function! s:action_stage(statuses, options) abort " {{{ | |
let statuses = s:ensure_list(a:statuses) | |
let options = extend({ | |
\ 'force': 0, | |
\}, a:options) | |
let add_statuses = [] | |
let rm_statuses = [] | |
for status in statuses | |
if status.is_conflicted | |
call gita#util#info(printf(join([ | |
\ 'A conflicted file "%s" cannot be staged.', | |
\ 'Use <Plug>(gita-action-add) or <Plug>(gita-action-rm) instead.', | |
\ ]), status.path) | |
\) | |
continue | |
elseif status.is_unstaged && status.worktree ==# 'D' | |
call add(rm_statuses, status) | |
else | |
if s:validate_status_add(status, options) | |
continue | |
endif | |
call add(add_statuses, status) | |
endif | |
endfor | |
if empty(add_statuses) && empty(rm_statuses) | |
if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( | |
\ 'No valid files were selected for stage action', | |
\) | |
endif | |
return | |
endif | |
let options.ignore_empty_warning = 1 | |
call s:action_add(add_statuses, options) | |
call s:action_rm(rm_statuses, options) | |
call s:update() | |
endfunction " }}} | |
1 0.000008 function! s:action_unstage(statuses, options) abort " {{{ | |
call s:action_reset(a:statuses, a:options) | |
endfunction " }}} | |
1 0.000008 function! s:action_toggle(statuses, options) abort " {{{ | |
let statuses = s:ensure_list(a:statuses) | |
let options = extend({ | |
\ 'force': 0, | |
\}, a:options) | |
let stage_statuses = [] | |
let unstage_statuses = [] | |
for status in statuses | |
if status.is_conflicted | |
call gita#util#info(printf(join([ | |
\ 'A conflicted file "%s" cannot be toggle.', | |
\ 'Use <Plug>(gita-action-add) or <Plug>(gita-action-rm) instead.', | |
\ ]), status.path) | |
\) | |
continue | |
elseif status.is_staged && status.is_unstaged | |
if get(g:, 'gita#interface#status#action_prefer_unstage', 0) | |
call add(stage_statuses, status) | |
else | |
call add(unstage_statuses, status) | |
endif | |
elseif status.is_staged | |
call add(unstage_statuses, status) | |
elseif status.is_untracked || status.is_unstaged || status.is_ignored | |
call add(stage_statuses, status) | |
endif | |
endfor | |
if empty(stage_statuses) && empty(unstage_statuses) | |
if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( | |
\ 'No valid files were selected for toggle action', | |
\) | |
endif | |
return | |
endif | |
let options.ignore_empty_warning = 1 | |
call s:action_stage(stage_statuses, options) | |
call s:action_unstage(unstage_statuses, options) | |
call s:update() | |
endfunction " }}} | |
1 0.000008 function! s:action_discard(statuses, options) abort " {{{ | |
let statuses = s:ensure_list(a:statuses) | |
let options = extend({ | |
\ 'confirm': 1, | |
\}, a:options) | |
let delete_statuses = [] | |
let checkout_statuses = [] | |
for status in statuses | |
if status.is_untracked || status.is_ignored | |
call add(delete_statuses, status) | |
elseif status.is_staged || status.is_unstaged | |
call add(checkout_statuses, status) | |
else | |
" conflicted | |
call gita#util#info( | |
\ printf('A discard action cannot be performed on a conflicted file "%s".', status.path) | |
\) | |
continue | |
endif | |
endfor | |
if empty(delete_statuses) && empty(checkout_statuses) | |
if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( | |
\ 'No valid files were selected for discard action', | |
\) | |
endif | |
return | |
endif | |
if get(options, 'confirm', 1) | |
call gita#util#warn(join([ | |
\ 'A discard action will discard all local changes on working tree', | |
\ 'and the operation is irreversible, mean that you have no chance', | |
\ 'to revert the operation.', | |
\])) | |
if !gita#util#asktf('Are you sure you want to discard the changes?') | |
call gita#util#info( | |
\ 'The operation has canceled by user.' | |
\) | |
return | |
endif | |
endif | |
for status in delete_statuses | |
call delete(get(status, 'path2', status.path)) | |
endfor | |
let options.ignore_empty_warning = 1 | |
let options.commit = 'INDEX' | |
let options.force = 1 | |
call s:action_checkout(checkout_statuses, options) | |
call s:update() | |
endfunction " }}} | |
1 0.000006 function! s:open(...) abort " {{{ | |
let gita = s:get_gita() | |
let invoker = gita#util#invoker_get() | |
let options = extend(get(b:, 'options', {}), get(a:000, 0, {})) | |
if !gita.enabled | |
redraw | call gita#util#info( | |
\ printf( | |
\ 'Git is not available in the current buffer "%s".', | |
\ bufname('%') | |
\)) | |
return | |
endif | |
call gita#util#interface_open(s:const.bufname, 'support_window', { | |
\ 'opener': 'topleft 15 split', | |
\ 'range': 'tabpage', | |
\}) | |
silent execute 'setlocal filetype=' . s:const.filetype | |
let b:_gita = gita | |
let b:_invoker = invoker | |
let b:_options = options | |
" check if construction is required | |
if exists('b:_constructed') && !get(g:, 'gita#debug', 0) | |
" construction is not required. | |
call s:update() | |
return | |
endif | |
let b:_constructed = 1 | |
" construction | |
setlocal buftype=nofile bufhidden=hide noswapfile nobuflisted | |
setlocal winfixheight | |
setlocal cursorline | |
autocmd! * <buffer> | |
" Note: | |
" | |
" :wq : QuitPre > BufWriteCmd > WinLeave > BufWinLeave | |
" :q : QuitPre > WinLeave > BufWinLeave | |
" :e : BufWinLeave | |
" :wincmd w : WinLeave | |
" | |
" s:ac_quit need to be called after BufWriteCmd and only when closing a | |
" buffre window (not when :e, :wincmd w). | |
" That's why the following autocmd combination is required. | |
autocmd WinEnter <buffer> let b:_winleave = 0 | |
autocmd WinLeave <buffer> let b:_winleave = 1 | |
autocmd BufWinEnter <buffer> let b:_winleave = 0 | |
autocmd BufWinLeave <buffer> if get(b:, '_winleave', 0) | call s:ac_quit() | endif | |
" define mappings | |
call s:defmap() | |
" update contents | |
call s:update() | |
endfunction " }}} | |
1 0.000007 function! s:update(...) abort " {{{ | |
let gita = s:get_gita() | |
let options = extend(b:_options, extend( | |
\ get(g:, 'gita#interface#status#default_options', {}), | |
\ get(a:000, 0, {})) | |
\) | |
let result = gita.git.get_parsed_status( | |
\ extend({ 'no_cache': 1 }, options), | |
\) | |
if get(result, 'status', 0) | |
redraw | call gita#util#error( | |
\ result.stdout, | |
\ printf('Fail: %s', join(result.args)), | |
\) | |
return | |
endif | |
" create statuses lines & map | |
let statuses_map = {} | |
let statuses_lines = [] | |
for status in result.all | |
call add(statuses_lines, status.record) | |
let statuses_map[status.record] = status | |
endfor | |
let gita.interface.status.statuses_map = statuses_map | |
" create buffer lines | |
let buflines = s:List.flatten([ | |
\ ['# Press ?m and/or ?s to toggle a help of mapping and/or short format.'], | |
\ s:get_help('status_mapping'), | |
\ s:get_help('short_format'), | |
\ gita#util#interface_get_misc_lines(), | |
\ statuses_lines, | |
\ empty(statuses_map) ? ['Nothing to commit (Working tree is clean).'] : [], | |
\]) | |
" update content | |
setlocal modifiable | |
call gita#util#buffer_update(buflines) | |
setlocal nomodifiable | |
endfunction " }}} | |
1 0.000007 function! s:defmap() abort " {{{ | |
nnoremap <silent><buffer> <Plug>(gita-action-help-m) :<C-u>call <SID>action('help', { 'about': 'status_mapping' })<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-help-s) :<C-u>call <SID>action('help', { 'about': 'short_format' })<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-update) :<C-u>call <SID>action('update')<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-switch) :<C-u>call <SID>action('open_commit')<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-commit) :<C-u>call <SID>action('open_commit', { 'new': 1, 'amend': 0 })<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-commit-a) :<C-u>call <SID>action('open_commit', { 'new': 1, 'amend': 1 })<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-open) :<C-u>call <SID>action('open', { 'opener': 'edit' })<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-open-h) :<C-u>call <SID>action('open', { 'opener': 'botright split' })<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-open-v) :<C-u>call <SID>action('open', { 'opener': 'botright vsplit' })<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-diff) :<C-u>call <SID>action('diff_open', { 'opener': 'edit' })<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-diff-h) :<C-u>call <SID>action('diff_compare', { 'vertical': 0 })<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-diff-v) :<C-u>call <SID>action('diff_compare', { 'vertical': 1 })<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-solve2-h) :<C-u>call <SID>action('solve2', { 'vertical': 0 })<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-solve2-v) :<C-u>call <SID>action('solve2', { 'vertical': 1 })<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-solve3-h) :<C-u>call <SID>action('solve3', { 'vertical': 0 })<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-solve3-v) :<C-u>call <SID>action('solve3', { 'vertical': 1 })<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-add) :<C-u>call <SID>action('add')<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-ADD) :<C-u>call <SID>action('add', { 'force': 1 })<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-rm) :<C-u>call <SID>action('rm')<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-RM) :<C-u>call <SID>action('RM', { 'force': 1 })<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-reset) :<C-u>call <SID>action('reset')<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-checkout) :<C-u>call <SID>action('checkout')<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-CHECKOUT) :<C-u>call <SID>action('checkout', { 'force': 1 })<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-ours) :<C-u>call <SID>action('ours')<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-theirs) :<C-u>call <SID>action('theirs')<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-stage) :<C-u>call <SID>action('stage')<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-unstage) :<C-u>call <SID>action('unstage')<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-toggle) :<C-u>call <SID>action('toggle')<CR> | |
nnoremap <silent><buffer> <Plug>(gita-action-discard) :<C-u>call <SID>action('discard')<CR> | |
vnoremap <silent><buffer> <Plug>(gita-action-add) :<C-u>call <SID>action('add', 1)<CR> | |
vnoremap <silent><buffer> <Plug>(gita-action-ADD) :<C-u>call <SID>action('add', 1, { 'force': 1 })<CR> | |
vnoremap <silent><buffer> <Plug>(gita-action-rm) :<C-u>call <SID>action('rm', 1)<CR> | |
vnoremap <silent><buffer> <Plug>(gita-action-RM) :<C-u>call <SID>action('RM', 1, { 'force': 1 })<CR> | |
vnoremap <silent><buffer> <Plug>(gita-action-reset) :<C-u>call <SID>action('reset', 1)<CR> | |
vnoremap <silent><buffer> <Plug>(gita-action-checkout) :<C-u>call <SID>action('checkout', 1)<CR> | |
vnoremap <silent><buffer> <Plug>(gita-action-CHECKOUT) :<C-u>call <SID>action('checkout', 1, { 'force': 1 })<CR> | |
vnoremap <silent><buffer> <Plug>(gita-action-ours) :<C-u>call <SID>action('ours', 1)<CR> | |
vnoremap <silent><buffer> <Plug>(gita-action-theirs) :<C-u>call <SID>action('theirs', 1)<CR> | |
vnoremap <silent><buffer> <Plug>(gita-action-stage) :<C-u>call <SID>action('stage', 1)<CR> | |
vnoremap <silent><buffer> <Plug>(gita-action-unstage) :<C-u>call <SID>action('unstage', 1)<CR> | |
vnoremap <silent><buffer> <Plug>(gita-action-toggle) :<C-u>call <SID>action('toggle', 1)<CR> | |
vnoremap <silent><buffer> <Plug>(gita-action-discard) :<C-u>call <SID>action('discard', 1)<CR> | |
if get(g:, 'gita#interface#status#enable_default_keymap', 1) | |
nmap <buffer><silent> q :<C-u>quit<CR> | |
nmap <buffer> <C-l> <Plug>(gita-action-update) | |
nmap <buffer> ?m <Plug>(gita-action-help-m) | |
nmap <buffer> ?s <Plug>(gita-action-help-s) | |
nmap <buffer> cc <Plug>(gita-action-switch) | |
nmap <buffer> cC <Plug>(gita-action-commit) | |
nmap <buffer> cA <Plug>(gita-action-commit-a) | |
nmap <buffer><expr> e <SID>smart_map('e', '<Plug>(gita-action-open)') | |
nmap <buffer><expr> E <SID>smart_map('E', '<Plug>(gita-action-open-v)') | |
nmap <buffer><expr> d <SID>smart_map('d', '<Plug>(gita-action-diff)') | |
nmap <buffer><expr> D <SID>smart_map('D', '<Plug>(gita-action-diff-v)') | |
nmap <buffer><expr> s <SID>smart_map('s', '<Plug>(gita-action-solve2-v)') | |
nmap <buffer><expr> S <SID>smart_map('S', '<Plug>(gita-action-solve3-v)') | |
" operation | |
nmap <buffer><expr> << <SID>smart_map('<<', '<Plug>(gita-action-stage)') | |
nmap <buffer><expr> >> <SID>smart_map('>>', '<Plug>(gita-action-unstage)') | |
nmap <buffer><expr> -- <SID>smart_map('--', '<Plug>(gita-action-toggle)') | |
nmap <buffer><expr> == <SID>smart_map('==', '<Plug>(gita-action-discard)') | |
" raw operation | |
nmap <buffer><expr> -a <SID>smart_map('-a', '<Plug>(gita-action-add)') | |
nmap <buffer><expr> -A <SID>smart_map('-A', '<Plug>(gita-action-ADD)') | |
nmap <buffer><expr> -r <SID>smart_map('-r', '<Plug>(gita-action-reset)') | |
nmap <buffer><expr> -d <SID>smart_map('-d', '<Plug>(gita-action-rm)') | |
nmap <buffer><expr> -D <SID>smart_map('-D', '<Plug>(gita-action-RM)') | |
nmap <buffer><expr> -c <SID>smart_map('-c', '<Plug>(gita-action-checkout)') | |
nmap <buffer><expr> -C <SID>smart_map('-C', '<Plug>(gita-action-CHECKOUT)') | |
nmap <buffer><expr> -o <SID>smart_map('-o', '<Plug>(gita-action-ours)') | |
nmap <buffer><expr> -t <SID>smart_map('-t', '<Plug>(gita-action-theirs)') | |
vmap <buffer> << <Plug>(gita-action-stage) | |
vmap <buffer> >> <Plug>(gita-action-unstage) | |
vmap <buffer> -- <Plug>(gita-action-toggle) | |
vmap <buffer> == <Plug>(gita-action-discard) | |
vmap <buffer> -a <Plug>(gita-action-add) | |
vmap <buffer> -A <Plug>(gita-action-ADD) | |
vmap <buffer> -r <Plug>(gita-action-reset) | |
vmap <buffer> -d <Plug>(gita-action-rm) | |
vmap <buffer> -D <Plug>(gita-action-RM) | |
vmap <buffer> -c <Plug>(gita-action-checkout) | |
vmap <buffer> -C <Plug>(gita-action-CHECKOUT) | |
vmap <buffer> -o <Plug>(gita-action-ours) | |
vmap <buffer> -t <Plug>(gita-action-theirs) | |
endif | |
endfunction " }}} | |
1 0.000007 function! s:ac_quit() abort " {{{ | |
call gita#util#invoker_focus() | |
endfunction " }}} | |
" Private API | |
1 0.000017 function! gita#interface#status#define_highlights() abort " {{{ | |
highlight link GitaComment Comment | |
highlight link GitaConflicted Error | |
highlight link GitaUnstaged Constant | |
highlight link GitaStaged Special | |
highlight link GitaUntracked GitaUnstaged | |
highlight link GitaIgnored Identifier | |
highlight link GitaBranch Title | |
endfunction " }}} | |
1 0.000039 function! gita#interface#status#define_syntax() abort " {{{ | |
syntax match GitaStaged /\v^[ MADRC][ MD]/he=e-1 contains=ALL | |
syntax match GitaUnstaged /\v^[ MADRC][ MD]/hs=s+1 contains=ALL | |
syntax match GitaStaged /\v^[ MADRC]\s.*$/hs=s+3 contains=ALL | |
syntax match GitaUnstaged /\v^.[MDAU?].*$/hs=s+3 contains=ALL | |
syntax match GitaIgnored /\v^\!\!\s.*$/ | |
syntax match GitaUntracked /\v^\?\?\s.*$/ | |
syntax match GitaConflicted /\v^%(DD|AU|UD|UA|DU|AA|UU)\s.*$/ | |
syntax match GitaComment /\v^.*$/ contains=ALL | |
syntax match GitaBranch /\v`[^`]{-}`/hs=s+1,he=e-1 | |
endfunction " }}} | |
" Public API | |
1 0.000010 function! gita#interface#status#open(...) abort " {{{ | |
call call('s:open', a:000) | |
endfunction " }}} | |
1 0.000011 function! gita#interface#status#update(...) abort " {{{ | |
if bufname('%') !=# s:const.bufname | |
call call('s:open', a:000) | |
else | |
call call('s:update', a:000) | |
endif | |
endfunction " }}} | |
1 0.000011 function! gita#interface#status#action(name, ...) abort " {{{ | |
if s:validate_filetype('gita#interface#status#action()') | |
return | |
endif | |
call call('s:action', extend([a:name], a:000)) | |
endfunction " }}} | |
1 0.000015 function! gita#interface#status#smart_map(lhs, rhs) abort " {{{ | |
if s:validate_filetype('gita#interface#status#smart_map()') | |
return | |
endif | |
call call('s:smart_map', [a:lhs, a:rhs]) | |
endfunction " }}} | |
1 0.000011 function! gita#interface#status#get_selected_status() abort " {{{ | |
if s:validate_filetype('gita#interface#status#get_selected_status()') | |
return | |
endif | |
return call('s:get_selected_status', a:000) | |
endfunction " }}} | |
1 0.000012 function! gita#interface#status#get_selected_statuses() abort " {{{ | |
if s:validate_filetype('gita#interface#status#get_selected_statuses()') | |
return | |
endif | |
return call('s:get_selected_statuses', a:000) | |
endfunction " }}} | |
1 0.000038 let &cpo = s:save_cpo | |
1 0.000007 unlet! s:save_cpo | |
"vim: stts=2 sw=2 smarttab et ai textwidth=0 fdm=marker | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/VCS/Git/Conflict.vim | |
Sourced 1 time | |
Total time: 0.000503 | |
Self time: 0.000503 | |
count total (s) self (s) | |
"****************************************************************************** | |
" A parser for Git conflict markers | |
" | |
" Author: Alisue <[email protected]> | |
" URL: http://hashnote.net/ | |
" License: MIT license | |
" (C) 2015, Alisue, hashnote.net | |
"****************************************************************************** | |
1 0.000026 let s:save_cpo = &cpo | |
1 0.000030 set cpo&vim | |
1 0.000012 function! s:_vital_loaded(V) dict abort " {{{ | |
let s:P = a:V.import('Prelude') | |
let s:C = a:V.import('VCS.Git.Core') | |
let s:const = {} | |
let s:const.markers = {} | |
let s:const.markers.ours = repeat('\<', 7) | |
let s:const.markers.separator = repeat('\=', 7) | |
let s:const.markers.theirs = repeat('\>', 7) | |
let s:const.patterns = {} | |
let s:const.patterns.ours = printf('%s[^\n]{-}%(\n|$)', s:const.markers.ours) | |
let s:const.patterns.separator = printf('%s[^\n]{-}%(\n|$)', s:const.markers.separator) | |
let s:const.patterns.theirs = printf('%s[^\n]{-}%(\n|$)', s:const.markers.theirs) | |
lockvar s:const | |
let self.const = s:const | |
endfunction " }}} | |
1 0.000008 function! s:_vital_depends() abort " {{{ | |
return [ | |
\ 'Prelude', | |
\ 'VCS.Git.Core', | |
\] | |
endfunction " }}} | |
1 0.000008 function! s:has_ours_marker(buflines) " {{{ | |
let buflines = s:P.is_list(a:buflines) ? join(a:buflines, "\n") : a:buflines | |
return !empty(matchstr(buflines, '\v' . s:const.patterns.ours)) | |
endfunction " }}} | |
1 0.000008 function! s:has_theirs_marker(buflines) " {{{ | |
let buflines = s:P.is_list(a:buflines) ? join(a:buflines, "\n") : a:buflines | |
return !empty(matchstr(buflines, '\v' . s:const.patterns.theirs)) | |
endfunction " }}} | |
1 0.000008 function! s:has_conflict_marker(buflines) " {{{ | |
let buflines = s:P.is_list(a:buflines) ? join(a:buflines, "\n") : a:buflines | |
let ours_or_theirs = printf('%%(%s|%s)', | |
\ s:const.patterns.ours, | |
\ s:const.patterns.theirs, | |
\) | |
return !empty(matchstr(buflines, '\v' . ours_or_theirs)) | |
endfunction " }}} | |
1 0.000007 function! s:strip_ours(buflines, ...) " {{{ | |
let buflines = s:P.is_list(a:buflines) ? join(a:buflines, "\n") : a:buflines | |
let region_pattern = printf('%s.{-}%s', | |
\ s:const.patterns.ours, | |
\ s:const.patterns.separator, | |
\) | |
let buflines = substitute(buflines, '\v' . region_pattern . '\n?', '', 'g') | |
let buflines = substitute(buflines, '\v' . s:const.patterns.theirs . '\n?', '', 'g') | |
return get(a:000, 0, s:P.is_list(a:buflines)) ? split(buflines, '\v\r?\n') : buflines | |
endfunction " }}} | |
1 0.000007 function! s:strip_theirs(buflines, ...) " {{{ | |
let buflines = s:P.is_list(a:buflines) ? join(a:buflines, "\n") : a:buflines | |
let region_pattern = printf('%s.{-}%s', | |
\ s:const.patterns.separator, | |
\ s:const.patterns.theirs, | |
\) | |
let buflines = substitute(buflines, '\v' . region_pattern . '\n?', '', 'g') | |
let buflines = substitute(buflines, '\v' . s:const.patterns.ours . '\n?', '', 'g') | |
return get(a:000, 0, s:P.is_list(a:buflines)) ? split(buflines, '\v\r?\n') : buflines | |
endfunction " }}} | |
1 0.000008 function! s:strip_conflict(buflines, ...) " {{{ | |
let buflines = s:P.is_list(a:buflines) ? join(a:buflines, "\n") : a:buflines | |
let region_pattern = printf('%s.{-}%s', | |
\ s:const.patterns.ours, | |
\ s:const.patterns.theirs, | |
\) | |
let buflines = substitute(buflines, '\v' . region_pattern . '\n?', '', 'g') | |
return get(a:000, 0, s:P.is_list(a:buflines)) ? split(buflines, '\v\r?\n') : buflines | |
endfunction " }}} | |
1 0.000007 function! s:get_ours(filename, ...) abort " {{{ | |
let opts = extend({ | |
\ 'from_index': 1, | |
\}, get(a:000, 0, {})) | |
if opts.from_index | |
let result = s:C.exec(['show', ':2:' . a:filename], opts) | |
if result.status == 0 | |
return split(result.stdout, '\v\r?\n') | |
endif | |
return result | |
else | |
return s:strip_theirs(readfile(a:filename), 1) | |
endif | |
endfunction " }}} | |
1 0.000010 function! s:get_theirs(filename, ...) abort " {{{ | |
let opts = extend({ | |
\ 'from_index': 1, | |
\}, get(a:000, 0, {})) | |
if opts.from_index | |
let result = s:C.exec(['show', ':3:' . a:filename], opts) | |
if result.status == 0 | |
return split(result.stdout, '\v\r?\n') | |
endif | |
return result | |
else | |
return s:strip_ours(readfile(a:filename), 1) | |
endif | |
endfunction " }}} | |
1 0.000007 function! s:get_base(filename, ...) abort " {{{ | |
let opts = extend({ | |
\ 'from_index': 1, | |
\}, get(a:000, 0, {})) | |
if opts.from_index | |
let result = s:C.exec(['show', ':1:' . a:filename], opts) | |
if result.status == 0 | |
return split(result.stdout, '\v\r?\n') | |
endif | |
return result | |
else | |
return s:strip_conflict(readfile(a:filename), 1) | |
endif | |
endfunction " }}} | |
1 0.000025 let &cpo = s:save_cpo | |
1 0.000007 unlet s:save_cpo | |
"vim: sts=2 sw=2 smarttabb et ai textwidth=0 fdm=marker | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/Vim/BufferManager.vim | |
Sourced 1 time | |
Total time: 0.000785 | |
Self time: 0.000785 | |
count total (s) self (s) | |
" buffer manager. | |
1 0.000027 let s:save_cpo = &cpo | |
1 0.000026 set cpo&vim | |
1 0.000011 function! s:_vital_depends() abort | |
return ['Prelude', 'Vim.Buffer'] | |
endfunction | |
1 0.000008 function! s:_vital_loaded(V) abort | |
let s:V = a:V | |
let s:P = s:V.import('Prelude') | |
let s:B = s:V.import('Vim.Buffer') | |
endfunction | |
1 0.000017 let s:default_config = { | |
\ 'range': 'tabpage', | |
\ 'opener': 'split', | |
\ } | |
1 0.000017 let s:Manager = { | |
\ '_config': s:default_config, | |
\ '_user_config': {}, | |
\ '_bufnrs': {}, | |
\ } | |
1 0.000008 function! s:Manager.open(bufname, ...) abort | |
if s:B.is_cmdwin() | |
" Note: Failed to open buffer in cmdline window. | |
return { | |
\ 'loaded': 0, | |
\ 'newwin': -1, | |
\ 'newbuf': 0, | |
\ 'bufnr': -1, | |
\ } | |
endif | |
let lastbuf = bufnr('$') | |
let config = s:_make_config(self, a:000) | |
let moved = self.move(config.range) | |
let Opener = moved ? 'edit' : config.opener | |
while s:P.is_string(Opener) && Opener[0] ==# '=' | |
let Opener = eval(Opener[1 :]) | |
endwhile | |
let loaded = s:B.open(a:bufname, Opener) | |
let new_bufnr = bufnr('%') | |
let self._bufnrs[new_bufnr] = a:bufname | |
return { | |
\ 'loaded': loaded, | |
\ 'newwin': moved, | |
\ 'newbuf': lastbuf < bufnr('%'), | |
\ 'bufnr': new_bufnr, | |
\ } | |
endfunction | |
1 0.000006 function! s:Manager.close(...) abort | |
if call(self.move, a:000, self) | |
if winnr('$') != 1 | |
close | |
elseif tabpagenr('$') != 1 | |
tabclose | |
else | |
enew | |
endif | |
endif | |
endfunction | |
1 0.000006 function! s:Manager.opened(bufname) abort | |
throw 'vital: Vim.BufferManager: not implemented yet' | |
endfunction | |
1 0.000005 function! s:Manager.config(...) abort | |
if a:0 == 0 | |
return self._config | |
elseif a:0 == 1 && s:P.is_dict(a:1) | |
call extend(self._config, a:1) | |
return self | |
elseif a:0 == 1 | |
return get(self._config, a:1) | |
elseif a:0 == 2 | |
let self._config[a:1] = a:2 | |
return self | |
endif | |
throw 'vital: Vim.BufferManager: invalid argument for config()' | |
endfunction | |
1 0.000006 function! s:Manager.user_config(config) abort | |
let self._user_config = a:config | |
return self | |
endfunction | |
1 0.000006 function! s:Manager.is_managed(bufnr) abort | |
return has_key(self._bufnrs, a:bufnr) | |
endfunction | |
1 0.000006 function! s:Manager.add(bufnr, ...) abort | |
let bufname = a:0 ? a:1 : bufname(a:bufnr) | |
let self._bufnrs[a:bufnr] = bufname | |
endfunction | |
1 0.000005 function! s:Manager.list() abort | |
return sort(map(keys(self._bufnrs), 'v:val - 0')) | |
endfunction | |
1 0.000006 function! s:Manager.nearest(...) abort | |
let range = s:_make_config(self, map(copy(a:000), '{"range": v:val}')).range | |
if range ==# 'tabpage' | |
let tabpages = [tabpagenr()] | |
else | |
let s:base = tabpagenr() | |
let tabpages = sort(range(1, tabpagenr('$')), 's:_distance') | |
endif | |
for tabnr in tabpages | |
let s:base = tabpagewinnr(tabnr) | |
let buflist = tabpagebuflist(tabnr) | |
for winnr in sort(range(1, len(buflist)), 's:_distance') | |
if self.is_managed(buflist[winnr - 1]) | |
return [tabnr, winnr, buflist[winnr - 1]] | |
endif | |
endfor | |
endfor | |
return [] | |
endfunction | |
1 0.000007 function! s:Manager.move(...) abort | |
let range = s:_make_config(self, map(copy(a:000), '{"range": v:val}')).range | |
if range !=# 'all' && range !=# 'tabpage' | |
return 0 | |
endif | |
let near = self.nearest(range) | |
if empty(near) | |
return 0 | |
endif | |
silent execute 'tabnext' near[0] | |
silent execute near[1] 'wincmd w' | |
return 1 | |
endfunction | |
1 0.000006 function! s:Manager.do(cmd) abort | |
let cmd = | |
\ a:cmd =~ '%s' ? a:cmd | |
\ : a:cmd . ' %s' | |
for bufnr in self.list() | |
execute substitute(cmd, '%s', bufnr, '') | |
endfor | |
endfunction | |
1 0.000006 function! s:new(...) abort | |
return deepcopy(s:Manager) | |
\.config(a:0 ? s:_config(a:1) : {}) | |
\.user_config(2 <= a:0 ? a:2 : {}) | |
endfunction | |
1 0.000007 function! s:open(buffer, opener) abort | |
call s:_deprecated("open") | |
return s:B.open(a:buffer, a:opener) | |
endfunction | |
1 0.000007 function! s:_deprecated(fname) abort | |
echomsg printf("Vital.Vim.BufferManager.%s is deprecated! Please use Vital.Vim.Buffer.%s instead.", | |
\ a:fname, a:fname) | |
endfunction | |
1 0.000006 function! s:is_cmdwin() abort | |
call s:_deprecated("is_cmdwin") | |
return s:B.is_cmdwin() | |
endfunction | |
1 0.000008 function! s:_make_config(manager, configs) abort | |
let configs = [a:manager._config] | |
let user = a:manager._user_config | |
if s:P.is_string(user) | |
let configs += [exists(user) ? {user} : {}] | |
elseif s:P.is_dict(user) | |
let configs += [map(copy(user), 'exists(v:val) ? {v:val} : {}')] | |
endif | |
let config = {} | |
for c in configs + a:configs | |
call extend(config, s:_config(c)) | |
endfor | |
return config | |
endfunction | |
1 0.000007 function! s:_config(c) abort | |
if s:P.is_dict(a:c) | |
return a:c | |
elseif s:P.is_string(a:c) || s:P.is_funcref(a:c) | |
return {'opener': a:c} | |
endif | |
return {} | |
endfunction | |
1 0.000007 function! s:_distance(a, b) abort | |
return abs(a:a - s:base) - abs(a:b - s:base) | |
endfunction | |
1 0.000025 let &cpo = s:save_cpo | |
1 0.000007 unlet s:save_cpo | |
" vim:set et ts=2 sts=2 sw=2 tw=0: | |
SCRIPT /home/admin/.vim/plugged/vim-gita/autoload/vital/_vim_gita/Vim/Buffer.vim | |
Sourced 1 time | |
Total time: 0.000418 | |
Self time: 0.000418 | |
count total (s) self (s) | |
let s:save_cpo = &cpo | |
1 0.000027 set cpo&vim | |
1 0.000011 function! s:_vital_loaded(V) abort | |
let s:V = a:V | |
let s:P = s:V.import('Prelude') | |
endfunction | |
1 0.000007 function! s:_vital_depends() abort | |
return ['Prelude'] | |
endfunction | |
1 0.000012 if exists('*getcmdwintype') | |
1 0.000007 function! s:is_cmdwin() abort | |
return getcmdwintype() !=# '' | |
endfunction | |
1 0.000004 else | |
function! s:is_cmdwin() abort | |
return bufname('%') ==# '[Command Line]' | |
endfunction | |
endif | |
1 0.000006 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 | |
1 0.000008 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 | |
1 0.000008 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 | |
1 0.000024 let &cpo = s:save_cpo | |
1 0.000007 unlet s:save_cpo | |
" vim:set et ts=2 sts=2 sw=2 tw=0: | |
SCRIPT /usr/local/share/nvim/runtime/scripts.vim | |
Sourced 1 time | |
Total time: 0.002628 | |
Self time: 0.002628 | |
count total (s) self (s) | |
" Vim support file to detect file types in scripts | |
" | |
" Maintainer: Bram Moolenaar <[email protected]> | |
" Last change: 2014 Aug 24 | |
" This file is called by an autocommand for every file that has just been | |
" loaded into a buffer. It checks if the type of file can be recognized by | |
" the file contents. The autocommand is in $VIMRUNTIME/filetype.vim. | |
" Only do the rest when the FileType autocommand has not been triggered yet. | |
1 0.000009 if did_filetype() | |
finish | |
endif | |
" Load the user defined scripts file first | |
" Only do this when the FileType autocommand has not been triggered yet | |
1 0.000015 if exists("myscriptsfile") && filereadable(expand(myscriptsfile)) | |
execute "source " . myscriptsfile | |
if did_filetype() | |
finish | |
endif | |
endif | |
" Line continuation is used here, remove 'C' from 'cpoptions' | |
1 0.000037 let s:cpo_save = &cpo | |
1 0.000033 set cpo&vim | |
1 0.000019 let s:line1 = getline(1) | |
1 0.000017 if s:line1 =~ "^#!" | |
" A script that starts with "#!". | |
" Check for a line like "#!/usr/bin/env VAR=val bash". Turn it into | |
" "#!/usr/bin/bash" to make matching easier. | |
if s:line1 =~ '^#!\s*\S*\<env\s' | |
let s:line1 = substitute(s:line1, '\S\+=\S\+', '', 'g') | |
let s:line1 = substitute(s:line1, '\<env\s\+', '', '') | |
endif | |
" Get the program name. | |
" Only accept spaces in PC style paths: "#!c:/program files/perl [args]". | |
" If the word env is used, use the first word after the space: | |
" "#!/usr/bin/env perl [path/args]" | |
" If there is no path use the first word: "#!perl [path/args]". | |
" Otherwise get the last word after a slash: "#!/usr/bin/perl [path/args]". | |
if s:line1 =~ '^#!\s*\a:[/\\]' | |
let s:name = substitute(s:line1, '^#!.*[/\\]\(\i\+\).*', '\1', '') | |
elseif s:line1 =~ '^#!.*\<env\>' | |
let s:name = substitute(s:line1, '^#!.*\<env\>\s\+\(\i\+\).*', '\1', '') | |
elseif s:line1 =~ '^#!\s*[^/\\ ]*\>\([^/\\]\|$\)' | |
let s:name = substitute(s:line1, '^#!\s*\([^/\\ ]*\>\).*', '\1', '') | |
else | |
let s:name = substitute(s:line1, '^#!\s*\S*[/\\]\(\i\+\).*', '\1', '') | |
endif | |
" tcl scripts may have #!/bin/sh in the first line and "exec wish" in the | |
" third line. Suggested by Steven Atkinson. | |
if getline(3) =~ '^exec wish' | |
let s:name = 'wish' | |
endif | |
" Bourne-like shell scripts: bash bash2 ksh ksh93 sh | |
if s:name =~ '^\(bash\d*\|\|ksh\d*\|sh\)\>' | |
call SetFileTypeSH(s:line1) " defined in filetype.vim | |
" csh scripts | |
elseif s:name =~ '^csh\>' | |
if exists("g:filetype_csh") | |
call SetFileTypeShell(g:filetype_csh) | |
else | |
call SetFileTypeShell("csh") | |
endif | |
" tcsh scripts | |
elseif s:name =~ '^tcsh\>' | |
call SetFileTypeShell("tcsh") | |
" Z shell scripts | |
elseif s:name =~ '^zsh\>' | |
set ft=zsh | |
" TCL scripts | |
elseif s:name =~ '^\(tclsh\|wish\|expectk\|itclsh\|itkwish\)\>' | |
set ft=tcl | |
" Expect scripts | |
elseif s:name =~ '^expect\>' | |
set ft=expect | |
" Gnuplot scripts | |
elseif s:name =~ '^gnuplot\>' | |
set ft=gnuplot | |
" Makefiles | |
elseif s:name =~ 'make\>' | |
set ft=make | |
" Lua | |
elseif s:name =~ 'lua' | |
set ft=lua | |
" Perl 6 | |
elseif s:name =~ 'perl6' | |
set ft=perl6 | |
" Perl | |
elseif s:name =~ 'perl' | |
set ft=perl | |
" PHP | |
elseif s:name =~ 'php' | |
set ft=php | |
" Python | |
elseif s:name =~ 'python' | |
set ft=python | |
" Groovy | |
elseif s:name =~ '^groovy\>' | |
set ft=groovy | |
" Ruby | |
elseif s:name =~ 'ruby' | |
set ft=ruby | |
" BC calculator | |
elseif s:name =~ '^bc\>' | |
set ft=bc | |
" sed | |
elseif s:name =~ 'sed\>' | |
set ft=sed | |
" OCaml-scripts | |
elseif s:name =~ 'ocaml' | |
set ft=ocaml | |
" Awk scripts | |
elseif s:name =~ 'awk\>' | |
set ft=awk | |
" Website MetaLanguage | |
elseif s:name =~ 'wml' | |
set ft=wml | |
" Scheme scripts | |
elseif s:name =~ 'scheme' | |
set ft=scheme | |
" CFEngine scripts | |
elseif s:name =~ 'cfengine' | |
set ft=cfengine | |
" Erlang scripts | |
elseif s:name =~ 'escript' | |
set ft=erlang | |
endif | |
unlet s:name | |
else | |
" File does not start with "#!". | |
1 0.000009 let s:line2 = getline(2) | |
1 0.000009 let s:line3 = getline(3) | |
1 0.000008 let s:line4 = getline(4) | |
1 0.000009 let s:line5 = getline(5) | |
" Bourne-like shell scripts: sh ksh bash bash2 | |
1 0.000011 if s:line1 =~ '^:$' | |
call SetFileTypeSH(s:line1) " defined in filetype.vim | |
" Z shell scripts | |
elseif s:line1 =~ '^#compdef\>' || s:line1 =~ '^#autoload\>' || | |
\ "\n".s:line1."\n".s:line2."\n".s:line3."\n".s:line4."\n".s:line5 =~ '\n\s*emulate\s\+\%(-[LR]\s\+\)\=[ckz]\=sh\>' | |
set ft=zsh | |
" ELM Mail files | |
elseif s:line1 =~ '^From \([a-zA-Z][a-zA-Z_0-9\.=-]*\(@[^ ]*\)\=\|-\) .* \(19\|20\)\d\d$' | |
set ft=mail | |
" Mason | |
elseif s:line1 =~ '^<[%&].*>' | |
set ft=mason | |
" Vim scripts (must have '" vim' as the first line to trigger this) | |
elseif s:line1 =~ '^" *[vV]im$' | |
set ft=vim | |
" MOO | |
elseif s:line1 =~ '^\*\* LambdaMOO Database, Format Version \%([1-3]\>\)\@!\d\+ \*\*$' | |
set ft=moo | |
" Diff file: | |
" - "diff" in first line (context diff) | |
" - "Only in " in first line | |
" - "--- " in first line and "+++ " in second line (unified diff). | |
" - "*** " in first line and "--- " in second line (context diff). | |
" - "# It was generated by makepatch " in the second line (makepatch diff). | |
" - "Index: <filename>" in the first line (CVS file) | |
" - "=== ", line of "=", "---", "+++ " (SVK diff) | |
" - "=== ", "--- ", "+++ " (bzr diff, common case) | |
" - "=== (removed|added|renamed|modified)" (bzr diff, alternative) | |
" - "# HG changeset patch" in first line (Mercurial export format) | |
elseif s:line1 =~ '^\(diff\>\|Only in \|\d\+\(,\d\+\)\=[cda]\d\+\>\|# It was generated by makepatch \|Index:\s\+\f\+\r\=$\|===== \f\+ \d\+\.\d\+ vs edited\|==== //\f\+#\d\+\|# HG changeset patch\)' | |
\ || (s:line1 =~ '^--- ' && s:line2 =~ '^+++ ') | |
\ || (s:line1 =~ '^\* looking for ' && s:line2 =~ '^\* comparing to ') | |
\ || (s:line1 =~ '^\*\*\* ' && s:line2 =~ '^--- ') | |
\ || (s:line1 =~ '^=== ' && ((s:line2 =~ '^=\{66\}' && s:line3 =~ '^--- ' && s:line4 =~ '^+++') || (s:line2 =~ '^--- ' && s:line3 =~ '^+++ '))) | |
\ || (s:line1 =~ '^=== \(removed\|added\|renamed\|modified\)') | |
set ft=diff | |
" PostScript Files (must have %!PS as the first line, like a2ps output) | |
elseif s:line1 =~ '^%![ \t]*PS' | |
set ft=postscr | |
" M4 scripts: Guess there is a line that starts with "dnl". | |
elseif s:line1 =~ '^\s*dnl\>' | |
\ || s:line2 =~ '^\s*dnl\>' | |
\ || s:line3 =~ '^\s*dnl\>' | |
\ || s:line4 =~ '^\s*dnl\>' | |
\ || s:line5 =~ '^\s*dnl\>' | |
set ft=m4 | |
" SiCAD scripts (must have procn or procd as the first line to trigger this) | |
elseif s:line1 =~? '^ *proc[nd] *$' | |
set ft=sicad | |
" Purify log files start with "**** Purify" | |
elseif s:line1 =~ '^\*\*\*\* Purify' | |
set ft=purifylog | |
" XML | |
elseif s:line1 =~ '<?\s*xml.*?>' | |
set ft=xml | |
" XHTML (e.g.: PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN") | |
elseif s:line1 =~ '\<DTD\s\+XHTML\s' | |
set ft=xhtml | |
" HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN") | |
elseif s:line1 =~? '\<DOCTYPE\s\+html\>' | |
set ft=html | |
elseif s:line1 =~ '^%PDF-' | |
set ft=pdf | |
" XXD output | |
elseif s:line1 =~ '^\x\{7}: \x\{2} \=\x\{2} \=\x\{2} \=\x\{2} ' | |
set ft=xxd | |
" RCS/CVS log output | |
elseif s:line1 =~ '^RCS file:' || s:line2 =~ '^RCS file:' | |
set ft=rcslog | |
" CVS commit | |
elseif s:line2 =~ '^CVS:' || getline("$") =~ '^CVS: ' | |
set ft=cvs | |
" Prescribe | |
elseif s:line1 =~ '^!R!' | |
set ft=prescribe | |
" Send-pr | |
elseif s:line1 =~ '^SEND-PR:' | |
set ft=sendpr | |
" SNNS files | |
elseif s:line1 =~ '^SNNS network definition file' | |
set ft=snnsnet | |
elseif s:line1 =~ '^SNNS pattern definition file' | |
set ft=snnspat | |
elseif s:line1 =~ '^SNNS result file' | |
set ft=snnsres | |
" Virata | |
elseif s:line1 =~ '^%.\{-}[Vv]irata' | |
\ || s:line2 =~ '^%.\{-}[Vv]irata' | |
\ || s:line3 =~ '^%.\{-}[Vv]irata' | |
\ || s:line4 =~ '^%.\{-}[Vv]irata' | |
\ || s:line5 =~ '^%.\{-}[Vv]irata' | |
set ft=virata | |
" Strace | |
elseif s:line1 =~ '^\(\[pid \d\+\] \)\=[0-9:.]* *execve(' || s:line1 =~ '^__libc_start_main' | |
set ft=strace | |
" VSE JCL | |
elseif s:line1 =~ '^\* $$ JOB\>' || s:line1 =~ '^// *JOB\>' | |
set ft=vsejcl | |
" TAK and SINDA | |
elseif s:line4 =~ 'K & K Associates' || s:line2 =~ 'TAK 2000' | |
set ft=takout | |
elseif s:line3 =~ 'S Y S T E M S I M P R O V E D ' | |
set ft=sindaout | |
elseif getline(6) =~ 'Run Date: ' | |
set ft=takcmp | |
elseif getline(9) =~ 'Node File 1' | |
set ft=sindacmp | |
" DNS zone files | |
elseif s:line1.s:line2.s:line3.s:line4 =~ '^; <<>> DiG [0-9.]\+ <<>>\|BIND.*named\|$ORIGIN\|$TTL\|IN\s\+SOA' | |
set ft=bindzone | |
" BAAN | |
elseif s:line1 =~ '|\*\{1,80}' && s:line2 =~ 'VRC ' | |
\ || s:line2 =~ '|\*\{1,80}' && s:line3 =~ 'VRC ' | |
set ft=baan | |
" Valgrind | |
elseif s:line1 =~ '^==\d\+== valgrind' || s:line3 =~ '^==\d\+== Using valgrind' | |
set ft=valgrind | |
" Go docs | |
elseif s:line1 =~ '^PACKAGE DOCUMENTATION$' | |
set ft=godoc | |
" Renderman Interface Bytestream | |
elseif s:line1 =~ '^##RenderMan' | |
set ft=rib | |
" Scheme scripts | |
elseif s:line1 =~ 'exec\s\+\S*scheme' || s:line2 =~ 'exec\s\+\S*scheme' | |
set ft=scheme | |
" Git output | |
elseif s:line1 =~ '^\(commit\|tree\|object\) \x\{40\}\>\|^tag \S\+$' | |
set ft=git | |
" Gprof (gnu profiler) | |
elseif s:line1 == 'Flat profile:' | |
\ && s:line2 == '' | |
\ && s:line3 =~ '^Each sample counts as .* seconds.$' | |
set ft=gprof | |
" Erlang terms | |
" (See also: http://www.gnu.org/software/emacs/manual/html_node/emacs/Choosing-Modes.html#Choosing-Modes) | |
elseif s:line1 =~? '-\*-.*erlang.*-\*-' | |
set ft=erlang | |
" CVS diff | |
else | |
1 0.000007 let s:lnum = 1 | |
1 0.000017 while getline(s:lnum) =~ "^? " && s:lnum < line("$") | |
let s:lnum += 1 | |
endwhile | |
1 0.000017 if getline(s:lnum) =~ '^Index:\s\+\f\+$' | |
set ft=diff | |
" locale input files: Formal Definitions of Cultural Conventions | |
" filename must be like en_US, fr_FR@euro or en_US.UTF-8 | |
elseif expand("%") =~ '\a\a_\a\a\($\|[.@]\)\|i18n$\|POSIX$\|translit_' | |
let s:lnum = 1 | |
while s:lnum < 100 && s:lnum < line("$") | |
if getline(s:lnum) =~ '^LC_\(IDENTIFICATION\|CTYPE\|COLLATE\|MONETARY\|NUMERIC\|TIME\|MESSAGES\|PAPER\|TELEPHONE\|MEASUREMENT\|NAME\|ADDRESS\)$' | |
setf fdcc | |
break | |
endif | |
let s:lnum += 1 | |
endwhile | |
endif | |
1 0.000006 unlet s:lnum | |
1 0.000004 endif | |
1 0.000008 unlet s:line2 s:line3 s:line4 s:line5 | |
1 0.000003 endif | |
" Restore 'cpoptions' | |
1 0.000029 let &cpo = s:cpo_save | |
1 0.000008 unlet s:cpo_save s:line1 | |
SCRIPT /home/admin/.vim/plugged/vim-gita/syntax/gita-status.vim | |
Sourced 1 time | |
Total time: 0.000710 | |
Self time: 0.000273 | |
count total (s) self (s) | |
"****************************************************************************** | |
" vim-gita status window | |
" | |
" Author: Alisue <[email protected]> | |
" URL: http://hashnote.net/ | |
" License: MIT license | |
" (C) 2015, Alisue, hashnote.net | |
"****************************************************************************** | |
1 0.000018 if exists('b:current_syntax') | |
finish | |
endif | |
1 0.000036 let s:save_cpo = &cpo | |
1 0.000033 set cpo&vim | |
1 0.000014 syntax clear | |
1 0.000283 0.000036 call gita#interface#status#define_highlights() | |
1 0.000214 0.000023 call gita#interface#status#define_syntax() | |
1 0.000010 let b:current_syntax = "gita-status" | |
1 0.000027 let &cpo = s:save_cpo | |
1 0.000007 unlet s:save_cpo | |
"vim: sts=2 sw=2 smarttab et ai textwidth=0 fdm=marker | |
FUNCTION <SNR>101_action_stage() | |
Called 1 time | |
Total time: 5.497515 | |
Self time: 0.000598 | |
count total (s) self (s) | |
1 0.000094 0.000031 let statuses = s:ensure_list(a:statuses) | |
1 0.000037 let options = extend({ 'force': 0,}, a:options) | |
1 0.000012 let add_statuses = [] | |
1 0.000012 let rm_statuses = [] | |
2 0.000022 for status in statuses | |
1 0.000010 if status.is_conflicted | |
call gita#util#info(printf(join([ 'A conflicted file "%s" cannot be staged.', 'Use <Plug>(gita-action-add) or <Plug>(gita-action-rm) instead.', ]), status.path)) | |
continue | |
elseif status.is_unstaged && status.worktree ==# 'D' | |
call add(rm_statuses, status) | |
else | |
1 0.000055 0.000026 if s:validate_status_add(status, options) | |
continue | |
endif | |
1 0.000025 call add(add_statuses, status) | |
1 0.000005 endif | |
1 0.000006 endfor | |
1 0.000017 if empty(add_statuses) && empty(rm_statuses) | |
if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( 'No valid files were selected for stage action',) | |
endif | |
return | |
endif | |
1 0.000015 let options.ignore_empty_warning = 1 | |
1 2.900833 0.000053 call s:action_add(add_statuses, options) | |
1 0.000213 0.000026 call s:action_rm(rm_statuses, options) | |
1 2.595904 0.000046 call s:update() | |
FUNCTION gita#interface#status#get_selected_statuses() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if s:validate_filetype('gita#interface#status#get_selected_statuses()') | |
return | |
endif | |
return call('s:get_selected_statuses', a:000) | |
FUNCTION <SNR>43_Highlight_Matching_Pair() | |
Called 9 times | |
Total time: 0.002760 | |
Self time: 0.002760 | |
count total (s) self (s) | |
" Remove any previous match. | |
9 0.000144 if exists('w:paren_hl_on') && w:paren_hl_on | |
silent! call matchdelete(3) | |
let w:paren_hl_on = 0 | |
endif | |
" Avoid that we remove the popup menu. | |
" Return when there are no colors (looks like the cursor jumps). | |
9 0.000160 if pumvisible() || (&t_Co < 8 && !has("gui_running")) | |
return | |
endif | |
" Get the character under the cursor and check if it's in 'matchpairs'. | |
9 0.000110 let c_lnum = line('.') | |
9 0.000098 let c_col = col('.') | |
9 0.000066 let before = 0 | |
9 0.000119 let text = getline(c_lnum) | |
9 0.000133 let c = text[c_col - 1] | |
9 0.000561 let plist = split(&matchpairs, '.\zs[:,]') | |
9 0.000133 let i = index(plist, c) | |
9 0.000057 if i < 0 | |
" not found, in Insert mode try character before the cursor | |
9 0.000103 if c_col > 1 && (mode() == 'i' || mode() == 'R') | |
let before = 1 | |
let c = text[c_col - 2] | |
let i = index(plist, c) | |
endif | |
9 0.000056 if i < 0 | |
" not found, nothing to do | |
9 0.000039 return | |
endif | |
endif | |
" Figure out the arguments for searchpairpos(). | |
if i % 2 == 0 | |
let s_flags = 'nW' | |
let c2 = plist[i + 1] | |
else | |
let s_flags = 'nbW' | |
let c2 = c | |
let c = plist[i - 1] | |
endif | |
if c == '[' | |
let c = '\[' | |
let c2 = '\]' | |
endif | |
" Find the match. When it was just before the cursor move it there for a | |
" moment. | |
if before > 0 | |
let has_getcurpos = exists("*getcurpos") | |
if has_getcurpos | |
" getcurpos() is more efficient but doesn't exist before 7.4.313. | |
let save_cursor = getcurpos() | |
else | |
let save_cursor = winsaveview() | |
endif | |
call cursor(c_lnum, c_col - before) | |
endif | |
" Build an expression that detects whether the current cursor position is in | |
" certain syntax types (string, comment, etc.), for use as searchpairpos()'s | |
" skip argument. | |
" We match "escape" for special items, such as lispEscapeSpecial. | |
let s_skip = '!empty(filter(map(synstack(line("."), col(".")), ''synIDattr(v:val, "name")''), ' . '''v:val =~? "string\\|character\\|singlequote\\|escape\\|comment"''))' | |
" If executing the expression determines that the cursor is currently in | |
" one of the syntax types, then we want searchpairpos() to find the pair | |
" within those syntax types (i.e., not skip). Otherwise, the cursor is | |
" outside of the syntax types and s_skip should keep its value so we skip any | |
" matching pair inside the syntax types. | |
execute 'if' s_skip '| let s_skip = 0 | endif' | |
" Limit the search to lines visible in the window. | |
let stoplinebottom = line('w$') | |
let stoplinetop = line('w0') | |
if i % 2 == 0 | |
let stopline = stoplinebottom | |
else | |
let stopline = stoplinetop | |
endif | |
" Limit the search time to 300 msec to avoid a hang on very long lines. | |
" This fails when a timeout is not supported. | |
if mode() == 'i' || mode() == 'R' | |
let timeout = exists("b:matchparen_insert_timeout") ? b:matchparen_insert_timeout : g:matchparen_insert_timeout | |
else | |
let timeout = exists("b:matchparen_timeout") ? b:matchparen_timeout : g:matchparen_timeout | |
endif | |
try | |
let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, timeout) | |
catch /E118/ | |
" Can't use the timeout, restrict the stopline a bit more to avoid taking | |
" a long time on closed folds and long lines. | |
" The "viewable" variables give a range in which we can scroll while | |
" keeping the cursor at the same position. | |
" adjustedScrolloff accounts for very large numbers of scrolloff. | |
let adjustedScrolloff = min([&scrolloff, (line('w$') - line('w0')) / 2]) | |
let bottom_viewable = min([line('$'), c_lnum + &lines - adjustedScrolloff - 2]) | |
let top_viewable = max([1, c_lnum-&lines+adjustedScrolloff + 2]) | |
" one of these stoplines will be adjusted below, but the current values are | |
" minimal boundaries within the current window | |
if i % 2 == 0 | |
if has("byte_offset") && has("syntax_items") && &smc > 0 | |
let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2]) | |
let stopline = min([bottom_viewable, byte2line(stopbyte)]) | |
else | |
let stopline = min([bottom_viewable, c_lnum + 100]) | |
endif | |
let stoplinebottom = stopline | |
else | |
if has("byte_offset") && has("syntax_items") && &smc > 0 | |
let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2]) | |
let stopline = max([top_viewable, byte2line(stopbyte)]) | |
else | |
let stopline = max([top_viewable, c_lnum - 100]) | |
endif | |
let stoplinetop = stopline | |
endif | |
let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline) | |
endtry | |
if before > 0 | |
if has_getcurpos | |
call setpos('.', save_cursor) | |
else | |
call winrestview(save_cursor) | |
endif | |
endif | |
" If a match is found setup match highlighting. | |
if m_lnum > 0 && m_lnum >= stoplinetop && m_lnum <= stoplinebottom | |
if exists('*matchaddpos') | |
call matchaddpos('MatchParen', [[c_lnum, c_col - before], [m_lnum, m_col]], 10, 3) | |
else | |
exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) . 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/' | |
endif | |
let w:paren_hl_on = 1 | |
endif | |
FUNCTION <SNR>93_nr2hex() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let n = a:nr | |
let r = "" | |
while n | |
let r = '0123456789ABCDEF'[n % 16] . r | |
let n = n / 16 | |
endwhile | |
return r | |
FUNCTION <SNR>86_clear() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
for key in keys(a:dict) | |
call remove(a:dict, key) | |
endfor | |
return a:dict | |
FUNCTION 5() | |
Called 8 times | |
Total time: 0.000145 | |
Self time: 0.000145 | |
count total (s) self (s) | |
8 0.000119 call add(self._sections, ['|', a:0 ? a:1 : '%=']) | |
FUNCTION 7() | |
Called 44 times | |
Total time: 0.000816 | |
Self time: 0.000816 | |
count total (s) self (s) | |
44 0.000678 call add(self._sections, [a:group, a:contents]) | |
FUNCTION 8() | |
Called 8 times | |
Total time: 0.000124 | |
Self time: 0.000124 | |
count total (s) self (s) | |
8 0.000099 call add(self._sections, ['', a:text]) | |
FUNCTION 9() | |
Called 8 times | |
Total time: 0.063201 | |
Self time: 0.011584 | |
count total (s) self (s) | |
8 0.000043 let side = 1 | |
8 0.000039 let line = '' | |
8 0.000037 let i = 0 | |
8 0.000069 let length = len(self._sections) | |
8 0.000040 let split = 0 | |
68 0.000324 while i < length | |
60 0.000470 let section = self._sections[i] | |
60 0.000412 let group = section[0] | |
60 0.000418 let contents = section[1] | |
60 0.004016 0.000951 let prev_group = s:get_prev_group(self._sections, i) | |
60 0.000254 if group == '' | |
8 0.000054 let line .= contents | |
8 0.000027 elseif group == '|' | |
8 0.000034 let side = 0 | |
8 0.000050 let line .= contents | |
8 0.000033 let split = 1 | |
8 0.000020 else | |
44 0.000197 if prev_group == '' | |
8 0.000064 let line .= '%#'.group.'#' | |
8 0.000027 elseif split | |
8 0.012098 0.000190 let line .= s:get_transitioned_seperator(self, prev_group, group, side) | |
8 0.000039 let split = 0 | |
8 0.000021 else | |
28 0.029591 0.000599 let line .= s:get_seperator(self, prev_group, group, side) | |
28 0.000079 endif | |
44 0.008531 0.000879 let line .= s:get_accented_line(self, group, contents) | |
44 0.000120 endif | |
60 0.000364 let i = i + 1 | |
60 0.000230 endwhile | |
8 0.000044 if !self._context.active | |
4 0.000278 let line = substitute(line, '%#.\{-}\ze#', '\0_inactive', 'g') | |
4 0.000014 endif | |
8 0.000040 return line | |
FUNCTION <SNR>82_is_cygwin() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:is_cygwin | |
FUNCTION <SNR>22_on_window_changed() | |
Called 4 times | |
Total time: 0.085088 | |
Self time: 0.000222 | |
count total (s) self (s) | |
4 0.000035 if pumvisible() | |
return | |
endif | |
4 0.000121 0.000057 call s:init() | |
4 0.084872 0.000070 call airline#update_statusline() | |
FUNCTION <SNR>93__split_by_wcswidth_once() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let fst = s:P.strwidthpart(a:body, a:x) | |
let snd = s:P.strwidthpart_reverse(a:body, s:P.wcswidth(a:body) - s:P.wcswidth(fst)) | |
return [fst, snd] | |
FUNCTION <SNR>86__max_by() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let dict = s:swap(map(copy(a:dict), a:expr)) | |
let key = dict[max(keys(dict))] | |
return [key, a:dict[key]] | |
FUNCTION <SNR>83_find_last_index() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION <SNR>104_get_last_selected() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION <SNR>90__vital_depends() | |
Called 1 time | |
Total time: 0.000014 | |
Self time: 0.000014 | |
count total (s) self (s) | |
1 0.000010 return [ 'System.Cache.Simple', 'VCS.Git.Core', 'VCS.Git.Misc', 'VCS.Git.Finder',] | |
FUNCTION airline#util#exec_funcrefs() | |
Called 8 times | |
Total time: 0.018222 | |
Self time: 0.001185 | |
count total (s) self (s) | |
28 0.000144 for Fn in a:list | |
28 0.017580 0.000543 let code = call(Fn, a:000) | |
28 0.000118 if code != 0 | |
8 0.000028 return code | |
endif | |
20 0.000059 endfor | |
return 0 | |
FUNCTION gita#util#doautocmd() | |
Called 2 times | |
Total time: 0.000467 | |
Self time: 0.000450 | |
count total (s) self (s) | |
2 0.000042 let name = printf('vim-gita-%s', a:name) | |
2 0.000027 if 703 < v:version || (v:version == 703 && has('patch438')) | |
2 0.000330 0.000313 silent execute 'doautocmd <nomodeline> User ' . name | |
2 0.000013 else | |
silent execute 'doautocmd User ' . name | |
endif | |
FUNCTION <SNR>93_justify_equal_spacing() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let char = get(a:, 1, ' ') | |
if strdisplaywidth(char) != 1 | |
throw "vital: Data.String: Can't use non-half-width characters for padding." | |
endif | |
let letters = split(a:str, '\zs') | |
let first_letter = letters[0] | |
" {width w/o the first letter} / {length w/o the first letter} | |
let each_width = (a:width - strdisplaywidth(first_letter)) / (len(letters) - 1) | |
let remainder = (a:width - strdisplaywidth(first_letter)) % (len(letters) - 1) | |
return first_letter. join(s:L.concat([ map(letters[1:remainder], 's:pad_left(v:val, each_width + 1, char)'), map(letters[remainder + 1:], 's:pad_left(v:val, each_width, char)') ]), '') | |
FUNCTION gita#argument#parse() | |
Called 1 time | |
Total time: 0.008157 | |
Self time: 0.000511 | |
count total (s) self (s) | |
1 0.000013 let cmdline = get(a:000, 0, '') | |
1 0.001055 0.000013 let parser = s:get_parser() | |
1 0.003374 0.000020 let opts = parser.parse(a:bang, a:range, cmdline) | |
1 0.000035 if opts.__bang__ || !has_key(opts, 'action') || opts.action !~# s:gita_command_names_pattern | |
let opts.__name__ = get(opts, 'action', '') | |
return opts | |
endif | |
1 0.003255 0.000363 let parser = call(printf('gita#argument#%s#get_parser', opts.action), []) | |
1 0.000388 0.000030 let opts = parser.parse_args(opts.__unknown__, { '__name__': opts.action, '__bang__': opts.__bang__, '__range__': opts.__range__,}) | |
1 0.000005 return opts | |
FUNCTION <SNR>101_action_reset() | |
Called 1 time | |
Total time: 2.789039 | |
Self time: 0.000489 | |
count total (s) self (s) | |
1 0.000092 0.000030 let statuses = s:ensure_list(a:statuses) | |
1 0.000038 let options = extend({ 'quiet': 1, }, a:options) | |
1 0.000013 let valid_statuses = [] | |
2 0.000022 for status in statuses | |
1 0.000055 0.000027 if s:validate_status_reset(status, options) | |
continue | |
endif | |
1 0.000024 call add(valid_statuses, status) | |
1 0.000007 endfor | |
1 0.000012 if empty(valid_statuses) | |
if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( 'No valid files were selected for reset action',) | |
endif | |
return | |
endif | |
1 0.070993 0.000100 let result = s:get_gita().git.reset(options, '', map(valid_statuses, 'v:val.path')) | |
1 0.000006 if result.status | |
call gita#util#error( result.stdout, printf('Fail: %s', join(result.args)),) | |
else | |
1 0.000185 0.000022 call gita#util#doautocmd('reset-post') | |
1 0.000003 endif | |
1 2.717449 0.000044 call s:update() | |
FUNCTION <SNR>82_getchar() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let c = call('getchar', a:000) | |
return type(c) == type(0) ? nr2char(c) : c | |
FUNCTION gita#util#is_list() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return call(s:Prelude.is_list, a:000, s:Prelude) | |
FUNCTION <SNR>103__deprecated() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
echomsg printf("Vital.Vim.BufferManager.%s is deprecated! Please use Vital.Vim.Buffer.%s instead.", a:fname, a:fname) | |
FUNCTION <SNR>93_dstring() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let x = substitute(string(a:expr), "^'\\|'$", '', 'g') | |
let x = substitute(x, "''", "'", 'g') | |
return printf('"%s"', escape(x, '"')) | |
FUNCTION <SNR>103__config() | |
Called 10 times | |
Total time: 0.000317 | |
Self time: 0.000199 | |
count total (s) self (s) | |
10 0.000227 0.000109 if s:P.is_dict(a:c) | |
10 0.000044 return a:c | |
elseif s:P.is_string(a:c) || s:P.is_funcref(a:c) | |
return {'opener': a:c} | |
endif | |
return {} | |
FUNCTION <SNR>97_get_last_commitmsg() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let opts = get(a:000, 0, {}) | |
let result = s:Core.exec(['log', '-1', '--pretty=%B'], opts) | |
if result.status == 0 | |
return split(result.stdout, '\v\r?\n') | |
else | |
return result | |
endif | |
FUNCTION <SNR>59_get_array() | |
Called 100 times | |
Total time: 0.010167 | |
Self time: 0.010167 | |
count total (s) self (s) | |
100 0.000679 let fg = a:fg | |
100 0.000580 let bg = a:bg | |
100 0.008267 return has('gui_running') || (has("termtruecolor") && &guicolors == 1) ? [ fg, bg, '', '', join(a:opts, ',') ] : [ '', '', fg, bg, join(a:opts, ',') ] | |
FUNCTION <SNR>81__vital_files() | |
Called 109 times | |
Total time: 0.091198 | |
Self time: 0.083582 | |
count total (s) self (s) | |
109 0.001303 if s:_vital_files_cache_runtimepath !=# &runtimepath | |
1 0.000027 let path = printf('autoload/vital/%s/**/*.vim', s:self_version) | |
1 0.007652 0.000036 let s:_vital_files_cache = s:_runtime_files(path) | |
1 0.000021 let mod = ':p:gs?[\\/]\+?/?' | |
1 0.002418 call map(s:_vital_files_cache, 'fnamemodify(v:val, mod)') | |
1 0.000054 let s:_vital_files_cache_runtimepath = &runtimepath | |
1 0.000007 endif | |
109 0.001829 let target = substitute(a:pattern, '\.', '/', 'g') | |
109 0.001511 let target = substitute(target, '\*', '[^/]*', 'g') | |
109 0.001553 let regexp = printf('autoload/vital/%s/%s.vim', s:self_version, target) | |
109 0.070020 return filter(copy(s:_vital_files_cache), 'v:val =~# regexp') | |
FUNCTION <SNR>101_action_unstage() | |
Called 1 time | |
Total time: 2.789103 | |
Self time: 0.000065 | |
count total (s) self (s) | |
1 2.789096 0.000058 call s:action_reset(a:statuses, a:options) | |
FUNCTION <SNR>101_action_open() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let options = extend({ 'opener': 'edit',}, a:options) | |
let bufname = bufname('%') | |
call gita#util#invoker_focus() | |
call gita#util#buffer_open( get(a:status, 'path2', a:status.path), options.opener) | |
" update invoker | |
call gita#util#invoker_set(gita#util#invoker_get(), bufname) | |
FUNCTION <SNR>93_wrap() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let _columns = a:0 > 0 ? a:1 : &columns | |
return s:L.concat( map(split(a:str, '\r\n\|[\r\n]'), 's:_split_by_wcswidth(v:val, _columns - 1)')) | |
FUNCTION gita#util#input() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
execute 'echohl' a:hl | |
try | |
return input(a:msg, get(a:000, 0, '')) | |
finally | |
echohl None | |
endtry | |
FUNCTION <SNR>96_parse_record() | |
Called 199 times | |
Total time: 0.032833 | |
Self time: 0.032833 | |
count total (s) self (s) | |
" remove comment string | |
199 0.005521 let line = substitute(a:line, s:comment_pattern, '', 'g') | |
" is empty line? | |
199 0.002631 if line =~# '\v^\s*$' | |
return {'type': 'emptyline'} | |
endif | |
" is parameter line? | |
199 0.010554 let m = matchlist(line, s:parameter_pattern) | |
199 0.001488 if len(m) > 0 | |
132 0.002024 return {'type': 'parameter', 'key': m[1], 'value': m[2]} | |
endif | |
" is section line? | |
67 0.002896 let m = matchlist(line, s:section_pattern) | |
67 0.000477 if len(m) > 0 | |
67 0.000799 return {'type': 'section', 'name': m[1]} | |
endif | |
" unknown format | |
return {'type': 'unknown', 'value': line} | |
FUNCTION <SNR>101_action_help() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let varname = printf('_help_%s', a:options.about) | |
let b:[varname] = !get(b:, varname, 0) | |
call s:update(a:options) | |
FUNCTION <SNR>94__vital_depends() | |
Called 1 time | |
Total time: 0.000014 | |
Self time: 0.000014 | |
count total (s) self (s) | |
1 0.000010 return [ 'Prelude', 'Process', 'Data.List', 'System.Filepath', 'Text.INI',] | |
FUNCTION airline#check_mode() | |
Called 16 times | |
Total time: 0.037776 | |
Self time: 0.005337 | |
count total (s) self (s) | |
16 0.000246 let context = s:contexts[a:winnr] | |
16 0.000177 if get(w:, 'airline_active', 1) | |
12 0.000130 let l:m = mode() | |
12 0.000095 if l:m ==# "i" | |
let l:mode = ['insert'] | |
elseif l:m ==# "R" | |
let l:mode = ['replace'] | |
elseif l:m =~# '\v(v|V||s|S|)' | |
let l:mode = ['visual'] | |
else | |
12 0.000120 let l:mode = ['normal'] | |
12 0.000050 endif | |
12 0.000234 let w:airline_current_mode = get(g:airline_mode_map, l:m, l:m) | |
12 0.000048 else | |
4 0.000054 let l:mode = ['inactive'] | |
4 0.000050 let w:airline_current_mode = get(g:airline_mode_map, '__') | |
4 0.000013 endif | |
16 0.000170 if g:airline_detect_modified && &modified | |
call add(l:mode, 'modified') | |
endif | |
16 0.000127 if g:airline_detect_paste && &paste | |
call add(l:mode, 'paste') | |
endif | |
16 0.000121 if &readonly || ! &modifiable | |
11 0.000227 call add(l:mode, 'readonly') | |
11 0.000046 endif | |
16 0.000237 let mode_string = join(l:mode) | |
16 0.000205 if get(w:, 'airline_lastmode', '') != mode_string | |
2 0.000576 0.000062 call airline#highlighter#highlight_modified_inactive(context.bufnr) | |
2 0.031981 0.000055 call airline#highlighter#highlight(l:mode) | |
2 0.000018 let w:airline_lastmode = mode_string | |
2 0.000006 endif | |
16 0.000072 return '' | |
FUNCTION 69() | |
Called 1 time | |
Total time: 0.032245 | |
Self time: 0.000340 | |
count total (s) self (s) | |
1 0.000055 let defaults = { 'dry_run': 0, 'verbose': 0, 'force': 0, 'interactive': 0, 'patch': 0, 'edit': 0, 'update': 0, 'all': 0, 'intent_to_add': 0, 'refresh': 0, 'ignore_errors': 0, 'ignore_missing': 0,} | |
1 0.000653 0.000048 let opts = s:Dict.omit(a:options, keys(defaults)) | |
1 0.003789 0.000058 let args = extend(['add'], s:Misc.opts2args(a:options, defaults)) | |
1 0.000100 0.000044 let filenames = s:_listalize(get(a:000, 0, [])) | |
1 0.000015 if len(filenames) > 0 | |
1 0.000025 call add(args, ['--', filenames]) | |
1 0.000006 endif | |
1 0.027580 0.000067 return self.exec(args, opts) | |
FUNCTION <SNR>98_is_unstaged() | |
Called 144 times | |
Total time: 0.012088 | |
Self time: 0.012088 | |
count total (s) self (s) | |
144 0.011523 return a:sign =~# s:const.unstaged_pattern | |
FUNCTION <SNR>101_validate_status_reset() | |
Called 1 time | |
Total time: 0.000028 | |
Self time: 0.000028 | |
count total (s) self (s) | |
1 0.000011 if a:status.is_staged | |
1 0.000008 return 0 | |
elseif a:status.is_untracked || a:status.is_ignored | |
call gita#util#info(printf( 'An untracked/ignored file "%s" cannot be reset.', a:status.path,)) | |
return 1 | |
elseif a:status.is_conflicted | |
call gita#util#error(printf( 'A conflicted file "%s" cannot be reset. ', a:status.path,)) | |
return 1 | |
else | |
call gita#util#info(printf( 'No changes of "%s" exist on index.', a:status.path,)) | |
return 1 | |
endif | |
FUNCTION <SNR>86_make() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION airline#util#append() | |
Called 36 times | |
Total time: 0.002072 | |
Self time: 0.002072 | |
count total (s) self (s) | |
36 0.000428 if a:minwidth > 0 && winwidth(0) < a:minwidth | |
return '' | |
endif | |
36 0.000556 let prefix = s:spc == "\ua0" ? s:spc : s:spc.s:spc | |
36 0.000479 return empty(a:text) ? '' : prefix.g:airline_left_alt_sep.s:spc.a:text | |
FUNCTION <SNR>94_find_repository() | |
Called 1 time | |
Total time: 0.000459 | |
Self time: 0.000052 | |
count total (s) self (s) | |
1 0.000435 0.000029 let dotgit = s:Path.join([s:_fnamemodify(a:worktree, ':p'), '.git']) | |
1 0.000011 if isdirectory(dotgit) | |
1 0.000005 return dotgit | |
elseif filereadable(dotgit) | |
" in case if the found '.git' is a file which was created via | |
" '--separate-git-dir' option | |
let lines = readfile(dotgit) | |
if !empty(lines) | |
let gitdir = matchstr(lines[0], '^gitdir:\s*\zs.\+$') | |
let is_abs = s:Path.is_absolute(gitdir) | |
return s:_fnamemodify((is_abs ? gitdir : dotgit[:-5] . gitdir), ':p:h') | |
endif | |
endif | |
return '' | |
FUNCTION <SNR>93_hash() | |
Called 4 times | |
Total time: 0.019491 | |
Self time: 0.019491 | |
count total (s) self (s) | |
4 0.000051 if exists('*sha256') | |
4 0.019418 return sha256(a:str) | |
else | |
" This gives up sha256ing but just adds up char with index. | |
let sum = 0 | |
for i in range(len(a:str)) | |
let sum += char2nr(a:str[i]) * (i + 1) | |
endfor | |
return printf('%x', sum) | |
endif | |
FUNCTION <SNR>96_parse_file() | |
Called 1 time | |
Total time: 0.053438 | |
Self time: 0.000295 | |
count total (s) self (s) | |
1 0.000012 let fail_silently = get(a:000, 0, 1) | |
1 0.053419 0.000277 return s:parse(join(readfile(a:file), "\n"), fail_silently) | |
FUNCTION <SNR>92__vital_loaded() | |
Called 1 time | |
Total time: 0.011599 | |
Self time: 0.000054 | |
count total (s) self (s) | |
1 0.005083 0.000023 let s:Prelude = a:V.import('Prelude') | |
1 0.006511 0.000025 let s:String = a:V.import('Data.String') | |
FUNCTION gita#argument#status#get_parser() | |
Called 1 time | |
Total time: 0.002485 | |
Self time: 0.000144 | |
count total (s) self (s) | |
1 0.000010 if !exists('s:parser') | |
1 0.000216 0.000024 let s:parser = s:ArgumentParser.new({ 'name': 'Show the working tree status in Gita interface',}) | |
1 0.000008 let types = s:ArgumentParser.types | |
1 0.000760 0.000032 call s:parser.add_argument( '--untracked-files', 'show untracked files, optional modes: all, normal, no. (Default: all)', { 'alias': 'u', 'choices': ['all', 'normal', 'no'], 'default': 'all', }) | |
1 0.000740 0.000019 call s:parser.add_argument( '--ignored', 'show ignored files', { }) | |
1 0.000729 0.000030 call s:parser.add_argument( '--ignore-submodules', 'ignore changes to submodules, optional when: all, dirty, untracked (Default: all)', { 'choices': ['all', 'dirty', 'untracked'], 'default': 'all', }) | |
1 0.000003 endif | |
1 0.000004 return s:parser | |
FUNCTION <SNR>93_diffidx() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return a:a ==# a:b ? -1 : strlen(s:common_head([a:a, a:b])) | |
FUNCTION <SNR>101_validate_status_rm() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if (a:status.is_staged || a:status.is_unstaged) && a:status.worktree ==# 'D' | |
" already removed from filesystem | |
return 0 | |
elseif a:status.is_staged || a:status.is_unstaged | |
if get(a:options, 'force', 0) | |
return 0 | |
else | |
call gita#util#info(printf( 'A file "%s" has changes and cannot be deleted. Use <Plug>(gita-action-RM) instead.', a:status.path,)) | |
return 1 | |
endif | |
elseif a:status.is_untracked || a:status.is_ignored | |
call gita#util#info(printf( 'An untracked/ignored file "%s" cannot be deleted.', a:status.path,)) | |
return 1 | |
elseif a:status.is_conflicted | |
if a:status.sign ==# 'AU' | |
call gita#util#error(printf( 'A added by us conflict file "%s" cannot be deleted. Use <Plug>(git-action-add) instead.', a:status.path,)) | |
return 1 | |
elseif a:status.sign ==# 'UA' | |
call gita#util#error(printf( 'A added by them conflict file "%s" cannot be deleted. Use <Plug>(git-action-add) instead.', a:status.path,)) | |
return 1 | |
elseif a:status.sign ==# 'AA' | |
call gita#util#error(printf( 'A both added conflict file "%s" cannot be deleted. Use <Plug>(git-action-add) instead.', a:status.path,)) | |
return 1 | |
elseif a:status.sign ==# 'UU' | |
call gita#util#error(printf( 'A both modified conflict file "%s" cannot be deleted. Use <Plug>(git-action-add) instead.', a:status.path,)) | |
return 1 | |
else | |
return 0 | |
endif | |
else | |
" it should not be called | |
call gita#util#error(printf( 'An unexpected pattern "%s" is called for "rm". Report it as an issue on GitHub.', a:status.sign,)) | |
return 1 | |
endif | |
FUNCTION airline#themes#get_highlight() | |
Called 44 times | |
Total time: 0.020896 | |
Self time: 0.001016 | |
count total (s) self (s) | |
44 0.020760 0.000879 return call('airline#highlighter#get_highlight', [a:group] + a:000) | |
FUNCTION <SNR>93__vital_loaded() | |
Called 1 time | |
Total time: 0.010349 | |
Self time: 0.000061 | |
count total (s) self (s) | |
1 0.000006 let s:V = a:V | |
1 0.005175 0.000021 let s:P = s:V.import('Prelude') | |
1 0.005161 0.000027 let s:L = s:V.import('Data.List') | |
FUNCTION <SNR>90_new() | |
Called 1 time | |
Total time: 0.000831 | |
Self time: 0.000197 | |
count total (s) self (s) | |
1 0.000019 let opts = extend({ 'no_cache': 0 }, get(a:000, 0, {})) | |
1 0.000166 0.000015 let cache = s:_get_instance_cache() | |
1 0.000201 0.000017 let git = cache.get(a:worktree, {}) | |
1 0.000007 if !empty(git) && !opts.no_cache | |
return git | |
endif | |
1 0.000058 0.000014 let config = s:get_config() | |
1 0.000179 0.000085 let git = extend(deepcopy(s:git), { 'worktree': a:worktree, 'repository': a:repository, 'cache': { 'repository': call( config.cache.repository.new, config.cache.repository_args, config.cache.repository ), 'uptime': call( config.cache.uptime.new, config.cache.uptime_args, config.cache.uptime ), }}) | |
1 0.000174 0.000013 call cache.set(a:worktree, git) | |
1 0.000004 return git | |
FUNCTION gita#util#buffer_is_listed_in_tabpage() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let bufnum = bufnr(a:expr) | |
if bufnum == -1 | |
return 0 | |
endif | |
let buflist = tabpagebuflist() | |
call gita#util#debug('buflist', buflist) | |
return string(bufnum) =~# printf('\v^%%(%s)$', join(buflist, '|')) | |
FUNCTION <SNR>83_conj() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return a:xs + [a:x] | |
FUNCTION <SNR>83_cons() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return [a:x] + a:xs | |
FUNCTION <SNR>82_strwidthpart() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION <SNR>22_init() | |
Called 4 times | |
Total time: 0.000064 | |
Self time: 0.000064 | |
count total (s) self (s) | |
4 0.000026 if s:airline_initialized | |
4 0.000015 return | |
endif | |
let s:airline_initialized = 1 | |
call airline#extensions#load() | |
call airline#init#sections() | |
let s:airline_theme_defined = exists('g:airline_theme') | |
if s:airline_theme_defined || !airline#switch_matching_theme() | |
let g:airline_theme = get(g:, 'airline_theme', 'dark') | |
call airline#switch_theme(g:airline_theme) | |
endif | |
silent doautocmd User AirlineAfterInit | |
FUNCTION <SNR>82_is_list() | |
Called 82 times | |
Total time: 0.001246 | |
Self time: 0.001246 | |
count total (s) self (s) | |
82 0.000938 return type(a:Value) ==# s:__TYPE_LIST | |
FUNCTION <SNR>83_sort_by() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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]') | |
FUNCTION <SNR>101_get_help() | |
Called 8 times | |
Total time: 0.000412 | |
Self time: 0.000412 | |
count total (s) self (s) | |
8 0.000130 let varname = printf('_help_%s', a:about) | |
8 0.000082 if get(b:, varname, 0) | |
return gita#util#interface_get_help(a:about) | |
else | |
8 0.000039 return [] | |
endif | |
FUNCTION <SNR>101_action_diff_open() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let options = extend({ 'opener': 'edit',}, a:options) | |
let bufname = bufname('%') | |
if !has_key(options, 'commit') | |
let commit = gita#util#ask('Checkout from: ', 'INDEX') | |
if strlen(commit) == 0 | |
redraw || call gita#util#warn('No valid commit was selected. The operation is canceled.') | |
return | |
endif | |
else | |
let commit = options.commit | |
endif | |
let commit = commit ==# 'INDEX' ? '' : commit | |
call gita#util#invoker_focus() | |
call gita#interface#diff#open(a:status, commit, options) | |
" update invoker | |
call gita#util#invoker_set(gita#util#invoker_get(), bufname) | |
FUNCTION <SNR>101_open() | |
Called 1 time | |
Total time: 3.028684 | |
Self time: 0.000688 | |
count total (s) self (s) | |
1 0.000298 0.000013 let gita = s:get_gita() | |
1 0.000088 0.000014 let invoker = gita#util#invoker_get() | |
1 0.000026 let options = extend(get(b:, 'options', {}), get(a:000, 0, {})) | |
1 0.000005 if !gita.enabled | |
redraw | call gita#util#info( printf( 'Git is not available in the current buffer "%s".', bufname('%'))) | |
return | |
endif | |
1 0.231287 0.000029 call gita#util#interface_open(s:const.bufname, 'support_window', { 'opener': 'topleft 15 split', 'range': 'tabpage',}) | |
1 0.032631 0.000038 silent execute 'setlocal filetype=' . s:const.filetype | |
1 0.000007 let b:_gita = gita | |
1 0.000007 let b:_invoker = invoker | |
1 0.000006 let b:_options = options | |
" check if construction is required | |
1 0.000011 if exists('b:_constructed') && !get(g:, 'gita#debug', 0) | |
" construction is not required. | |
call s:update() | |
return | |
endif | |
1 0.000006 let b:_constructed = 1 | |
" construction | |
1 0.000023 setlocal buftype=nofile bufhidden=hide noswapfile nobuflisted | |
1 0.000008 setlocal winfixheight | |
1 0.000007 setlocal cursorline | |
1 0.000246 autocmd! * <buffer> | |
" Note: | |
" | |
" :wq : QuitPre > BufWriteCmd > WinLeave > BufWinLeave | |
" :q : QuitPre > WinLeave > BufWinLeave | |
" :e : BufWinLeave | |
" :wincmd w : WinLeave | |
" | |
" s:ac_quit need to be called after BufWriteCmd and only when closing a | |
" buffre window (not when :e, :wincmd w). | |
" That's why the following autocmd combination is required. | |
1 0.000018 autocmd WinEnter <buffer> let b:_winleave = 0 | |
1 0.000014 autocmd WinLeave <buffer> let b:_winleave = 1 | |
1 0.000009 autocmd BufWinEnter <buffer> let b:_winleave = 0 | |
1 0.000009 autocmd BufWinLeave <buffer> if get(b:, '_winleave', 0) | call s:ac_quit() | endif | |
" define mappings | |
1 0.003087 0.000029 call s:defmap() | |
" update contents | |
1 2.760770 0.000041 call s:update() | |
FUNCTION <SNR>93_wcswidth() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return strwidth(a:str) | |
FUNCTION <SNR>97__vital_loaded() | |
Called 1 time | |
Total time: 0.034420 | |
Self time: 0.000129 | |
count total (s) self (s) | |
1 0.000007 let s:V = a:V | |
1 0.005228 0.000022 let s:Prelude = a:V.import('Prelude') | |
1 0.005961 0.000021 let s:Dict = a:V.import('Data.Dict') | |
1 0.007248 0.000022 let s:Core = a:V.import('VCS.Git.Core') | |
1 0.007647 0.000023 let s:StatusParser = a:V.import('VCS.Git.StatusParser') | |
1 0.008317 0.000021 let s:ConfigParser = a:V.import('VCS.Git.ConfigParser') | |
FUNCTION <SNR>63_get_prev_group() | |
Called 60 times | |
Total time: 0.003065 | |
Self time: 0.003065 | |
count total (s) self (s) | |
60 0.000435 let x = a:i - 1 | |
72 0.000359 while x >= 0 | |
64 0.000574 let group = a:sections[x][0] | |
64 0.000431 if group != '' && group != '|' | |
52 0.000217 return group | |
endif | |
12 0.000066 let x = x - 1 | |
12 0.000039 endwhile | |
8 0.000028 return '' | |
FUNCTION <SNR>81__unify_path() | |
Called 929 times | |
Total time: 0.081960 | |
Self time: 0.081960 | |
count total (s) self (s) | |
929 0.078780 return resolve(fnamemodify(a:path, ':p:gs?[\\/]?/?')) | |
FUNCTION <SNR>94_get_comment_char() | |
Called 4 times | |
Total time: 0.000255 | |
Self time: 0.000255 | |
count total (s) self (s) | |
4 0.000048 let default = get(a:000, 0, '#') | |
4 0.000051 let section = get(a:config, 'core', {}) | |
4 0.000031 if empty(section) | |
return default | |
endif | |
4 0.000043 return get(section, 'commentchar', default) | |
FUNCTION <SNR>93_pad_both_sides() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let char = get(a:, 1, ' ') | |
if strdisplaywidth(char) != 1 | |
throw "vital: Data.String: Can't use non-half-width characters for padding." | |
endif | |
let space = max([0, a:width - strdisplaywidth(a:str)]) | |
let left = space / 2 | |
let right = space - left | |
return s:_pad_with_char(a:str, left, right, char) | |
FUNCTION <SNR>19_Gita() | |
Called 1 time | |
Total time: 3.791536 | |
Self time: 0.001090 | |
count total (s) self (s) | |
1 3.791531 0.001085 return gita#Gita(call('gita#argument#parse', a:000)) | |
FUNCTION <SNR>100_new() | |
Called 1 time | |
Total time: 0.000184 | |
Self time: 0.000184 | |
count total (s) self (s) | |
" validate cache instance | |
1 0.000011 let required_methods = ['get', 'set', 'keys', 'remove', 'clear'] | |
6 0.000025 for method in required_methods | |
5 0.000033 if !has_key(a:cache, method) | |
throw "VCS.Git.Finder: the cache instance does not have required method." | |
endif | |
5 0.000015 endfor | |
1 0.000018 return extend(deepcopy(s:finder), { 'cache': a:cache }) | |
FUNCTION <SNR>82_escape_file_searching() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return escape(a:buffer_name, '*[]?{}, ') | |
FUNCTION <SNR>89_GitaBrowse() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if get(a:opts, 'open', 0) | |
for filename in a:opts.filenames | |
call gita#interface#browse#open(filename, a:opts) | |
endfor | |
elseif get(a:opts, 'echo', 0) | |
for filename in a:opts.filenames | |
echo gita#interface#browse#url(filename, a:opts) | |
endfor | |
elseif get(a:opts, 'yank', 0) | |
let contents = [] | |
for filename in a:opts.filenames | |
call add(contents, gita#interface#browse#url(filename, a:opts)) | |
endfor | |
call gita#util#yank(join(contents, "\n")) | |
call gita#util#info( len(contents) > 1 ? printf('%d urls are yanked', len(contents)) : 'A url is yanked',) | |
endif | |
FUNCTION airline#parts#filetype() | |
Called 16 times | |
Total time: 0.000186 | |
Self time: 0.000186 | |
count total (s) self (s) | |
16 0.000124 return &filetype | |
FUNCTION <SNR>83_min_by() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:max_by(a:list, '-(' . a:expr . ')') | |
FUNCTION airline#extensions#netrw#apply() | |
Called 4 times | |
Total time: 0.000329 | |
Self time: 0.000329 | |
count total (s) self (s) | |
4 0.000085 if &ft == 'netrw' | |
let spc = g:airline_symbols.space | |
call a:1.add_section('airline_a', spc.'netrw'.spc) | |
if exists('*airline#extensions#branch#get_head') | |
call a:1.add_section('airline_b', spc.'%{airline#extensions#branch#get_head()}'.spc) | |
endif | |
call a:1.add_section('airline_c', spc.'%f'.spc) | |
call a:1.split() | |
call a:1.add_section('airline_y', spc.'%{airline#extensions#netrw#sortstring()}'.spc) | |
return 1 | |
endif | |
FUNCTION airline#parts#iminsert() | |
Called 12 times | |
Total time: 0.000410 | |
Self time: 0.000410 | |
count total (s) self (s) | |
12 0.000139 if g:airline_detect_iminsert && &iminsert && exists('b:keymap_name') | |
return toupper(b:keymap_name) | |
endif | |
12 0.000054 return '' | |
FUNCTION <SNR>93_split_by_displaywidth() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if a:width is 0 | |
return [''] | |
endif | |
let lines = [] | |
let cs = split(a:expr, '\zs') | |
let cs_index = 0 | |
let text = '' | |
while cs_index < len(cs) | |
if cs[cs_index] is "\n" | |
let text = s:padding_by_displaywidth(text, a:width, a:float) | |
let lines += [text] | |
let text = '' | |
else | |
let w = strdisplaywidth(text . cs[cs_index]) | |
if w < a:width | |
let text .= cs[cs_index] | |
elseif a:width < w | |
let text = s:padding_by_displaywidth(text, a:width, a:float) | |
else | |
let text .= cs[cs_index] | |
endif | |
if a:width <= w | |
let lines += [text] | |
let text = '' | |
if a:is_wrap | |
if a:width < w | |
if a:width < strdisplaywidth(cs[cs_index]) | |
while get(cs, cs_index, "\n") isnot "\n" | |
let cs_index += 1 | |
endwhile | |
continue | |
else | |
let text = cs[cs_index] | |
endif | |
endif | |
else | |
while get(cs, cs_index, "\n") isnot "\n" | |
let cs_index += 1 | |
endwhile | |
continue | |
endif | |
endif | |
endif | |
let cs_index += 1 | |
endwhile | |
if !empty(text) | |
let lines += [ s:padding_by_displaywidth(text, a:width, a:float) ] | |
endif | |
return lines | |
FUNCTION gita#interface#status#define_syntax() | |
Called 1 time | |
Total time: 0.000190 | |
Self time: 0.000190 | |
count total (s) self (s) | |
1 0.000039 syntax match GitaStaged /\v^[ MADRC][ MD]/he=e-1 contains=ALL | |
1 0.000018 syntax match GitaUnstaged /\v^[ MADRC][ MD]/hs=s+1 contains=ALL | |
1 0.000019 syntax match GitaStaged /\v^[ MADRC]\s.*$/hs=s+3 contains=ALL | |
1 0.000017 syntax match GitaUnstaged /\v^.[MDAU?].*$/hs=s+3 contains=ALL | |
1 0.000015 syntax match GitaIgnored /\v^\!\!\s.*$/ | |
1 0.000014 syntax match GitaUntracked /\v^\?\?\s.*$/ | |
1 0.000022 syntax match GitaConflicted /\v^%(DD|AU|UD|UA|DU|AA|UU)\s.*$/ | |
1 0.000014 syntax match GitaComment /\v^.*$/ contains=ALL | |
1 0.000015 syntax match GitaBranch /\v`[^`]{-}`/hs=s+1,he=e-1 | |
FUNCTION search_pulse#PulseFirst() | |
Called 2 times | |
Total time: 0.000273 | |
Self time: 0.000273 | |
count total (s) self (s) | |
2 0.000113 let t = getcmdtype() | |
2 0.000039 if t == '/' || t == '?' | |
return "\<cr>:call search_pulse#Pulse()\<cr>" | |
endif | |
2 0.000023 return "\<cr>" | |
FUNCTION <SNR>82_is_unix() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:is_unix | |
FUNCTION <SNR>94_get_merge_msg() | |
Called 4 times | |
Total time: 0.001156 | |
Self time: 0.000212 | |
count total (s) self (s) | |
" Enumerates conflicts that happen during your current merge. | |
4 0.000876 0.000101 let filename = s:Path.join(a:repository, 'MERGE_MSG') | |
4 0.000247 0.000077 return s:_readfile(filename) | |
FUNCTION <SNR>83_push() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
call add(a:list, a:val) | |
return a:list | |
FUNCTION <SNR>101_ensure_list() | |
Called 4 times | |
Total time: 0.000217 | |
Self time: 0.000137 | |
count total (s) self (s) | |
4 0.000191 0.000110 return s:Prelude.is_list(a:x) ? a:x : [a:x] | |
FUNCTION <SNR>83_foldl() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION <SNR>83_foldr() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:foldl(a:f, a:init, reverse(copy(a:xs))) | |
FUNCTION <SNR>83_uniq() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:uniq_by(a:list, 'v:val') | |
FUNCTION <SNR>101_action_diff_compare() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let options = extend({}, a:options) | |
if !has_key(options, 'commit') | |
let commit = gita#util#ask('Checkout from: ', 'INDEX') | |
if strlen(commit) == 0 | |
redraw || call gita#util#warn('No valid commit was selected. The operation is canceled.') | |
return | |
endif | |
else | |
let commit = options.commit | |
endif | |
let commit = commit ==# 'INDEX' ? '' : commit | |
call gita#util#invoker_focus() | |
call gita#interface#diff#compare(a:status, commit, options) | |
FUNCTION <SNR>94_get_local_hash() | |
Called 1 time | |
Total time: 0.000399 | |
Self time: 0.000045 | |
count total (s) self (s) | |
1 0.000265 0.000023 let filename = s:Path.join(a:repository, 'refs', 'heads', a:branch) | |
1 0.000128 0.000017 return s:_readline(filename) | |
FUNCTION <SNR>102_get_ours() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let opts = extend({ 'from_index': 1,}, get(a:000, 0, {})) | |
if opts.from_index | |
let result = s:C.exec(['show', ':2:' . a:filename], opts) | |
if result.status == 0 | |
return split(result.stdout, '\v\r?\n') | |
endif | |
return result | |
else | |
return s:strip_theirs(readfile(a:filename), 1) | |
endif | |
FUNCTION <SNR>104_open() | |
Called 1 time | |
Total time: 0.145245 | |
Self time: 0.002339 | |
count total (s) self (s) | |
1 0.000009 let save_wildignore = &wildignore | |
1 0.000011 let &wildignore = '' | |
1 0.000005 try | |
1 0.000027 0.000014 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 | |
1 0.000028 let loaded = !bufloaded(a:buffer) | |
1 0.000027 0.000014 if s:P.is_string(a:buffer) | |
1 0.145012 0.002132 execute a:opener '`=a:buffer`' | |
1 0.000007 elseif s:P.is_number(a:buffer) | |
silent execute a:opener | |
execute a:buffer 'buffer' | |
else | |
throw 'vital: Vim.Buffer: Unknown opener type.' | |
endif | |
1 0.000003 endif | |
1 0.000005 finally | |
1 0.000015 let &wildignore = save_wildignore | |
1 0.000005 endtry | |
1 0.000005 return loaded | |
FUNCTION <SNR>84_split() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return split(a:path, s:path_sep_pattern) | |
FUNCTION <SNR>81_unload() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let s:loaded = {} | |
FUNCTION <SNR>103__vital_loaded() | |
Called 1 time | |
Total time: 0.014384 | |
Self time: 0.000055 | |
count total (s) self (s) | |
1 0.000007 let s:V = a:V | |
1 0.005091 0.000021 let s:P = s:V.import('Prelude') | |
1 0.009280 0.000021 let s:B = s:V.import('Vim.Buffer') | |
FUNCTION <SNR>94_get_merge_mode() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
" Used to communicate constraints that were originally given to git merge to | |
" git commit when a merge conflicts, and a separate git commit is needed to | |
" conclude it. Currently --no-ff is the only constraints passed this way. | |
let filename = s:Path.join(a:repository, 'MERGE_MODE') | |
return s:_readline(filename) | |
FUNCTION <SNR>87_new() | |
Called 4 times | |
Total time: 0.000774 | |
Self time: 0.000244 | |
count total (s) self (s) | |
4 0.000038 if !has_key(s:_completers, a:name) | |
throw printf( 'vital: ArgumentParser.Completer: "%s" is not defined', a:name,) | |
endif | |
4 0.000610 0.000080 let instance = call(s:_completers[a:name], a:000) | |
4 0.000032 let instance.__name__ = a:name | |
4 0.000018 return instance | |
FUNCTION <SNR>97_opts2args() | |
Called 6 times | |
Total time: 0.010097 | |
Self time: 0.009998 | |
count total (s) self (s) | |
6 0.000054 let args = [] | |
45 0.000444 for [key, default] in items(a:defaults) | |
39 0.000403 if has_key(a:opts, key) | |
2 0.000032 let val = get(a:opts, key) | |
2 0.000149 0.000093 if s:Prelude.is_number(default) && val | |
1 0.000013 if strlen(key) == 1 | |
call add(args, printf('-%s', key)) | |
else | |
1 0.000049 call add(args, printf('--%s', substitute(key, '_', '-', 'g'))) | |
1 0.000005 endif | |
1 0.000014 elseif s:Prelude.is_string(default) && default =~# '\v^\=' | |
if (s:Prelude.is_number(val) && val == 1) | |
unlet! val | |
let val = default[1:] | |
endif | |
if strlen(key) == 1 | |
call add(args, printf('-%s%s', key, val)) | |
else | |
call add(args, printf('--%s=%s', substitute(key, '_', '-', 'g'), val)) | |
endif | |
elseif s:Prelude.is_string(default) && default !~# '\v^\=' && default !=# val | |
if strlen(key) == 1 | |
call add(args, printf('-%s', key)) | |
else | |
call add(args, printf('--%s', substitute(key, '_', '-', 'g'))) | |
endif | |
call add(args, val) | |
endif | |
2 0.000013 unlet val | |
2 0.000008 endif | |
39 0.000183 unlet default | |
39 0.000153 endfor | |
6 0.000039 return args | |
FUNCTION gita#interface#status#get_selected_status() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if s:validate_filetype('gita#interface#status#get_selected_status()') | |
return | |
endif | |
return call('s:get_selected_status', a:000) | |
FUNCTION <SNR>84_separator() | |
Called 286 times | |
Total time: 0.007974 | |
Self time: 0.007974 | |
count total (s) self (s) | |
286 0.006748 return fnamemodify('.', ':p')[-1 :] | |
FUNCTION <SNR>94__readfile() | |
Called 21 times | |
Total time: 0.013946 | |
Self time: 0.013946 | |
count total (s) self (s) | |
21 0.000593 if !filereadable(a:path) | |
12 0.000068 return [] | |
endif | |
9 0.013064 return readfile(a:path) | |
FUNCTION 11() | |
Called 4 times | |
Total time: 0.002932 | |
Self time: 0.002157 | |
count total (s) self (s) | |
" determind name | |
4 0.000059 if a:name =~# '^--\?' | |
3 0.000020 let positional = 0 | |
3 0.000053 let name = substitute(a:name, '^--\?', '', '') | |
3 0.000011 else | |
1 0.000005 let positional = 1 | |
1 0.000006 let name = a:name | |
1 0.000003 endif | |
" determind arguments | |
4 0.000020 if a:0 == 0 | |
let description = '' | |
let options = {} | |
elseif a:0 == 1 | |
if s:P.is_string(a:1) | |
let description = a:1 | |
let options = {} | |
else | |
let description = '' | |
let options = a:1 | |
endif | |
elseif a:0 == 2 | |
4 0.000026 let description = a:1 | |
4 0.000023 let options = a:2 | |
4 0.000012 else | |
throw 'vital: ArgumentParser: too much arguments are specified' | |
endif | |
4 0.000040 let choices = get(options, 'choices', []) | |
" create an argument instance | |
4 0.000145 let argument = extend({ 'name': name, 'terminal': 0, 'positional': positional, 'required': 0, 'default': '', 'alias': '', 'type': -1, 'deniable': 0, 'choices': choices, 'pattern': '', 'conflicts': [], 'dependencies': [], 'superordinates': [],}, options) | |
" automatically assign argument type | |
4 0.000023 if argument.type == -1 | |
4 0.000026 if !empty(argument.choices) | |
2 0.000016 let argument.type = s:const.types.choice | |
2 0.000011 elseif !empty(argument.pattern) | |
let argument.type = s:const.types.value | |
elseif argument.positional | |
1 0.000008 let argument.type = s:const.types.value | |
1 0.000003 else | |
1 0.000007 let argument.type = s:const.types.switch | |
1 0.000003 endif | |
4 0.000011 endif | |
" validate options | |
4 0.000022 if positional && argument.alias | |
throw 'vital: ArgumentParser: "alias" option cannot be specified to a positional argument' | |
elseif positional && argument.alias | |
throw 'vital: ArgumentParser: "default" option cannot be specified to a positional argument' | |
elseif positional && argument.type != s:const.types.value && argument.type != s:const.types.choice | |
throw 'vital: ArgumentParser: "type" option cannot be ANY or SWITCH for a positional argument' | |
elseif positional && !empty(argument.conflicts) | |
throw 'vital: ArgumentParser: "conflicts" option cannot be specified to a positional argument' | |
elseif positional && !empty(argument.dependencies) | |
throw 'vital: ArgumentParser: "dependencies" option cannot be specified to a positional argument' | |
elseif positional && !empty(argument.superordinates) | |
throw 'vital: ArgumentParser: "superordinates" option cannot be specified to a positional argument' | |
elseif !empty(argument.default) && argument.required | |
throw 'vital: ArgumentParser: "default" and "required" option cannot be specified together' | |
elseif empty(argument.choices) && argument.type == s:const.types.choice | |
throw 'vital: ArgumentParser: "type" is specified to "choice" but no "choices" is specified' | |
elseif !empty(argument.pattern) && argument.type == s:const.types.switch | |
throw 'vital: ArgumentParser: "pattern" option cannot be specified for SWITCH argument' | |
endif | |
" register argument | |
4 0.000035 let self.arguments[name] = argument | |
" register positional | |
4 0.000017 if positional | |
1 0.000013 call add(self.positional, argument.name) | |
1 0.000003 endif | |
" register required | |
4 0.000019 if argument.required | |
call add(self.required, argument.name) | |
endif | |
" register alias | |
4 0.000026 if !empty(argument.alias) | |
1 0.000010 let self.alias[argument.alias] = argument.name | |
1 0.000003 endif | |
" register completer | |
4 0.000029 if !has_key(argument, 'completer') | |
4 0.000025 if !empty(argument.choices) | |
2 0.000406 0.000043 let argument.completer = s:C.new('choice', { 'choices': argument.choices }) | |
2 0.000006 else | |
2 0.000442 0.000031 let argument.completer = s:C.new('file') | |
2 0.000007 endif | |
4 0.000012 endif | |
" return an argument instance for further manipulation | |
4 0.000017 return argument | |
FUNCTION 12() | |
Called 1 time | |
Total time: 0.000026 | |
Self time: 0.000026 | |
count total (s) self (s) | |
1 0.000009 let conflicts = self.arguments[a:name].conflicts | |
1 0.000006 if empty(conflicts) | |
1 0.000004 return [] | |
endif | |
let conflicts_pattern = printf('\v^%%(%s)$', join(conflicts, '|')) | |
return filter(keys(a:opts), 'v:val =~# conflicts_pattern') | |
FUNCTION 13() | |
Called 1 time | |
Total time: 0.000027 | |
Self time: 0.000027 | |
count total (s) self (s) | |
1 0.000010 let superordinates = self.arguments[a:name].superordinates | |
1 0.000006 if empty(superordinates) | |
1 0.000004 return [] | |
endif | |
let superordinates_pattern = printf('\v^%%(%s)$', join(superordinates, '|')) | |
return filter(keys(a:opts), 'v:val =~# superordinates_pattern') | |
FUNCTION 14() | |
Called 1 time | |
Total time: 0.000026 | |
Self time: 0.000026 | |
count total (s) self (s) | |
1 0.000010 let dependencies = self.arguments[a:name].dependencies | |
1 0.000006 if empty(dependencies) | |
1 0.000004 return [] | |
endif | |
let exists_pattern = printf('\v^%%(%s)$', join(keys(a:opts), '|')) | |
return filter(dependencies, 'v:val !~# exists_pattern') | |
FUNCTION 15() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return deepcopy(self.positional) | |
FUNCTION 16() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return map(filter(values(self.arguments), '!v:val.positional'), 'v:val.name') | |
FUNCTION 17() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return keys(self.alias) | |
FUNCTION 18() | |
Called 1 time | |
Total time: 0.003354 | |
Self time: 0.000332 | |
count total (s) self (s) | |
1 0.000009 let cmdline = get(a:000, 0, '') | |
1 0.000644 0.000032 let opts = self.parse_cmdline(cmdline, extend({ '__bang__': a:bang == '!', '__range__': a:range,}, get(a:000, 1, {}))) | |
" assign default values | |
1 0.000019 let exists_pattern = printf('\v^%%(%s)$', join(keys(opts), '|')) | |
2 0.000013 for argument in values(self.arguments) | |
1 0.000008 if !empty(argument.default) && argument.name !~# exists_pattern | |
let opts[argument.name] = argument.default | |
endif | |
1 0.000002 endfor | |
" validation | |
1 0.000055 0.000019 let opts = self._call_hook('pre_validation', opts) | |
1 0.000004 if self.validate_required | |
1 0.000067 0.000013 call self._validate_required(opts) | |
1 0.000003 endif | |
1 0.000004 if self.validate_types | |
1 0.000712 0.000013 call self._validate_types(opts) | |
1 0.000003 endif | |
1 0.000005 if self.validate_conflicts | |
1 0.000411 0.000014 call self._validate_conflicts(opts) | |
1 0.000003 endif | |
1 0.000005 if self.validate_superordinates | |
1 0.000433 0.000017 call self._validate_superordinates(opts) | |
1 0.000003 endif | |
1 0.000005 if self.validate_dependencies | |
1 0.000409 0.000013 call self._validate_dependencies(opts) | |
1 0.000003 endif | |
1 0.000005 if self.validate_pattern | |
1 0.000386 0.000014 call self._validate_pattern(opts) | |
1 0.000003 endif | |
1 0.000058 0.000021 let opts = self._call_hook('post_validation', opts) | |
1 0.000004 return opts | |
FUNCTION 19() | |
Called 1 time | |
Total time: 0.000612 | |
Self time: 0.000043 | |
count total (s) self (s) | |
1 0.000132 0.000016 let args = s:splitargs(a:cmdline) | |
1 0.000475 0.000022 return call(self.parse_args, [args] + a:000, self) | |
FUNCTION <SNR>63_get_accented_line() | |
Called 44 times | |
Total time: 0.007651 | |
Self time: 0.007651 | |
count total (s) self (s) | |
44 0.000262 if a:self._context.active | |
28 0.000224 let contents = [] | |
28 0.000626 let content_parts = split(a:contents, '__accent') | |
64 0.000318 for cpart in content_parts | |
36 0.000756 let accent = matchstr(cpart, '_\zs[^#]*\ze') | |
36 0.000454 call add(contents, cpart) | |
36 0.000112 endfor | |
28 0.000499 let line = join(contents, a:group) | |
28 0.000654 let line = substitute(line, '__restore__', a:group, 'g') | |
28 0.000094 else | |
16 0.000579 let line = substitute(a:contents, '%#__accent[^#]*#', '', 'g') | |
16 0.000336 let line = substitute(line, '%#__restore__#', '', 'g') | |
16 0.000053 endif | |
44 0.000247 return line | |
FUNCTION gita#util#is_float() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return call(s:Prelude.is_float, a:000, s:Prelude) | |
FUNCTION 100() | |
Called 1 time | |
Total time: 0.000545 | |
Self time: 0.000225 | |
count total (s) self (s) | |
1 0.000338 0.000032 let range = s:_make_config(self, map(copy(a:000), '{"range": v:val}')).range | |
1 0.000005 if range ==# 'tabpage' | |
1 0.000009 let tabpages = [tabpagenr()] | |
1 0.000003 else | |
let s:base = tabpagenr() | |
let tabpages = sort(range(1, tabpagenr('$')), 's:_distance') | |
endif | |
2 0.000009 for tabnr in tabpages | |
1 0.000008 let s:base = tabpagewinnr(tabnr) | |
1 0.000008 let buflist = tabpagebuflist(tabnr) | |
2 0.000021 for winnr in sort(range(1, len(buflist)), 's:_distance') | |
1 0.000029 0.000015 if self.is_managed(buflist[winnr - 1]) | |
return [tabnr, winnr, buflist[winnr - 1]] | |
endif | |
1 0.000003 endfor | |
1 0.000002 endfor | |
1 0.000004 return [] | |
FUNCTION 101() | |
Called 1 time | |
Total time: 0.000941 | |
Self time: 0.000084 | |
count total (s) self (s) | |
1 0.000344 0.000033 let range = s:_make_config(self, map(copy(a:000), '{"range": v:val}')).range | |
1 0.000008 if range !=# 'all' && range !=# 'tabpage' | |
return 0 | |
endif | |
1 0.000561 0.000016 let near = self.nearest(range) | |
1 0.000006 if empty(near) | |
1 0.000003 return 0 | |
endif | |
silent execute 'tabnext' near[0] | |
silent execute near[1] 'wincmd w' | |
return 1 | |
FUNCTION 102() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let cmd = a:cmd =~ '%s' ? a:cmd : a:cmd . ' %s' | |
for bufnr in self.list() | |
execute substitute(cmd, '%s', bufnr, '') | |
endfor | |
FUNCTION airline#highlighter#add_separator() | |
Called 8 times | |
Total time: 0.011059 | |
Self time: 0.000369 | |
count total (s) self (s) | |
8 0.000137 let s:separators[a:from.a:to] = [a:from, a:to, a:inverse] | |
8 0.010883 0.000193 call <sid>exec_separator({}, a:from, a:to, a:inverse, '') | |
FUNCTION gita#interface#status#open() | |
Called 1 time | |
Total time: 3.028717 | |
Self time: 0.000033 | |
count total (s) self (s) | |
1 3.028712 0.000028 call call('s:open', a:000) | |
FUNCTION gita#interface#status#smart_map() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if s:validate_filetype('gita#interface#status#smart_map()') | |
return | |
endif | |
call call('s:smart_map', [a:lhs, a:rhs]) | |
FUNCTION 20() | |
Called 2 times | |
Total time: 0.000812 | |
Self time: 0.000774 | |
count total (s) self (s) | |
2 0.000042 let opts = extend({ '__unknown__': [], '__args__': [],}, get(a:000, 0, {})) | |
2 0.000026 let opts.__args__ = extend(opts.__args__, a:args) | |
2 0.000017 let length = len(opts.__args__) | |
2 0.000011 let cursor = 0 | |
2 0.000045 let arguments_pattern = printf('\v^%%(%s)$', join(keys(self.arguments), '|')) | |
2 0.000019 let positional_length = len(self.positional) | |
2 0.000012 let positional_cursor = 0 | |
2 0.000013 while cursor < length | |
1 0.000009 let cword = opts.__args__[cursor] | |
1 0.000012 let nword = (cursor+1 < length) ? opts.__args__[cursor+1] : '' | |
1 0.000011 if cword =~# '^--\?' | |
" optional argument | |
let m = matchlist(cword, '\v^\-\-?([^=]+|)%(\=(.*)|)') | |
let name = get(self.alias, m[1], m[1]) | |
if name =~# arguments_pattern | |
if !empty(m[2]) | |
let value = s:strip_quotes(m[2]) | |
elseif get(self, 'enable_positional_assign', 0) && !empty(nword) && nword !~# '^--\?' | |
let value = s:strip_quotes(nword) | |
let cursor += 1 | |
else | |
let value = 1 | |
endif | |
elseif substitute(name, '^no-', '', '') =~# arguments_pattern | |
let name = substitute(name, '^no-', '', '') | |
if self.arguments[name].deniable | |
let value = 0 | |
else | |
call add(opts.__unknown__, cword) | |
silent! unlet name | |
silent! unlet value | |
endif | |
else | |
call add(opts.__unknown__, cword) | |
silent! unlet name | |
silent! unlet value | |
endif | |
else | |
1 0.000006 if positional_cursor < positional_length | |
1 0.000009 let name = self.positional[positional_cursor] | |
1 0.000051 0.000014 let value = s:strip_quotes(cword) | |
1 0.000007 let positional_cursor += 1 | |
1 0.000002 else | |
call add(opts.__unknown__, cword) | |
silent! unlet name | |
silent! unlet value | |
endif | |
1 0.000003 endif | |
1 0.000009 if exists('name') && exists('value') | |
1 0.000007 let opts[name] = value | |
" terminal check | |
1 0.000006 if self.arguments[name].terminal | |
1 0.000006 let cursor += 1 | |
1 0.000004 break | |
endif | |
endif | |
silent! unlet name | |
silent! unlet value | |
let cursor += 1 | |
endwhile | |
" assign remaining args as unknown | |
2 0.000034 let opts.__unknown__ = extend( opts.__unknown__, opts.__args__[ cursor : ],) | |
2 0.000009 return opts | |
FUNCTION 21() | |
Called 1 time | |
Total time: 0.000054 | |
Self time: 0.000054 | |
count total (s) self (s) | |
1 0.000024 let exists_pattern = printf('\v^%%(%s)$', join(keys(a:opts), '|')) | |
1 0.000007 for name in self.required | |
if name !~# exists_pattern | |
throw printf( 'vital: ArgumentParser: "%s" argument is required but not specified.', name,) | |
endif | |
endfor | |
FUNCTION 22() | |
Called 1 time | |
Total time: 0.000700 | |
Self time: 0.000686 | |
count total (s) self (s) | |
6 0.000040 for [name, value] in items(a:opts) | |
5 0.000077 if name !~# '\v^__.*__$' | |
1 0.000008 let type = self.arguments[name].type | |
1 0.000029 0.000015 if type == s:const.types.value && s:P.is_number(value) | |
throw printf( 'vital: ArgumentParser: "%s" argument is VALUE argument but no value is specified.', name,) | |
elseif type == s:const.types.switch && s:P.is_string(value) | |
throw printf( 'vital: ArgumentParser: "%s" argument is SWITCH argument but "%s" is specified.', name, value,) | |
elseif type == s:const.types.choice | |
let pattern = printf('\v^%%(%s)$', join(self.arguments[name].choices, '|')) | |
if s:P.is_number(value) | |
throw printf( 'vital: ArgumentParser: "%s" argument is CHOICE argument but no value is specified.', name,) | |
elseif value !~# pattern | |
throw printf( 'vital: ArgumentParser: "%s" argument is CHOICE argument but an invalid value "%s" is specified.', name, value,) | |
endif | |
endif | |
1 0.000002 endif | |
5 0.000019 silent! unlet name | |
5 0.000018 silent! unlet value | |
5 0.000014 endfor | |
FUNCTION 23() | |
Called 1 time | |
Total time: 0.000397 | |
Self time: 0.000371 | |
count total (s) self (s) | |
6 0.000039 for [name, value] in items(a:opts) | |
5 0.000075 if name !~# '\v^__.*__$' | |
1 0.000042 0.000016 let conflicts = self.get_conflicted_arguments(name, a:opts) | |
1 0.000006 if !empty(conflicts) | |
throw printf( 'vital: ArgumentParser: "%s" argument conflicts with "%s"', name, conflicts[0],) | |
endif | |
1 0.000002 endif | |
5 0.000018 silent! unlet name | |
5 0.000016 silent! unlet value | |
5 0.000014 endfor | |
FUNCTION 24() | |
Called 1 time | |
Total time: 0.000416 | |
Self time: 0.000388 | |
count total (s) self (s) | |
6 0.000037 for [name, value] in items(a:opts) | |
5 0.000075 if name !~# '\v^__.*__$' | |
1 0.000044 0.000016 let superordinates = self.get_superordinate_arguments(name, a:opts) | |
1 0.000010 if !empty(self.arguments[name].superordinates) && empty(superordinates) | |
throw printf( 'vital: ArgumentParser: No superordinate argument of "%s" is specified', name,) | |
endif | |
1 0.000002 endif | |
5 0.000018 silent! unlet name | |
5 0.000017 silent! unlet value | |
5 0.000012 endfor | |
FUNCTION 25() | |
Called 1 time | |
Total time: 0.000396 | |
Self time: 0.000370 | |
count total (s) self (s) | |
6 0.000037 for [name, value] in items(a:opts) | |
5 0.000074 if name !~# '\v^__.*__$' | |
1 0.000043 0.000017 let dependencies = self.get_missing_dependencies(name, a:opts) | |
1 0.000006 if !empty(dependencies) | |
throw printf( 'vital: ArgumentParser: "%s" argument is required for "%s" but missing', dependencies[0], name,) | |
endif | |
1 0.000002 endif | |
5 0.000017 silent! unlet name | |
5 0.000016 silent! unlet value | |
5 0.000013 endfor | |
FUNCTION <SNR>86_foldl() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:_foldl(a:f, a:init, items(a:dict)) | |
FUNCTION 27() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if a:arglead =~# '\v^\-\-?[^=]+\=' | |
return self._complete_optional_argument_value( a:arglead, a:cmdline, a:cursorpos, a:opts,) | |
elseif a:arglead =~# '\v^\-\-?' | |
return self._complete_optional_argument( a:arglead, a:cmdline, a:cursorpos, a:opts,) | |
else | |
return self._complete_positional_argument_value( a:arglead, a:cmdline, a:cursorpos, a:opts,) | |
endif | |
FUNCTION 28() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let m = matchlist(a:arglead, '\v^\-\-?([^=]+)\=(.*)') | |
let name = m[1] | |
let value = m[2] | |
if has_key(self.arguments, name) | |
let candidates = self.arguments[name].completer.complete( value, a:cmdline, a:cursorpos, a:opts,) | |
else | |
let candidates = [] | |
endif | |
return candidates | |
FUNCTION 29() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let candidates = [] | |
for argument in values(self.arguments) | |
if has_key(a:opts, argument.name) || argument.positional | |
continue | |
elseif !empty(argument.conflicts) && !empty(self.get_conflicted_arguments(argument.name, a:opts)) | |
continue | |
elseif !empty(argument.superordinates) && empty(self.get_superordinate_arguments(argument.name, a:opts)) | |
continue | |
endif | |
if '--' . argument.name =~# '^' . a:arglead | |
call add(candidates, '--' . argument.name) | |
endif | |
if !empty(argument.alias) && '-' . argument.alias =~# '^' . a:arglead | |
call add(candidates, '-' . argument.alias) | |
endif | |
endfor | |
return candidates | |
FUNCTION <SNR>86_foldr() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:_foldl(a:f, a:init, reverse(items(a:dict))) | |
FUNCTION <SNR>94__fnamemodify() | |
Called 5 times | |
Total time: 0.000534 | |
Self time: 0.000185 | |
count total (s) self (s) | |
5 0.000088 let path = a:path !=# '' ? fnamemodify(a:path, a:mods) : '' | |
5 0.000417 0.000067 return s:Path.remove_last_separator(path) | |
FUNCTION <SNR>93_pad_between_letters() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let char = get(a:, 1, ' ') | |
if strdisplaywidth(char) != 1 | |
throw "vital: Data.String: Can't use non-half-width characters for padding." | |
endif | |
let letters = split(a:str, '\zs') | |
let each_width = a:width / len(letters) | |
let str = join(map(letters, 's:pad_both_sides(v:val, each_width, char)'), '') | |
if a:width - strdisplaywidth(str) > 0 | |
return char. s:pad_both_sides(str, a:width - 1, char) | |
endif | |
return str | |
FUNCTION <SNR>93_substitute_last() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return substitute(a:expr, printf('.*\zs%s', a:pat), a:sub, '') | |
FUNCTION <SNR>84_which() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return exepath(a:str) | |
FUNCTION <SNR>93_strchars() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return strchars(a:str) | |
FUNCTION gita#util#buffer_update() | |
Called 4 times | |
Total time: 0.000889 | |
Self time: 0.000889 | |
count total (s) self (s) | |
4 0.000041 let saved_cur = getpos('.') | |
4 0.000035 let saved_undolevels = &undolevels | |
4 0.000055 setlocal undolevels=-1 | |
4 0.000407 silent %delete _ | |
4 0.000147 call setline(1, a:buflines) | |
4 0.000042 call setpos('.', saved_cur) | |
4 0.000071 silent execute 'setlocal undolevels=' . saved_undolevels | |
4 0.000032 setlocal nomodified | |
FUNCTION vital#_vim_gita#new() | |
Called 14 times | |
Total time: 0.065096 | |
Self time: 0.000237 | |
count total (s) self (s) | |
14 0.065042 0.000183 return s:_import('') | |
FUNCTION <SNR>93_padding_by_displaywidth() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let padding_char = ' ' | |
let n = a:width - strdisplaywidth(a:expr) | |
if n <= 0 | |
let n = 0 | |
endif | |
if a:float < 0 | |
return a:expr . repeat(padding_char, n) | |
elseif 0 < a:float | |
return repeat(padding_char, n) . a:expr | |
else | |
if n % 2 is 0 | |
return repeat(padding_char, n / 2) . a:expr . repeat(padding_char, n / 2) | |
else | |
return repeat(padding_char, (n - 1) / 2) . a:expr . repeat(padding_char, (n - 1) / 2) . padding_char | |
endif | |
endif | |
FUNCTION <SNR>84_is_case_tolerant() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:is_case_tolerant | |
FUNCTION <SNR>93__split_by_wcswidth() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let memo = [] | |
let body = a:body | |
while s:P.wcswidth(body) > a:x | |
let [tmp, body] = s:_split_by_wcswidth_once(body, a:x) | |
call add(memo, tmp) | |
endwhile | |
call add(memo, body) | |
return memo | |
FUNCTION <SNR>93__replace() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return substitute(a:str, '\V'.escape(a:from, '\'), escape(a:to, '\'), a:flags) | |
FUNCTION 30() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let candidates = [] | |
let npositional = 0 | |
for argument in values(self.arguments) | |
if argument.positional && has_key(a:opts, argument.name) | |
let npositional += 1 | |
endif | |
endfor | |
if len(a:arglead) > 0 | |
let npositional -= 1 | |
endif | |
let cpositional = get(self.arguments, get(self.positional, npositional, -1), {}) | |
if !empty(cpositional) | |
let candidates = cpositional.completer.complete( a:arglead, a:cmdline, a:cursorpos, a:opts,) | |
endif | |
return candidates | |
FUNCTION 31() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let candidates = self.gather_candidates( a:arglead, a:cmdline, a:cursorpos, a:args,) | |
let candidates = filter( deepcopy(candidates), printf('v:val =~# "^%s"', a:arglead),) | |
return candidates | |
FUNCTION 33() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
" Ref: Vital.vim OptionParser.vim | |
let candidates = split( glob(s:P.join(self.base_dir, a:arglead . '*'), 0), "\n") | |
" substitute 'base_dir' | |
call map(candidates, printf("substitute(v:val, '^%s/', '', '')", self.base_dir)) | |
" substitute /home/<username> to ~/ if ~/ is specified | |
if a:arglead =~# '^\~' | |
let home_dir = expand('~') | |
call map(candidates, printf("substitute(v:val, '^%s', '~', '')", home_dir)) | |
endif | |
call map(candidates, "escape(isdirectory(v:val) ? v:val.'/' : v:val, ' \\')") | |
return candidates | |
FUNCTION 34() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let candidates = self.gather_candidates( a:arglead, a:cmdline, a:cursorpos, a:args,) | |
let candidates = filter( deepcopy(candidates), printf('v:val =~# "^%s"', a:arglead),) | |
return candidates | |
FUNCTION 36() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return self.choices | |
FUNCTION 37() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let candidates = self.gather_candidates( a:arglead, a:cmdline, a:cursorpos, a:args,) | |
let candidates = filter( deepcopy(candidates), printf('v:val =~# "^%s"', a:arglead),) | |
return candidates | |
FUNCTION <SNR>76_Doxygen_Hilights_Base() | |
Called 1 time | |
Total time: 0.000341 | |
Self time: 0.000341 | |
count total (s) self (s) | |
1 0.000028 SynLink doxygenHtmlSpecial Special | |
1 0.000021 SynLink doxygenHtmlVar Type | |
1 0.000020 SynLink doxygenHtmlExpr String | |
1 0.000022 SynLink doxygenSmallSpecial SpecialChar | |
1 0.000017 SynLink doxygenSpecialCodeWord doxygenSmallSpecial | |
1 0.000017 SynLink doxygenSpecialBoldWord doxygenSmallSpecial | |
1 0.000018 SynLink doxygenSpecialEmphasisedWord doxygenSmallSpecial | |
1 0.000017 SynLink doxygenSpecialArgumentWord doxygenSmallSpecial | |
" SynColor doxygenFormulaKeyword cterm=bold ctermfg=DarkMagenta guifg=DarkMagenta gui=bold | |
1 0.000019 SynLink doxygenFormulaKeyword Keyword | |
"SynColor doxygenFormulaEscaped ctermfg=DarkMagenta guifg=DarkMagenta gui=bold | |
1 0.000020 SynLink doxygenFormulaEscaped Special | |
1 0.000020 SynLink doxygenFormulaOperator Operator | |
1 0.000022 SynLink doxygenFormula Statement | |
1 0.000022 SynLink doxygenSymbol Constant | |
1 0.000022 SynLink doxygenSpecial Special | |
1 0.000020 SynLink doxygenFormulaSpecial Special | |
"SynColor doxygenFormulaSpecial ctermfg=DarkBlue guifg=DarkBlue | |
FUNCTION 39() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
" Ref: Vital.vim OptionParser.vim | |
let candidates = split( glob(s:P.join(self.base_dir, a:arglead . '*'), 0), "\n") | |
" substitute 'base_dir' | |
call map(candidates, printf("substitute(v:val, '^%s/', '', '')", self.base_dir)) | |
" substitute /home/<username> to ~/ if ~/ is specified | |
if a:arglead =~# '^\~' | |
let home_dir = expand('~') | |
call map(candidates, printf("substitute(v:val, '^%s', '~', '')", home_dir)) | |
endif | |
call map(candidates, "escape(isdirectory(v:val) ? v:val.'/' : v:val, ' \\')") | |
return candidates | |
FUNCTION <SNR>99_parse_record() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let m = matchlist(a:line, s:parameter_pattern) | |
if len(m) < 3 | |
throw 'vital: VCS.Git.ConfigParser: Parsing a record failed: ' . a:line | |
endif | |
" create a nested object | |
let keys = split(m[1], '\.') | |
let value = m[2] | |
return s:_make_nested_dict(keys, value) | |
FUNCTION gita#util#interface_get_misc_lines() | |
Called 4 times | |
Total time: 10.578254 | |
Self time: 0.001194 | |
count total (s) self (s) | |
4 0.001509 0.000074 let gita = gita#get() | |
4 10.563364 0.000117 let meta = gita.git.get_meta() | |
4 0.000059 let name = fnamemodify(gita.git.worktree, ':t') | |
4 0.000028 let branch = meta.current_branch | |
4 0.000031 let remote_name = meta.current_branch_remote | |
4 0.000032 let remote_branch = meta.current_remote_branch | |
4 0.006400 0.000081 let outgoing = gita.git.count_commits_ahead_of_remote() | |
4 0.006129 0.000070 let incoming = gita.git.count_commits_behind_remote() | |
4 0.000053 let is_connected = !(empty(remote_name) || empty(remote_branch)) | |
4 0.000021 let lines = [] | |
4 0.000018 if is_connected | |
4 0.000109 call add(lines, printf('# Index and working tree status on a branch `%s/%s` <> `%s/%s`', name, branch, remote_name, remote_branch)) | |
4 0.000027 if outgoing > 0 && incoming > 0 | |
4 0.000115 call add(lines, printf('# The branch is %d commit(s) ahead and %d commit(s) behind of `%s/%s`', outgoing, incoming, remote_name, remote_branch,)) | |
4 0.000021 elseif outgoing > 0 | |
call add(lines, printf('# The branch is %d commit(s) ahead of `%s/%s`', outgoing, remote_name, remote_branch,)) | |
elseif incoming > 0 | |
call add(lines, printf('# The branch is %d commit(s) behind `%s/%s`', incoming, remote_name, remote_branch,)) | |
endif | |
4 0.000013 else | |
call add(lines, printf('# Index and working tree status on a branch `%s/%s`', name, branch)) | |
endif | |
4 0.000026 return lines | |
FUNCTION <SNR>102_get_theirs() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let opts = extend({ 'from_index': 1,}, get(a:000, 0, {})) | |
if opts.from_index | |
let result = s:C.exec(['show', ':3:' . a:filename], opts) | |
if result.status == 0 | |
return split(result.stdout, '\v\r?\n') | |
endif | |
return result | |
else | |
return s:strip_ours(readfile(a:filename), 1) | |
endif | |
FUNCTION <SNR>53_sync_active_winnr() | |
Called 7 times | |
Total time: 0.000286 | |
Self time: 0.000286 | |
count total (s) self (s) | |
7 0.000152 if exists('#airline') && winnr() != s:active_winnr | |
call airline#update_statusline() | |
endif | |
FUNCTION <SNR>94_get_orig_head() | |
Called 1 time | |
Total time: 0.000341 | |
Self time: 0.000045 | |
count total (s) self (s) | |
" When doing a merge, this is the SHA of the branch you’re merging into. | |
1 0.000197 0.000022 let filename = s:Path.join(a:repository, 'ORIG_HEAD') | |
1 0.000137 0.000016 return s:_readline(filename) | |
FUNCTION <SNR>101_validate_status_ours() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if !a:status.is_conflicted | |
call gita#util#info(printf( 'No ours version of a non conflicted file "%s" is available. Use <Plug>(gita-action-checkout) instead.', a:status.path,)) | |
return 1 | |
else | |
if a:status.sign ==# 'DD' | |
call gita#util#info(printf( 'No ours version of a both deleted conflict file "%s" is available. Use <Plug>(gita-action-rm) instead.', a:status.path,)) | |
return 1 | |
elseif a:status.sign ==# 'DU' | |
call gita#util#info(printf( 'No ours version of a deleted by us conflict file "%s" is available. Use <Plug>(gita-action-add) or <Plug>(gita-action-rm) instead.', a:status.path,)) | |
return 1 | |
else | |
return 0 | |
endif | |
endif | |
FUNCTION <SNR>83_concat() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let memo = [] | |
for Value in a:list | |
let memo += Value | |
endfor | |
return memo | |
FUNCTION <SNR>101_action_open_commit() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
call gita#interface#commit#open(a:options) | |
FUNCTION gita#util#is_number() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return call(s:Prelude.is_number, a:000, s:Prelude) | |
FUNCTION <SNR>93_strwidthpart() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if a:width <= 0 | |
return '' | |
endif | |
let strarr = split(a:str, '\zs') | |
let width = s:wcswidth(a:str) | |
let index = len(strarr) | |
let diff = (index + 1) / 2 | |
let rightindex = index - 1 | |
while width > a:width | |
let index = max([rightindex - diff + 1, 0]) | |
let partwidth = s:wcswidth(join(strarr[(index):(rightindex)], '')) | |
if width - partwidth >= a:width || diff <= 1 | |
let width -= partwidth | |
let rightindex = index - 1 | |
endif | |
if diff > 1 | |
let diff = diff / 2 | |
endif | |
endwhile | |
return index ? join(strarr[:index - 1], '') : '' | |
FUNCTION <SNR>103__distance() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return abs(a:a - s:base) - abs(a:b - s:base) | |
FUNCTION <SNR>82_is_windows() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:is_windows | |
FUNCTION 40() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let candidates = self.gather_candidates( a:arglead, a:cmdline, a:cursorpos, a:args,) | |
let candidates = filter( deepcopy(candidates), printf('v:val =~# "^%s"', a:arglead),) | |
return candidates | |
FUNCTION 43() | |
Called 76 times | |
Total time: 0.079973 | |
Self time: 0.011119 | |
count total (s) self (s) | |
76 0.004106 0.001296 let pathspec = s:_listalize(a:pathspec) | |
76 0.023717 0.001347 let path = s:Path.join(pathspec) | |
76 0.001532 let name = printf('%s%s%s', path, s:SEPARATOR, get(a:000, 0, '')) | |
76 0.017204 0.001594 let cached = self.cache.uptime.get(name, -1) | |
76 0.016562 0.002281 let actual = getftime(s:Path.join(self.repository, path)) | |
76 0.015237 0.001455 call self.cache.uptime.set(name, actual) | |
76 0.000627 return actual == -1 || actual > cached | |
FUNCTION 44() | |
Called 22 times | |
Total time: 0.000577 | |
Self time: 0.000577 | |
count total (s) self (s) | |
22 0.000486 return extend({ 'cwd': self.worktree,}, get(a:000, 0, {})) | |
FUNCTION 45() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:Core.get_relative_path(self.worktree, a:path) | |
FUNCTION 46() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:Core.get_absolute_path(self.worktree, a:path) | |
FUNCTION 47() | |
Called 4 times | |
Total time: 0.007114 | |
Self time: 0.000516 | |
count total (s) self (s) | |
4 0.000096 let options = extend({ 'no_cache': 0,}, get(a:000, 0, {})) | |
4 0.000028 let name = 'HEAD' | |
4 0.000045 let cache = self.cache.repository | |
4 0.005319 0.000125 if self.is_updated(name) || options.no_cache || !cache.has(name) | |
1 0.000419 0.000023 let result = s:Core.get_head(self.repository) | |
1 0.000215 0.000016 call cache.set(name, result) | |
1 0.000003 endif | |
4 0.000872 0.000063 return cache.get(name) | |
FUNCTION 48() | |
Called 4 times | |
Total time: 0.009363 | |
Self time: 0.000532 | |
count total (s) self (s) | |
4 0.000106 let options = extend({ 'no_cache': 0,}, get(a:000, 0, {})) | |
4 0.000030 let name = 'FETCH_HEAD' | |
4 0.000035 let cache = self.cache.repository | |
4 0.005076 0.000112 if self.is_updated(name) || options.no_cache || !cache.has(name) | |
1 0.002846 0.000025 let result = s:Core.get_fetch_head(self.repository) | |
1 0.000261 0.000039 call cache.set(name, result) | |
1 0.000003 endif | |
4 0.000886 0.000063 return cache.get(name) | |
FUNCTION 49() | |
Called 4 times | |
Total time: 0.006839 | |
Self time: 0.000491 | |
count total (s) self (s) | |
4 0.000098 let options = extend({ 'no_cache': 0,}, get(a:000, 0, {})) | |
4 0.000030 let name = 'ORIG_HEAD' | |
4 0.000035 let cache = self.cache.repository | |
4 0.005133 0.000111 if self.is_updated(name) || options.no_cache || !cache.has(name) | |
1 0.000360 0.000020 let result = s:Core.get_orig_head(self.repository) | |
1 0.000184 0.000016 call cache.set(name, result) | |
1 0.000003 endif | |
4 0.000880 0.000062 return cache.get(name) | |
FUNCTION gita#util#asktf() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let result = gita#util#ask( printf('%s [yes/no]: ', a:message), get(a:000, 0, '')) | |
while result !~? '^\%(y\%[es]\|n\%[o]\)$' | |
redraw | |
if result == '' | |
call gita#util#warn('Canceled.') | |
break | |
endif | |
call gita#util#error('Invalid input.') | |
let result = gita#util#ask(printf('%s [yes/no]: ', a:message)) | |
endwhile | |
redraw | |
return result =~? 'y\%[es]' | |
FUNCTION <SNR>93__vital_depends() | |
Called 1 time | |
Total time: 0.000010 | |
Self time: 0.000010 | |
count total (s) self (s) | |
1 0.000006 return ['Prelude', 'Data.List'] | |
FUNCTION <SNR>101_action() | |
Called 2 times | |
Total time: 8.288692 | |
Self time: 0.000695 | |
count total (s) self (s) | |
2 0.000045 let multiple = get(a:000, 0, 0) | |
2 0.000040 let options = get(a:000, 1, {}) | |
2 0.000115 0.000061 if s:Prelude.is_dict(multiple) | |
let options = multiple | |
unlet! multiple | let multiple = 0 | |
endif | |
2 0.000119 let options = extend(deepcopy(b:_options), options) | |
2 0.000017 if multiple | |
let statuses = s:get_selected_statuses() | |
let args = [statuses, options] | |
else | |
2 0.001381 0.000057 let status = s:get_selected_status() | |
2 0.000030 let args = [status, options] | |
2 0.000011 endif | |
2 8.286735 0.000117 call call(printf('s:action_%s', a:name), args) | |
FUNCTION <SNR>63_should_change_group() | |
Called 28 times | |
Total time: 0.027676 | |
Self time: 0.002408 | |
count total (s) self (s) | |
28 0.000187 if a:group1 == a:group2 | |
return 0 | |
endif | |
28 0.013410 0.000441 let color1 = airline#highlighter#get_highlight(a:group1) | |
28 0.012803 0.000504 let color2 = airline#highlighter#get_highlight(a:group2) | |
28 0.000424 if has('gui_running') || (has("termtruecolor") && &guicolors == 1) | |
28 0.000373 return color1[1] != color2[1] || color1[0] != color2[0] | |
else | |
return color1[3] != color2[3] || color1[2] != color2[2] | |
endif | |
FUNCTION airline#highlighter#get_highlight() | |
Called 100 times | |
Total time: 0.045148 | |
Self time: 0.010094 | |
count total (s) self (s) | |
100 0.014301 0.001511 let fg = s:get_syn(a:group, 'fg') | |
100 0.013715 0.001618 let bg = s:get_syn(a:group, 'bg') | |
100 0.004223 let reverse = has('gui_running') || (has("termtruecolor") && &guicolors == 1) ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui') : synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm')|| synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'term') | |
100 0.012124 0.001956 return reverse ? s:get_array(bg, fg, a:000) : s:get_array(fg, bg, a:000) | |
FUNCTION <SNR>93_replace() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:_replace(a:str, a:from, a:to, 'g') | |
FUNCTION <SNR>101_action_solve3() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let options = extend({ 'opener': 'edit',}, a:options) | |
if s:validate_status_conflict(a:status, options) | |
return | |
endif | |
call gita#util#invoker_focus() | |
call gita#interface#conflict#open3(a:status, options) | |
FUNCTION <SNR>87_unregister() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
unlet! s:_completers[a:name] | |
FUNCTION <SNR>90_get_config() | |
Called 3 times | |
Total time: 0.000137 | |
Self time: 0.000137 | |
count total (s) self (s) | |
3 0.000083 let default = { 'cache': { 'finder': s:Cache, 'instance': s:Cache, 'repository': s:Cache, 'uptime': s:Cache, 'finder_args': [], 'instance_args': [], 'repository_args': [], 'uptime_args': [], },} | |
3 0.000040 return extend(default, deepcopy(s:config)) | |
FUNCTION neomake#statusline#LoclistCounts() | |
Called 12 times | |
Total time: 0.000882 | |
Self time: 0.000882 | |
count total (s) self (s) | |
12 0.000138 let win = winnr() | |
12 0.000153 let buf = bufnr('%') | |
12 0.000282 let s:loclist_counts[win] = get(s:loclist_counts, win, {}) | |
12 0.000189 return get(s:loclist_counts[win], buf, {}) | |
FUNCTION 50() | |
Called 4 times | |
Total time: 0.007779 | |
Self time: 0.000542 | |
count total (s) self (s) | |
4 0.000092 let options = extend({ 'no_cache': 0,}, get(a:000, 0, {})) | |
4 0.000030 let name = 'MERGE_HEAD' | |
4 0.000034 let cache = self.cache.repository | |
4 0.004376 0.000078 if self.is_updated(name) || options.no_cache || !cache.has(name) | |
4 0.001460 0.000098 let result = s:Core.get_merge_head(self.repository) | |
4 0.000831 0.000068 call cache.set(name, result) | |
4 0.000015 endif | |
4 0.000876 0.000062 return cache.get(name) | |
FUNCTION 51() | |
Called 4 times | |
Total time: 0.006732 | |
Self time: 0.000492 | |
count total (s) self (s) | |
4 0.000093 let options = extend({ 'no_cache': 0,}, get(a:000, 0, {})) | |
4 0.000032 let name = 'COMMIT_EDITMSG' | |
4 0.000034 let cache = self.cache.repository | |
4 0.005057 0.000112 if self.is_updated(name) || options.no_cache || !cache.has(name) | |
1 0.000326 0.000021 let result = s:Core.get_commit_editmsg(self.repository) | |
1 0.000186 0.000017 call cache.set(name, result) | |
1 0.000004 endif | |
4 0.000883 0.000063 return cache.get(name) | |
FUNCTION 52() | |
Called 4 times | |
Total time: 0.007579 | |
Self time: 0.000541 | |
count total (s) self (s) | |
4 0.000091 let options = extend({ 'no_cache': 0,}, get(a:000, 0, {})) | |
4 0.000029 let name = 'MERGE_MSG' | |
4 0.000034 let cache = self.cache.repository | |
4 0.004393 0.000078 if self.is_updated(name) || options.no_cache || !cache.has(name) | |
4 0.001256 0.000100 let result = s:Core.get_merge_msg(self.repository) | |
4 0.000802 0.000066 call cache.set(name, result) | |
4 0.000016 endif | |
4 0.000894 0.000062 return cache.get(name) | |
FUNCTION 53() | |
Called 4 times | |
Total time: 0.007892 | |
Self time: 0.000558 | |
count total (s) self (s) | |
4 0.000094 let options = extend({ 'no_cache': 0,}, get(a:000, 0, {})) | |
4 0.000970 0.000088 let name = s:Path.join('refs', 'heads', a:branch) | |
4 0.000042 let cache = self.cache.repository | |
4 0.005153 0.000115 if self.is_updated(name) || options.no_cache || !cache.has(name) | |
1 0.000420 0.000022 let result = s:Core.get_local_hash(self.repository, a:branch) | |
1 0.000190 0.000017 call cache.set(name, result) | |
1 0.000003 endif | |
4 0.000903 0.000062 return cache.get(name) | |
FUNCTION 55() | |
Called 24 times | |
Total time: 0.091362 | |
Self time: 0.002768 | |
count total (s) self (s) | |
24 0.000549 let options = extend({ 'no_cache': 0,}, get(a:000, 0, {})) | |
24 0.000173 let name = 'config' | |
24 0.000202 let cache = self.cache.repository | |
24 0.030541 0.000701 if self.is_updated(name) || options.no_cache || !cache.has(name) | |
1 0.053716 0.000023 let result = s:Core.get_repository_config(self.repository) | |
1 0.000199 0.000026 call cache.set(name, result) | |
1 0.000003 endif | |
24 0.005249 0.000360 return cache.get(name) | |
FUNCTION 56() | |
Called 4 times | |
Total time: 0.006823 | |
Self time: 0.000191 | |
count total (s) self (s) | |
4 0.006469 0.000084 let config = call(self.get_repository_config, a:000, self) | |
4 0.000328 0.000081 return s:Core.get_branch_remote(config, a:branch) | |
FUNCTION 57() | |
Called 4 times | |
Total time: 0.006907 | |
Self time: 0.000202 | |
count total (s) self (s) | |
4 0.006460 0.000093 let config = call(self.get_repository_config, a:000, self) | |
4 0.000422 0.000084 return s:Core.get_branch_merge(config, a:branch) | |
FUNCTION 58() | |
Called 4 times | |
Total time: 0.006641 | |
Self time: 0.000206 | |
count total (s) self (s) | |
4 0.006312 0.000104 let config = call(self.get_repository_config, a:000, self) | |
4 0.000304 0.000078 return s:Core.get_remote_fetch(config, a:remote) | |
FUNCTION 59() | |
Called 4 times | |
Total time: 0.006529 | |
Self time: 0.000180 | |
count total (s) self (s) | |
4 0.006210 0.000078 let config = call(self.get_repository_config, a:000, self) | |
4 0.000294 0.000078 return s:Core.get_remote_url(config, a:remote) | |
FUNCTION <SNR>90__listalize() | |
Called 78 times | |
Total time: 0.002922 | |
Self time: 0.001757 | |
count total (s) self (s) | |
78 0.002673 0.001508 return s:Prelude.is_list(a:val) ? a:val : [a:val] | |
FUNCTION gita#util#yank() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let @" = a:content | |
if has('clipboard') | |
call setreg(v:register, a:content) | |
endif | |
FUNCTION <SNR>89_GitaCommit() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
call gita#interface#commit#open(a:opts) | |
FUNCTION <SNR>53_is_excluded_window() | |
Called 8 times | |
Total time: 0.001500 | |
Self time: 0.001500 | |
count total (s) self (s) | |
8 0.000088 for matchft in g:airline_exclude_filetypes | |
if matchft ==# &ft | |
return 1 | |
endif | |
endfor | |
32 0.000147 for matchw in g:airline_exclude_filenames | |
24 0.000492 if matchstr(expand('%'), matchw) ==# matchw | |
return 1 | |
endif | |
24 0.000066 endfor | |
8 0.000048 if g:airline_exclude_preview && &previewwindow | |
return 1 | |
endif | |
8 0.000027 return 0 | |
FUNCTION <SNR>89_GitaDiff() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let commit = empty(get(a:opts, '__unknown__', [])) ? '' : join(a:opts.__unknown__) | |
if empty(commit) | |
let commit = gita#util#ask('Diff to: ', 'INDEX') | |
if strlen(commit) == 0 | |
redraw || call gita#util#warn('No valid commit was selected. The operation is canceled.') | |
return | |
endif | |
endif | |
let commit = commit ==# 'INDEX' ? '' : commit | |
if get(a:opts, 'compare', 1) | |
call gita#interface#diff#compare(expand('%'), commit, a:opts) | |
else | |
call gita#interface#diff#open(expand('%'), commit, a:opts) | |
endif | |
FUNCTION gita#util#is_dict() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return call(s:Prelude.is_dict, a:000, s:Prelude) | |
FUNCTION 60() | |
Called 4 times | |
Total time: 0.006568 | |
Self time: 0.000178 | |
count total (s) self (s) | |
4 0.006215 0.000080 let config = call(self.get_repository_config, a:000, self) | |
4 0.000329 0.000074 return s:Core.get_comment_char(config) | |
FUNCTION 61() | |
Called 2 times | |
Total time: 0.094867 | |
Self time: 0.000218 | |
count total (s) self (s) | |
2 0.000174 0.000095 let opts = extend(self._get_call_opts(), get(a:000, 0, {})) | |
2 0.094678 0.000107 return s:Core.exec(a:args, opts) | |
FUNCTION 62() | |
Called 4 times | |
Total time: 0.344900 | |
Self time: 0.002221 | |
count total (s) self (s) | |
4 0.000286 0.000163 let options = self._get_call_opts(extend({ 'no_cache': 0,}, get(a:000, 0, {}))) | |
4 0.000548 0.000109 let opts = s:Dict.omit(options, ['no_cache']) | |
4 0.002359 0.001256 let name = s:Path.join('index', 'parsed_status', string(opts)) | |
4 0.000054 let cache = self.cache.repository | |
4 0.004807 0.000122 let result = (self.is_updated('index', 'status') || options.no_cache) ? {} : cache.get(name, {}) | |
4 0.000033 if empty(result) | |
4 0.316143 0.000214 let result = s:Misc.get_parsed_status(opts) | |
4 0.020529 0.000130 call cache.set(name, result) | |
4 0.000024 endif | |
4 0.000023 return result | |
FUNCTION 63() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let options = self._get_call_opts(extend({ 'no_cache': 0,}, get(a:000, 0, {}))) | |
let opts = s:Dict.omit(options, ['no_cache']) | |
let name = s:Path.join('index', 'parsed_commit', string(opts)) | |
let cache = self.cache.repository | |
let result = (self.is_updated('index', 'commit') || options.no_cache) ? {} : cache.get(name, {}) | |
if empty(result) | |
let result = s:Misc.get_parsed_commit(opts) | |
call cache.set(name, result) | |
endif | |
return result | |
FUNCTION 64() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let options = self._get_call_opts(extend({ 'no_cache': 0,}, get(a:000, 0, {}))) | |
let opts = s:Dict.omit(options, ['no_cache']) | |
let name = s:Path.join('index', 'parsed_config', string(opts)) | |
let cache = self.cache.repository | |
let result = (self.is_updated('index', 'config') || options.no_cache) ? {} : cache.get(name, {}) | |
if empty(result) | |
let result = s:Misc.get_parsed_config(opts) | |
call cache.set(name, result) | |
endif | |
return result | |
FUNCTION 65() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let options = self._get_call_opts(extend({ 'no_cache': 0,}, get(a:000, 0, {}))) | |
let opts = s:Dict.omit(options, ['no_cache']) | |
let name = s:Path.join('index', 'last_commitmsg', string(opts)) | |
let cache = self.cache.repository | |
let result = (self.is_updated('index', 'last_commitmsg') || options.no_cache) ? [] : cache.get(name, []) | |
if empty(result) | |
unlet! result | |
let result = s:Misc.get_last_commitmsg(opts) | |
call cache.set(name, result) | |
endif | |
return result | |
FUNCTION 66() | |
Called 8 times | |
Total time: 0.133176 | |
Self time: 0.001554 | |
count total (s) self (s) | |
8 0.000494 0.000291 let options = self._get_call_opts(extend({ 'no_cache': 0,}, get(a:000, 0, {}))) | |
8 0.000840 0.000176 let opts = s:Dict.omit(options, ['no_cache']) | |
8 0.002166 0.000226 let name = s:Path.join('index', 'commits_ahead_of_remote', string(opts)) | |
8 0.000081 let cache = self.cache.repository | |
8 0.008457 0.000276 let result = (self.is_updated('index', 'commits_ahead_of_remote') || options.no_cache) ? -1 : cache.get(name, -1) | |
8 0.000039 if result == -1 | |
3 0.120128 0.000108 let result = s:Misc.count_commits_ahead_of_remote(opts) | |
3 0.000708 0.000094 call cache.set(name, result) | |
3 0.000011 endif | |
8 0.000037 return result | |
FUNCTION 67() | |
Called 8 times | |
Total time: 0.066776 | |
Self time: 0.001409 | |
count total (s) self (s) | |
8 0.000453 0.000280 let options = self._get_call_opts(extend({ 'no_cache': 0,}, get(a:000, 0, {}))) | |
8 0.000777 0.000152 let opts = s:Dict.omit(options, ['no_cache']) | |
8 0.001826 0.000227 let name = s:Path.join('index', 'commits_behind_remote', string(opts)) | |
8 0.000075 let cache = self.cache.repository | |
8 0.008269 0.000237 let result = (self.is_updated('index', 'commits_behind_remote') || options.no_cache) ? -1 : cache.get(name, -1) | |
8 0.000038 if result == -1 | |
3 0.054412 0.000082 let result = s:Misc.count_commits_behind_remote(opts) | |
3 0.000671 0.000063 call cache.set(name, result) | |
3 0.000010 endif | |
8 0.000036 return result | |
FUNCTION 68() | |
Called 4 times | |
Total time: 10.563247 | |
Self time: 0.002220 | |
count total (s) self (s) | |
4 0.000030 let meta = {} | |
4 0.007202 0.000088 let meta.head = self.get_head() | |
4 0.009449 0.000086 let meta.fetch_head = self.get_fetch_head() | |
4 0.006923 0.000084 let meta.orig_head = self.get_orig_head() | |
4 0.007862 0.000083 let meta.merge_head = self.get_merge_head() | |
4 0.006828 0.000096 let meta.commit_editmsg = self.get_commit_editmsg() | |
4 0.000070 let meta.last_commitmsg = empty(meta.commit_editmsg) ? self.get_last_commitmsg() : meta.commit_editmsg | |
4 0.007662 0.000083 let meta.merge_msg = self.get_merge_msg() | |
4 0.000290 let meta.current_branch = meta.head =~? 'refs/heads/' ? matchstr(meta.head, 'refs/heads/\zs.\+$') : meta.head[:6] | |
4 0.007989 0.000097 let meta.current_branch_hash = self.get_local_hash(meta.current_branch) | |
4 0.060236 0.000102 let meta.repository_config = self.get_repository_config() | |
4 0.006919 0.000096 let meta.current_branch_remote = self.get_branch_remote(meta.current_branch) | |
4 0.006999 0.000092 let meta.current_branch_merge = self.get_branch_merge(meta.current_branch) | |
4 0.006733 0.000092 let meta.current_remote_fetch = self.get_remote_fetch(meta.current_branch_remote) | |
4 0.006618 0.000089 let meta.current_remote_url = self.get_remote_url(meta.current_branch_remote) | |
4 0.006657 0.000088 let meta.comment_char = self.get_comment_char() | |
4 0.000149 let meta.current_remote_branch = matchstr(meta.current_branch_merge, 'refs/heads/\zs.\+$') | |
4 10.226668 0.000114 let meta.current_remote_branch_hash = self.get_remote_hash( meta.current_branch_remote, meta.current_remote_branch,) | |
4 0.126961 0.000105 let meta.commits_ahead_of_remote = self.count_commits_ahead_of_remote() | |
4 0.060818 0.000101 let meta.commits_behind_remote = self.count_commits_behind_remote() | |
4 0.000022 return meta | |
FUNCTION <SNR>86__foldl() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION gita#util#warn() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let title = get(a:000, 0, '') | |
if strlen(title) | |
call gita#util#echomsg('WarningMsg', title) | |
call gita#util#echomsg('None', a:message) | |
else | |
call gita#util#echomsg('WarningMsg', a:message) | |
endif | |
FUNCTION <SNR>97__vital_depends() | |
Called 1 time | |
Total time: 0.000016 | |
Self time: 0.000016 | |
count total (s) self (s) | |
1 0.000012 return [ 'Prelude', 'Data.Dict', 'VCS.Git.Core', 'VCS.Git.StatusParser', 'VCS.Git.ConfigParser',] | |
FUNCTION <SNR>64_build_sections() | |
Called 12 times | |
Total time: 0.010173 | |
Self time: 0.002049 | |
count total (s) self (s) | |
56 0.000246 for key in a:keys | |
44 0.000269 if key == 'warning' && !a:context.active | |
4 0.000022 continue | |
endif | |
40 0.008740 0.000616 call s:add_section(a:builder, a:context, key) | |
40 0.000116 endfor | |
FUNCTION <SNR>85_strip_quotes() | |
Called 1 time | |
Total time: 0.000038 | |
Self time: 0.000038 | |
count total (s) self (s) | |
1 0.000018 if a:str =~# '\v^%(".*"|''.*'')$' | |
return a:str[1:-2] | |
else | |
1 0.000005 return a:str | |
endif | |
FUNCTION <SNR>83__compare() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return eval(s:expr) | |
FUNCTION <SNR>81_import() | |
Called 45 times | |
Total time: 1.028872 | |
Self time: 0.006160 | |
count total (s) self (s) | |
45 0.000307 let target = {} | |
45 0.000266 let functions = [] | |
45 0.000265 for a in a:000 | |
if type(a) == type({}) | |
let target = a | |
elseif type(a) == type([]) | |
let functions = a | |
endif | |
unlet a | |
endfor | |
45 0.586245 0.280715 let module = s:_import(a:name) | |
45 0.000311 if empty(functions) | |
45 0.001271 call extend(target, module, 'keep') | |
45 0.000155 else | |
for f in functions | |
if has_key(module, f) && !has_key(target, f) | |
let target[f] = module[f] | |
endif | |
endfor | |
endif | |
45 0.000212 return target | |
FUNCTION airline#extensions#default#apply() | |
Called 8 times | |
Total time: 0.013441 | |
Self time: 0.001501 | |
count total (s) self (s) | |
8 0.000061 let winnr = a:context.winnr | |
8 0.000056 let active = a:context.active | |
8 0.000261 0.000153 if airline#util#getwinvar(winnr, 'airline_render_left', active || (!active && !g:airline_inactive_collapse)) | |
4 0.003043 0.000076 call s:build_sections(a:builder, a:context, s:layout[0]) | |
4 0.000013 else | |
4 0.000557 0.000073 let text = s:get_section(winnr, 'c') | |
4 0.000025 if empty(text) | |
let text = ' %f%m ' | |
endif | |
4 0.000157 0.000079 call a:builder.add_section('airline_c'.(a:context.bufnr), text) | |
4 0.000013 endif | |
8 0.001193 0.000200 call a:builder.split(s:get_section(winnr, 'gutter', '', '')) | |
8 0.000215 0.000114 if airline#util#getwinvar(winnr, 'airline_render_right', 1) | |
8 0.007366 0.000160 call s:build_sections(a:builder, a:context, s:layout[1]) | |
8 0.000024 endif | |
8 0.000030 return 1 | |
FUNCTION 84() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
throw "System.Cache.Base: get({name}[, {default}]) is not implemented" | |
FUNCTION <SNR>81__file2module() | |
Called 32 times | |
Total time: 0.004484 | |
Self time: 0.004484 | |
count total (s) self (s) | |
32 0.001983 let filename = fnamemodify(a:file, ':p:gs?[\\/]?/?') | |
32 0.001427 let tail = matchstr(filename, 'autoload/vital/_\w\+/\zs.*\ze\.vim$') | |
32 0.000870 return join(split(tail, '[\\/]\+'), '.') | |
FUNCTION <SNR>81__import() | |
Called 91 times | |
Total time: 1.885098 | |
Self time: 0.126079 | |
count total (s) self (s) | |
91 0.000872 if type(a:name) == type(0) | |
return s:_build_module(a:name) | |
endif | |
91 0.087582 0.001410 let path = s:_get_module_path(a:name) | |
91 0.000476 if path ==# '' | |
throw 'vital: module not found: ' . a:name | |
endif | |
91 0.443396 0.001844 let sid = s:_get_sid_by_script(path) | |
91 0.000436 if !sid | |
20 0.000104 try | |
20 0.034772 0.005178 execute 'source' fnameescape(path) | |
20 0.000149 catch /^Vim\%((\a\+)\)\?:E484/ | |
throw 'vital: module not found: ' . a:name | |
catch /^Vim\%((\a\+)\)\?:E127/ | |
" Ignore. | |
endtry | |
20 0.121896 0.000471 let sid = s:_get_sid_by_script(path) | |
20 0.000078 endif | |
91 0.062559 0.030706 return s:_build_module(sid) | |
FUNCTION <SNR>93_truncate_skipping() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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) | |
FUNCTION 70() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let defaults = { 'force': 0, 'dry_run': 0, 'r': 0, 'cached': 0, 'ignore_unmatch': 0, 'quiet': 0,} | |
let opts = s:Dict.omit(a:options, keys(defaults)) | |
let args = extend(['rm'], s:Misc.opts2args(a:options, defaults)) | |
let filenames = s:_listalize(get(a:000, 0, [])) | |
if len(filenames) > 0 | |
call add(args, ['--', filenames]) | |
endif | |
return self.exec(args, opts) | |
FUNCTION 71() | |
Called 1 time | |
Total time: 0.070334 | |
Self time: 0.000317 | |
count total (s) self (s) | |
1 0.000036 let defaults = { 'quiet': 0, 'patch': 0, 'intent_to_add': 0, 'mixed': 0, 'soft': 0, 'merge': 0, 'keep': 0,} | |
1 0.000483 0.000046 let opts = s:Dict.omit(a:options, keys(defaults)) | |
1 0.002224 0.000056 let args = extend(['reset'], s:Misc.opts2args(a:options, defaults)) | |
1 0.000013 if strlen(a:commit) | |
call add(args, a:commit) | |
endif | |
1 0.000099 0.000042 let filenames = s:_listalize(get(a:000, 0, [])) | |
1 0.000013 if len(filenames) > 0 | |
1 0.000024 call add(args, ['--', filenames]) | |
1 0.000006 endif | |
1 0.067398 0.000044 return self.exec(args, opts) | |
FUNCTION 72() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let defaults = { 'quiet': 0, 'force': 0, 'ours': 0, 'theirs': 0, 'b': '', 'B': '', 'track': 0, 'no_track': 0, 'l': 0, 'detach': 0, 'orphan': '', 'merge': 0, 'conflict': '=merge', 'patch': 0,} | |
let opts = s:Dict.omit(a:options, keys(defaults)) | |
let args = extend(['checkout'], s:Misc.opts2args(a:options, defaults)) | |
if strlen(a:commit) | |
call add(args, a:commit) | |
endif | |
let filenames = s:_listalize(get(a:000, 0, [])) | |
if len(filenames) > 0 | |
call add(args, ['--', filenames]) | |
endif | |
return self.exec(args, opts) | |
FUNCTION 73() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let defaults = { 'short': 0, 'branch': 0, 'porcelain': 0, 'untracked_files': '=all', 'ignore_submodules': '=all', 'ignored': 0, 'z': 0,} | |
let opts = s:Dict.omit(a:options, keys(defaults)) | |
let args = extend(['status'], s:Misc.opts2args(a:options, defaults)) | |
let filenames = s:_listalize(get(a:000, 0, [])) | |
if len(filenames) > 0 | |
call add(args, ['--', filenames]) | |
endif | |
return self.exec(args, opts) | |
FUNCTION 74() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let defaults = { 'all': 0, 'patch': 0, 'reuse_message': '=', 'reedit_message': '=', 'fixup': '=', 'squash': '=', 'reset_author': 0, 'short': 0, 'porcelain': 0, 'z': 0, 'file': '=', 'author': '=', 'date': '=', 'message': '=', 'template': '=', 'signoff': 0, 'no_verify': 0, 'allow_empty': 0, 'allow_empty_message': 0, 'cleanup': '=default', 'edit': 0, 'amend': 0, 'include': 0, 'only': 0, 'untracked_files': '=all', 'verbose': 0, 'quiet': 0, 'dry_run': 0, 'status': 0, 'no_status': 0,} | |
let opts = s:Dict.omit(a:options, keys(defaults)) | |
let args = extend(['commit'], s:Misc.opts2args(a:options, defaults)) | |
let filenames = s:_listalize(get(a:000, 0, [])) | |
if len(filenames) > 0 | |
call add(args, ['--', filenames]) | |
endif | |
return self.exec(args, opts) | |
FUNCTION 75() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let defaults = { 'patch': 0, 'unified': '=', 'raw': 0, 'patch_with_raw': 0, 'minimal': 0, 'patience': 0, 'histogram': 0, 'stat': '=', 'numstat': 0, 'shortstat': 0, 'dirstat': '=', 'summary': 0, 'patch_with_stat': 0, 'z': 0, 'name_only': 0, 'name_status': 0, 'submodule': '=log', 'color': '=never', 'no_color': 0, 'word_diff': '=plain', 'word_diff_regex': '=', 'color_words': '=', 'no_renames': 0, 'check': 0, 'full_index': 0, 'binary': 0, 'abbrev': '=', 'break_rewrites': '=', 'find_renames': '=', 'find_copies': '=', 'find_copies_harder': 0, 'irreversible_delete': 0, 'l': '=', 'diff_filter': '=', 'S': '=', 'G': '=', 'pickaxe_all': 0, 'pickaxe_regex': 0, 'O': '=', 'R': 0, 'relative': '=', 'text': 0, 'ignore_space_at_eol': 0, 'ignore_space_change': 0, 'ignore_all_space': 0, 'inter_hunk_context': '=', 'function_context': 0, 'exit_code': 0, 'quiet': 0, 'ext_diff': 0, 'no_ext_diff': 0, 'textconv': 0, 'no_textconv': 0, 'ignore_submodules': '=all', 'src_prefix': '=', 'dst_prefix': '=', 'no_prefix': 0,} | |
let opts = s:Dict.omit(a:options, keys(defaults)) | |
let args = extend(['diff'], s:Misc.opts2args(a:options, defaults)) | |
if get(a:options, 'cached', 0) | |
call add(args, '--cached') | |
endif | |
if strlen(a:commit) > 0 | |
call add(args, a:commit) | |
endif | |
let filenames = s:_listalize(get(a:000, 0, [])) | |
if len(filenames) > 0 | |
call add(args, ['--', filenames]) | |
endif | |
return self.exec(args, opts) | |
FUNCTION 76() | |
Called 38 times | |
Total time: 0.007079 | |
Self time: 0.001395 | |
count total (s) self (s) | |
38 0.006458 0.000774 let cache_key = self.cache_key(a:name) | |
38 0.000429 return has_key(self._cached, cache_key) | |
FUNCTION 77() | |
Called 144 times | |
Total time: 0.029319 | |
Self time: 0.008175 | |
count total (s) self (s) | |
144 0.001672 let default = get(a:000, 0, '') | |
144 0.023635 0.002491 let cache_key = self.cache_key(a:name) | |
144 0.001545 if has_key(self._cached, cache_key) | |
130 0.001070 return self._cached[cache_key] | |
else | |
14 0.000067 return default | |
endif | |
FUNCTION 78() | |
Called 106 times | |
Total time: 0.039222 | |
Self time: 0.003833 | |
count total (s) self (s) | |
106 0.037367 0.001977 let cache_key = self.cache_key(a:name) | |
106 0.001290 let self._cached[cache_key] = a:value | |
FUNCTION 79() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let cache_key = self.cache_key(a:name) | |
if has_key(self._cached, cache_key) | |
unlet self._cached[cache_key] | |
endif | |
FUNCTION gita#util#interface_get_help() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let vname = '_help_' . a:about | |
if !has_key(s:, vname) | |
let root = fnamemodify(s:scriptfile, ':h:h:h') | |
let filename = s:Path.join(root, 'help', a:about . '.txt') | |
if filereadable(filename) | |
let s:[vname] = readfile(filename) | |
else | |
let s:[vname] = [ printf('%s is not found.', filename),] | |
endif | |
endif | |
return get(s:, vname) | |
FUNCTION <SNR>101_action_toggle() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let statuses = s:ensure_list(a:statuses) | |
let options = extend({ 'force': 0,}, a:options) | |
let stage_statuses = [] | |
let unstage_statuses = [] | |
for status in statuses | |
if status.is_conflicted | |
call gita#util#info(printf(join([ 'A conflicted file "%s" cannot be toggle.', 'Use <Plug>(gita-action-add) or <Plug>(gita-action-rm) instead.', ]), status.path)) | |
continue | |
elseif status.is_staged && status.is_unstaged | |
if get(g:, 'gita#interface#status#action_prefer_unstage', 0) | |
call add(stage_statuses, status) | |
else | |
call add(unstage_statuses, status) | |
endif | |
elseif status.is_staged | |
call add(unstage_statuses, status) | |
elseif status.is_untracked || status.is_unstaged || status.is_ignored | |
call add(stage_statuses, status) | |
endif | |
endfor | |
if empty(stage_statuses) && empty(unstage_statuses) | |
if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( 'No valid files were selected for toggle action',) | |
endif | |
return | |
endif | |
let options.ignore_empty_warning = 1 | |
call s:action_stage(stage_statuses, options) | |
call s:action_unstage(unstage_statuses, options) | |
call s:update() | |
FUNCTION gita#util#buffer_open() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let B = gita#util#import('Vim.Buffer') | |
let opener = get(a:000, 0, get(g:, 'gita#buffer#opener', 'edit')) | |
return B.open(a:buffer, opener) | |
FUNCTION <SNR>100__vital_depends() | |
Called 1 time | |
Total time: 0.000012 | |
Self time: 0.000012 | |
count total (s) self (s) | |
1 0.000009 return [ 'Prelude', 'System.Filepath', 'VCS.Git.Core',] | |
FUNCTION <SNR>93_nr2enc_char() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if &encoding == 'utf-8' | |
return nr2char(a:charcode) | |
endif | |
let char = s:nr2byte(a:charcode) | |
if strlen(char) > 1 | |
let char = strtrans(iconv(char, 'utf-8', &encoding)) | |
endif | |
return char | |
FUNCTION <SNR>87__vital_loaded() | |
Called 1 time | |
Total time: 0.004886 | |
Self time: 0.000043 | |
count total (s) self (s) | |
1 0.004863 0.000020 let s:P = a:V.import('System.Filepath') | |
call extend(self, s:const) | |
FUNCTION <SNR>94_set_config() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let s:_config = extend(s:_config, a:config) | |
FUNCTION <SNR>101_defmap() | |
Called 1 time | |
Total time: 0.003058 | |
Self time: 0.003058 | |
count total (s) self (s) | |
1 0.000067 nnoremap <silent><buffer> <Plug>(gita-action-help-m) :<C-u>call <SID>action('help', { 'about': 'status_mapping' })<CR> | |
1 0.000040 nnoremap <silent><buffer> <Plug>(gita-action-help-s) :<C-u>call <SID>action('help', { 'about': 'short_format' })<CR> | |
1 0.000033 nnoremap <silent><buffer> <Plug>(gita-action-update) :<C-u>call <SID>action('update')<CR> | |
1 0.000033 nnoremap <silent><buffer> <Plug>(gita-action-switch) :<C-u>call <SID>action('open_commit')<CR> | |
1 0.000039 nnoremap <silent><buffer> <Plug>(gita-action-commit) :<C-u>call <SID>action('open_commit', { 'new': 1, 'amend': 0 })<CR> | |
1 0.000038 nnoremap <silent><buffer> <Plug>(gita-action-commit-a) :<C-u>call <SID>action('open_commit', { 'new': 1, 'amend': 1 })<CR> | |
1 0.000036 nnoremap <silent><buffer> <Plug>(gita-action-open) :<C-u>call <SID>action('open', { 'opener': 'edit' })<CR> | |
1 0.000038 nnoremap <silent><buffer> <Plug>(gita-action-open-h) :<C-u>call <SID>action('open', { 'opener': 'botright split' })<CR> | |
1 0.000037 nnoremap <silent><buffer> <Plug>(gita-action-open-v) :<C-u>call <SID>action('open', { 'opener': 'botright vsplit' })<CR> | |
1 0.000036 nnoremap <silent><buffer> <Plug>(gita-action-diff) :<C-u>call <SID>action('diff_open', { 'opener': 'edit' })<CR> | |
1 0.000037 nnoremap <silent><buffer> <Plug>(gita-action-diff-h) :<C-u>call <SID>action('diff_compare', { 'vertical': 0 })<CR> | |
1 0.000037 nnoremap <silent><buffer> <Plug>(gita-action-diff-v) :<C-u>call <SID>action('diff_compare', { 'vertical': 1 })<CR> | |
1 0.000036 nnoremap <silent><buffer> <Plug>(gita-action-solve2-h) :<C-u>call <SID>action('solve2', { 'vertical': 0 })<CR> | |
1 0.000036 nnoremap <silent><buffer> <Plug>(gita-action-solve2-v) :<C-u>call <SID>action('solve2', { 'vertical': 1 })<CR> | |
1 0.000036 nnoremap <silent><buffer> <Plug>(gita-action-solve3-h) :<C-u>call <SID>action('solve3', { 'vertical': 0 })<CR> | |
1 0.000036 nnoremap <silent><buffer> <Plug>(gita-action-solve3-v) :<C-u>call <SID>action('solve3', { 'vertical': 1 })<CR> | |
1 0.000032 nnoremap <silent><buffer> <Plug>(gita-action-add) :<C-u>call <SID>action('add')<CR> | |
1 0.000035 nnoremap <silent><buffer> <Plug>(gita-action-ADD) :<C-u>call <SID>action('add', { 'force': 1 })<CR> | |
1 0.000031 nnoremap <silent><buffer> <Plug>(gita-action-rm) :<C-u>call <SID>action('rm')<CR> | |
1 0.000034 nnoremap <silent><buffer> <Plug>(gita-action-RM) :<C-u>call <SID>action('RM', { 'force': 1 })<CR> | |
1 0.000032 nnoremap <silent><buffer> <Plug>(gita-action-reset) :<C-u>call <SID>action('reset')<CR> | |
1 0.000034 nnoremap <silent><buffer> <Plug>(gita-action-checkout) :<C-u>call <SID>action('checkout')<CR> | |
1 0.000036 nnoremap <silent><buffer> <Plug>(gita-action-CHECKOUT) :<C-u>call <SID>action('checkout', { 'force': 1 })<CR> | |
1 0.000032 nnoremap <silent><buffer> <Plug>(gita-action-ours) :<C-u>call <SID>action('ours')<CR> | |
1 0.000033 nnoremap <silent><buffer> <Plug>(gita-action-theirs) :<C-u>call <SID>action('theirs')<CR> | |
1 0.000032 nnoremap <silent><buffer> <Plug>(gita-action-stage) :<C-u>call <SID>action('stage')<CR> | |
1 0.000034 nnoremap <silent><buffer> <Plug>(gita-action-unstage) :<C-u>call <SID>action('unstage')<CR> | |
1 0.000032 nnoremap <silent><buffer> <Plug>(gita-action-toggle) :<C-u>call <SID>action('toggle')<CR> | |
1 0.000034 nnoremap <silent><buffer> <Plug>(gita-action-discard) :<C-u>call <SID>action('discard')<CR> | |
1 0.000033 vnoremap <silent><buffer> <Plug>(gita-action-add) :<C-u>call <SID>action('add', 1)<CR> | |
1 0.000035 vnoremap <silent><buffer> <Plug>(gita-action-ADD) :<C-u>call <SID>action('add', 1, { 'force': 1 })<CR> | |
1 0.000031 vnoremap <silent><buffer> <Plug>(gita-action-rm) :<C-u>call <SID>action('rm', 1)<CR> | |
1 0.000034 vnoremap <silent><buffer> <Plug>(gita-action-RM) :<C-u>call <SID>action('RM', 1, { 'force': 1 })<CR> | |
1 0.000032 vnoremap <silent><buffer> <Plug>(gita-action-reset) :<C-u>call <SID>action('reset', 1)<CR> | |
1 0.000034 vnoremap <silent><buffer> <Plug>(gita-action-checkout) :<C-u>call <SID>action('checkout', 1)<CR> | |
1 0.000037 vnoremap <silent><buffer> <Plug>(gita-action-CHECKOUT) :<C-u>call <SID>action('checkout', 1, { 'force': 1 })<CR> | |
1 0.000033 vnoremap <silent><buffer> <Plug>(gita-action-ours) :<C-u>call <SID>action('ours', 1)<CR> | |
1 0.000034 vnoremap <silent><buffer> <Plug>(gita-action-theirs) :<C-u>call <SID>action('theirs', 1)<CR> | |
1 0.000033 vnoremap <silent><buffer> <Plug>(gita-action-stage) :<C-u>call <SID>action('stage', 1)<CR> | |
1 0.000034 vnoremap <silent><buffer> <Plug>(gita-action-unstage) :<C-u>call <SID>action('unstage', 1)<CR> | |
1 0.000033 vnoremap <silent><buffer> <Plug>(gita-action-toggle) :<C-u>call <SID>action('toggle', 1)<CR> | |
1 0.000034 vnoremap <silent><buffer> <Plug>(gita-action-discard) :<C-u>call <SID>action('discard', 1)<CR> | |
1 0.000017 if get(g:, 'gita#interface#status#enable_default_keymap', 1) | |
1 0.000018 nmap <buffer><silent> q :<C-u>quit<CR> | |
1 0.000027 nmap <buffer> <C-l> <Plug>(gita-action-update) | |
1 0.000026 nmap <buffer> ?m <Plug>(gita-action-help-m) | |
1 0.000027 nmap <buffer> ?s <Plug>(gita-action-help-s) | |
1 0.000025 nmap <buffer> cc <Plug>(gita-action-switch) | |
1 0.000025 nmap <buffer> cC <Plug>(gita-action-commit) | |
1 0.000290 nmap <buffer> cA <Plug>(gita-action-commit-a) | |
1 0.000034 nmap <buffer><expr> e <SID>smart_map('e', '<Plug>(gita-action-open)') | |
1 0.000030 nmap <buffer><expr> E <SID>smart_map('E', '<Plug>(gita-action-open-v)') | |
1 0.000029 nmap <buffer><expr> d <SID>smart_map('d', '<Plug>(gita-action-diff)') | |
1 0.000030 nmap <buffer><expr> D <SID>smart_map('D', '<Plug>(gita-action-diff-v)') | |
1 0.000030 nmap <buffer><expr> s <SID>smart_map('s', '<Plug>(gita-action-solve2-v)') | |
1 0.000030 nmap <buffer><expr> S <SID>smart_map('S', '<Plug>(gita-action-solve3-v)') | |
" operation | |
1 0.000032 nmap <buffer><expr> << <SID>smart_map('<<', '<Plug>(gita-action-stage)') | |
1 0.000031 nmap <buffer><expr> >> <SID>smart_map('>>', '<Plug>(gita-action-unstage)') | |
1 0.000031 nmap <buffer><expr> -- <SID>smart_map('--', '<Plug>(gita-action-toggle)') | |
1 0.000032 nmap <buffer><expr> == <SID>smart_map('==', '<Plug>(gita-action-discard)') | |
" raw operation | |
1 0.000031 nmap <buffer><expr> -a <SID>smart_map('-a', '<Plug>(gita-action-add)') | |
1 0.000031 nmap <buffer><expr> -A <SID>smart_map('-A', '<Plug>(gita-action-ADD)') | |
1 0.000031 nmap <buffer><expr> -r <SID>smart_map('-r', '<Plug>(gita-action-reset)') | |
1 0.000031 nmap <buffer><expr> -d <SID>smart_map('-d', '<Plug>(gita-action-rm)') | |
1 0.000031 nmap <buffer><expr> -D <SID>smart_map('-D', '<Plug>(gita-action-RM)') | |
1 0.000032 nmap <buffer><expr> -c <SID>smart_map('-c', '<Plug>(gita-action-checkout)') | |
1 0.000032 nmap <buffer><expr> -C <SID>smart_map('-C', '<Plug>(gita-action-CHECKOUT)') | |
1 0.000031 nmap <buffer><expr> -o <SID>smart_map('-o', '<Plug>(gita-action-ours)') | |
1 0.000032 nmap <buffer><expr> -t <SID>smart_map('-t', '<Plug>(gita-action-theirs)') | |
1 0.000027 vmap <buffer> << <Plug>(gita-action-stage) | |
1 0.000026 vmap <buffer> >> <Plug>(gita-action-unstage) | |
1 0.000026 vmap <buffer> -- <Plug>(gita-action-toggle) | |
1 0.000026 vmap <buffer> == <Plug>(gita-action-discard) | |
1 0.000056 vmap <buffer> -a <Plug>(gita-action-add) | |
1 0.000026 vmap <buffer> -A <Plug>(gita-action-ADD) | |
1 0.000026 vmap <buffer> -r <Plug>(gita-action-reset) | |
1 0.000025 vmap <buffer> -d <Plug>(gita-action-rm) | |
1 0.000026 vmap <buffer> -D <Plug>(gita-action-RM) | |
1 0.000026 vmap <buffer> -c <Plug>(gita-action-checkout) | |
1 0.000027 vmap <buffer> -C <Plug>(gita-action-CHECKOUT) | |
1 0.000026 vmap <buffer> -o <Plug>(gita-action-ours) | |
1 0.000026 vmap <buffer> -t <Plug>(gita-action-theirs) | |
1 0.000004 endif | |
FUNCTION gita#util#echo() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
execute 'echohl' a:hl | |
try | |
for m in split(a:msg, '\v\r?\n') | |
echo m | |
endfor | |
finally | |
echohl None | |
endtry | |
FUNCTION <SNR>83_intersect() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION 80() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return keys(self._cached) | |
FUNCTION 81() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let self._cached = {} | |
FUNCTION 82() | |
Called 288 times | |
Total time: 0.062217 | |
Self time: 0.005580 | |
count total (s) self (s) | |
288 0.060983 0.004346 return s:hash(a:obj) | |
FUNCTION 83() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
throw "System.Cache.Base: has({name}) is not implemented" | |
FUNCTION 85() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
throw "System.Cache.Base: set({name}, {value}[, {default}]) is not implemented" | |
FUNCTION 86() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
throw "System.Cache.Base: keys() is not implemented" | |
FUNCTION 87() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
throw "System.Cache.Base: remove({name}) is not implemented" | |
FUNCTION 88() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
throw "System.Cache.Base: clear() is not implemented" | |
FUNCTION 89() | |
Called 1 time | |
Total time: 0.002171 | |
Self time: 0.000212 | |
count total (s) self (s) | |
1 0.000017 let options = extend({ 'no_cache': 0 }, get(a:000, 0, {})) | |
1 0.000080 0.000027 let abspath = s:Prelude.path2directory(fnamemodify(a:path, ':p')) | |
1 0.000218 0.000017 let metainfo = self.cache.get(abspath, {}) | |
1 0.000009 if !empty(metainfo) && metainfo.path == abspath && !options.no_cache | |
if strlen(metainfo.worktree) | |
return { 'worktree': metainfo.worktree, 'repository': metainfo.repository } | |
else | |
return {} | |
endif | |
endif | |
1 0.001059 0.000022 let worktree = s:Core.find_worktree(abspath) | |
1 0.000481 0.000022 let repository = strlen(worktree) ? s:Core.find_repository(worktree) : '' | |
1 0.000013 let metainfo = { 'path': abspath, 'worktree': worktree, 'repository': repository,} | |
1 0.000226 0.000016 call self.cache.set(abspath, metainfo) | |
1 0.000007 if strlen(metainfo.worktree) | |
1 0.000011 return { 'worktree': metainfo.worktree, 'repository': metainfo.repository } | |
else | |
return {} | |
endif | |
FUNCTION airline#util#wrap() | |
Called 72 times | |
Total time: 0.002186 | |
Self time: 0.002186 | |
count total (s) self (s) | |
72 0.000774 if a:minwidth > 0 && winwidth(0) < a:minwidth | |
return '' | |
endif | |
72 0.000418 return a:text | |
FUNCTION <SNR>90__get_instance_cache() | |
Called 1 time | |
Total time: 0.000151 | |
Self time: 0.000059 | |
count total (s) self (s) | |
1 0.000008 if !exists('s:instance_cache') | |
1 0.000057 0.000013 let config = s:get_config() | |
1 0.000067 0.000021 let s:instance_cache = call( config.cache.instance.new, config.cache.instance_args, config.cache.instance,) | |
1 0.000003 endif | |
1 0.000005 return s:instance_cache | |
FUNCTION neomake#ProcessCurrentBuffer() | |
Called 1 time | |
Total time: 0.000117 | |
Self time: 0.000088 | |
count total (s) self (s) | |
1 0.000013 let buf = bufnr('%') | |
1 0.000011 if has_key(s:job_output_by_buffer, buf) | |
for output in s:job_output_by_buffer[buf] | |
call s:ProcessJobOutput(output.maker, output.lines) | |
endfor | |
unlet s:job_output_by_buffer[buf] | |
endif | |
1 0.000057 0.000028 call neomake#signs#PlaceVisibleSigns() | |
FUNCTION <SNR>95_iconv() | |
Called 12 times | |
Total time: 0.001316 | |
Self time: 0.001316 | |
count total (s) self (s) | |
12 0.000227 if a:from == '' || a:to == '' || a:from ==? a:to | |
return a:expr | |
endif | |
12 0.000621 let result = iconv(a:expr, a:from, a:to) | |
12 0.000136 return result != '' ? result : a:expr | |
FUNCTION <SNR>95_has_vimproc() | |
Called 24 times | |
Total time: 0.002436 | |
Self time: 0.002436 | |
count total (s) self (s) | |
24 0.000292 if !exists('s:exists_vimproc') | |
1 0.000004 try | |
1 0.000887 call vimproc#version() | |
let s:exists_vimproc = 1 | |
catch | |
1 0.000009 let s:exists_vimproc = 0 | |
1 0.000006 endtry | |
1 0.000003 endif | |
24 0.000155 return s:exists_vimproc | |
FUNCTION <SNR>99__make_nested_dict() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if len(a:keys) == 1 | |
return {a:keys[0]: a:value} | |
else | |
return {a:keys[0]: s:_make_nested_dict(a:keys[1:], a:value)} | |
endif | |
FUNCTION <SNR>86_make_index() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let value = a:0 ? a:1 : 1 | |
return s:make(a:list, [], value) | |
FUNCTION <SNR>94_get_remote_url() | |
Called 4 times | |
Total time: 0.000216 | |
Self time: 0.000216 | |
count total (s) self (s) | |
" a url of {remote} | |
4 0.000075 let section = get(a:config, printf('remote "%s"', a:remote), {}) | |
4 0.000031 if empty(section) | |
return '' | |
endif | |
4 0.000038 return get(section, 'url', '') | |
FUNCTION <SNR>82_is_string() | |
Called 295 times | |
Total time: 0.004263 | |
Self time: 0.004263 | |
count total (s) self (s) | |
295 0.003288 return type(a:Value) ==# s:__TYPE_STRING | |
FUNCTION <SNR>102_get_base() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let opts = extend({ 'from_index': 1,}, get(a:000, 0, {})) | |
if opts.from_index | |
let result = s:C.exec(['show', ':1:' . a:filename], opts) | |
if result.status == 0 | |
return split(result.stdout, '\v\r?\n') | |
endif | |
return result | |
else | |
return s:strip_conflict(readfile(a:filename), 1) | |
endif | |
FUNCTION 90() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
call self.cache.clear() | |
FUNCTION 91() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let opts = extend({ 'verbose': 1,}, get(a:000, 0, {})) | |
let keys = self.cache.keys() | |
let n = len(keys) | |
let c = 1 | |
for key in keys | |
let metainfo = self.cache.get(key) | |
if isdirectory(metainfo.path) | |
let metainfo.worktree = s:Core.find_worktree(metainfo.path) | |
let metainfo.repository = s:Core.find_repository(metainfo.worktree) | |
if opts.verbose | |
redraw | |
echomsg printf("%d/%d: '%s' is a %s", c, n, metainfo.path, strlen(metainfo.worktree) ? 'worktree' : 'not worktree',) | |
endif | |
call self.cache.set(key, metainfo) | |
else | |
" missing path | |
call self.cache.remove(key) | |
if opts.verbose | |
redraw | |
echomsg printf("%d/%d: '%s' is missing", c, n, metainfo.path,) | |
endif | |
endif | |
let c += 1 | |
endfor | |
FUNCTION <SNR>98_parse() | |
Called 4 times | |
Total time: 0.139272 | |
Self time: 0.029361 | |
count total (s) self (s) | |
4 0.000162 let opts = extend({ 'fail_silently': 0,}, get(a:000, 0, {})) | |
4 0.000083 let obj = { 'all': [], 'conflicted': [], 'staged': [], 'unstaged': [], 'untracked': [], 'ignored': [],} | |
148 0.002811 for line in split(a:status, '\v%(\r?\n)+') | |
144 0.113297 0.003386 let result = s:parse_record(line, opts) | |
144 0.001354 if empty(result) && opts.fail_silently | |
continue | |
elseif has_key(result, 'current_branch') | |
let obj.current_branch = result.current_branch | |
let obj.remote_branch = result.remote_branch | |
else | |
144 0.001988 call add(obj.all, result) | |
144 0.000749 if result.is_conflicted | |
call add(obj.conflicted, result) | |
elseif result.is_staged && result.is_unstaged | |
call add(obj.staged, result) | |
call add(obj.unstaged, result) | |
elseif result.is_staged | |
3 0.000039 call add(obj.staged, result) | |
3 0.000015 elseif result.is_unstaged | |
5 0.000059 call add(obj.unstaged, result) | |
5 0.000024 elseif result.is_untracked | |
136 0.001586 call add(obj.untracked, result) | |
136 0.000678 elseif result.is_ignored | |
call add(obj.ignored, result) | |
endif | |
144 0.000428 endif | |
144 0.000474 endfor | |
4 0.000022 return obj | |
FUNCTION 93() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if call(self.move, a:000, self) | |
if winnr('$') != 1 | |
close | |
elseif tabpagenr('$') != 1 | |
tabclose | |
else | |
enew | |
endif | |
endif | |
FUNCTION <SNR>11_LoadIndent() | |
Called 2 times | |
Total time: 0.002692 | |
Self time: 0.002588 | |
count total (s) self (s) | |
2 0.000025 if exists("b:undo_indent") | |
1 0.000031 exe b:undo_indent | |
1 0.000008 unlet! b:undo_indent b:did_indent | |
1 0.000003 endif | |
2 0.000031 let s = expand("<amatch>") | |
2 0.000014 if s != "" | |
2 0.000015 if exists("b:did_indent") | |
unlet b:did_indent | |
endif | |
" When there is a dot it is used to separate filetype names. Thus for | |
" "aaa.bbb" load "indent/aaa.vim" and then "indent/bbb.vim". | |
4 0.000048 for name in split(s, '\.') | |
2 0.002396 0.002292 exe 'runtime! indent/' . name . '.vim' | |
2 0.000013 endfor | |
2 0.000008 endif | |
FUNCTION gita#util#smart_define() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let mode = get(a:000, 0, '') | |
let opts = extend({ 'noremap': 0, 'silent': 0, 'buffer': 0,}, get(a:000, 1, {})) | |
if !hasmapto(a:rhs, mode) && empty(maparg(a:lhs, mode)) | |
silent execute printf('%s%smap %s%s %s %s', mode, opts.noremap ? 'nore' : '', opts.silent ? '<silent>' : '', opts.buffer ? '<buffer>' : '', a:lhs, a:rhs,) | |
endif | |
FUNCTION 96() | |
Called 1 time | |
Total time: 0.000018 | |
Self time: 0.000018 | |
count total (s) self (s) | |
1 0.000009 let self._user_config = a:config | |
1 0.000004 return self | |
FUNCTION 97() | |
Called 1 time | |
Total time: 0.000014 | |
Self time: 0.000014 | |
count total (s) self (s) | |
1 0.000010 return has_key(self._bufnrs, a:bufnr) | |
FUNCTION 98() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let bufname = a:0 ? a:1 : bufname(a:bufnr) | |
let self._bufnrs[a:bufnr] = bufname | |
FUNCTION 99() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return sort(map(keys(self._bufnrs), 'v:val - 0')) | |
FUNCTION <SNR>86_pick() | |
Called 2 times | |
Total time: 0.000199 | |
Self time: 0.000199 | |
count total (s) self (s) | |
2 0.000014 let new_dict = {} | |
6 0.000028 for key in a:keys | |
4 0.000030 if has_key(a:dict, key) | |
2 0.000020 let new_dict[key] = a:dict[key] | |
2 0.000006 endif | |
4 0.000011 endfor | |
2 0.000010 return new_dict | |
FUNCTION <SNR>104__vital_depends() | |
Called 1 time | |
Total time: 0.000009 | |
Self time: 0.000009 | |
count total (s) self (s) | |
1 0.000006 return ['Prelude'] | |
FUNCTION <SNR>95_get_last_status() | |
Called 12 times | |
Total time: 0.001071 | |
Self time: 0.000310 | |
count total (s) self (s) | |
12 0.000998 0.000238 return s:has_vimproc() ? vimproc#get_last_status() : v:shell_error | |
FUNCTION <SNR>82_is_dict() | |
Called 16 times | |
Total time: 0.000218 | |
Self time: 0.000218 | |
count total (s) self (s) | |
16 0.000162 return type(a:Value) ==# s:__TYPE_DICT | |
FUNCTION <SNR>10_LoadFTPlugin() | |
Called 2 times | |
Total time: 0.010091 | |
Self time: 0.009616 | |
count total (s) self (s) | |
2 0.000022 if exists("b:undo_ftplugin") | |
1 0.000053 exe b:undo_ftplugin | |
1 0.000008 unlet! b:undo_ftplugin b:did_ftplugin | |
1 0.000003 endif | |
2 0.000026 let s = expand("<amatch>") | |
2 0.000011 if s != "" | |
2 0.000064 if &cpo =~# "S" && exists("b:did_ftplugin") | |
" In compatible mode options are reset to the global values, need to | |
" set the local values also when a plugin was already used. | |
unlet b:did_ftplugin | |
endif | |
" When there is a dot it is used to separate filetype names. Thus for | |
" "aaa.bbb" load "aaa" and then "bbb". | |
4 0.000043 for name in split(s, '\.') | |
2 0.009384 0.008909 exe 'runtime! ftplugin/' . name . '.vim ftplugin/' . name . '_*.vim ftplugin/' . name . '/*.vim' | |
2 0.000031 endfor | |
2 0.000009 endif | |
FUNCTION <SNR>94_get_commit_editmsg() | |
Called 1 time | |
Total time: 0.000305 | |
Self time: 0.000051 | |
count total (s) self (s) | |
" This is the last commit’s message. It’s not actually used by Git at all, | |
" but it’s there mostly for your reference after you made a commit. | |
1 0.000200 0.000024 let filename = s:Path.join(a:repository, 'COMMIT_EDITMSG') | |
1 0.000094 0.000017 return s:_readfile(filename) | |
FUNCTION <SNR>82_escape_pattern() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return escape(a:str, '~"\.^$[]*') | |
FUNCTION <SNR>82_path2directory() | |
Called 14 times | |
Total time: 0.000796 | |
Self time: 0.000556 | |
count total (s) self (s) | |
14 0.000746 0.000506 return s:substitute_path_separator(isdirectory(a:path) ? a:path : fnamemodify(a:path, ':p:h')) | |
FUNCTION airline#util#getwinvar() | |
Called 72 times | |
Total time: 0.000972 | |
Self time: 0.000972 | |
count total (s) self (s) | |
72 0.000746 return getwinvar(a:winnr, a:key, a:def) | |
FUNCTION <SNR>93__pad_with_char() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return repeat(a:char, a:left). a:str. repeat(a:char, a:right) | |
FUNCTION gita#util#listalize() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return gita#util#is_list(a:val) ? a:val : [a:val] | |
FUNCTION airline#extensions#whitespace#check() | |
Called 12 times | |
Total time: 0.000311 | |
Self time: 0.000311 | |
count total (s) self (s) | |
12 0.000178 if &readonly || !&modifiable || !s:enabled || line('$') > s:max_lines | |
12 0.000059 return '' | |
endif | |
if !exists('b:airline_whitespace_check') | |
let b:airline_whitespace_check = '' | |
let checks = get(g:, 'airline#extensions#whitespace#checks', s:default_checks) | |
let trailing = 0 | |
if index(checks, 'trailing') > -1 | |
let trailing = search('\s$', 'nw') | |
endif | |
let mixed = 0 | |
if index(checks, 'indent') > -1 | |
let mixed = s:check_mixed_indent() | |
endif | |
if trailing != 0 || mixed != 0 | |
let b:airline_whitespace_check = s:symbol | |
if s:show_message | |
if trailing != 0 | |
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:trailing_format, trailing) | |
endif | |
if mixed != 0 | |
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixed) | |
endif | |
endif | |
endif | |
endif | |
return b:airline_whitespace_check | |
FUNCTION <SNR>81__build_module() | |
Called 91 times | |
Total time: 1.186817 | |
Self time: 0.939069 | |
count total (s) self (s) | |
91 0.000912 if has_key(s:loaded, a:sid) | |
70 0.001625 return copy(s:loaded[a:sid]) | |
endif | |
21 0.045822 0.000354 let functions = s:_get_functions(a:sid) | |
21 0.000224 let prefix = '<SNR>' . a:sid . '_' | |
21 0.000150 let module = {} | |
304 0.001214 for func in functions | |
283 0.004390 let module[func] = function(prefix . func) | |
283 0.000974 endfor | |
21 0.000195 if has_key(module, '_vital_loaded') | |
13 0.052835 let V = vital#{s:self_version}#new() | |
13 0.000111 if has_key(module, '_vital_depends') | |
12 0.000088 let all = {} | |
12 0.037626 0.000835 let modules = s:_concat(map(module._vital_depends(), 's:expand_modules(v:val, all)')) | |
12 0.077515 call call(V.load, modules, V) | |
12 0.000037 endif | |
13 0.000057 try | |
13 0.063243 0.063216 call module._vital_loaded(V) | |
12 0.000044 catch | |
" FIXME: Show an error message for debug. | |
1 0.000005 endtry | |
13 0.000038 endif | |
21 0.000198 if !get(g:, 'vital_debug', 0) | |
21 0.003445 call filter(module, 'v:key =~# "^\\a"') | |
21 0.000077 endif | |
21 0.000247 let s:loaded[a:sid] = module | |
21 0.000321 return copy(module) | |
FUNCTION <SNR>83_or() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:any('v:val', a:xs) | |
FUNCTION <SNR>98_is_untracked() | |
Called 144 times | |
Total time: 0.003350 | |
Self time: 0.003350 | |
count total (s) self (s) | |
144 0.002809 return a:sign =~# s:const.untracked_pattern | |
FUNCTION <SNR>83_flatten() | |
Called 68 times | |
Total time: 0.027067 | |
Self time: 0.021179 | |
count total (s) self (s) | |
68 0.000676 let limit = a:0 > 0 ? a:1 : -1 | |
68 0.000412 let memo = [] | |
68 0.000360 if limit == 0 | |
return a:list | |
endif | |
68 0.000427 let limit -= 1 | |
345 0.001550 for Value in a:list | |
277 0.004697 let memo += type(Value) == type([]) ? s:flatten(Value, limit) : [Value] | |
277 0.001003 unlet! Value | |
277 0.000816 endfor | |
68 0.000328 return memo | |
FUNCTION airline#update_statusline() | |
Called 4 times | |
Total time: 0.084802 | |
Self time: 0.001609 | |
count total (s) self (s) | |
8 0.000160 for nr in filter(range(1, winnr('$')), 'v:val != winnr()') | |
4 0.000133 0.000069 if airline#util#getwinvar(nr, 'airline_disabled', 0) | |
continue | |
endif | |
4 0.000046 call setwinvar(nr, 'airline_active', 0) | |
4 0.000063 let context = { 'winnr': nr, 'active': 0, 'bufnr': winbufnr(nr) } | |
4 0.030272 0.000107 call s:invoke_funcrefs(context, s:inactive_funcrefs) | |
4 0.000013 endfor | |
4 0.000026 unlet! w:airline_render_left | |
4 0.000018 unlet! w:airline_render_right | |
36 0.000144 for section in s:sections | |
32 0.000222 unlet! w:airline_section_{section} | |
32 0.000086 endfor | |
4 0.000025 let w:airline_active = 1 | |
4 0.000068 let context = { 'winnr': winnr(), 'active': 1, 'bufnr': winbufnr(winnr()) } | |
4 0.053084 0.000120 call s:invoke_funcrefs(context, g:airline_statusline_funcrefs) | |
FUNCTION <SNR>102__vital_loaded() | |
Called 1 time | |
Total time: 0.012498 | |
Self time: 0.000169 | |
count total (s) self (s) | |
1 0.004879 0.000022 let s:P = a:V.import('Prelude') | |
1 0.007493 0.000022 let s:C = a:V.import('VCS.Git.Core') | |
1 0.000006 let s:const = {} | |
1 0.000008 let s:const.markers = {} | |
1 0.000010 let s:const.markers.ours = repeat('\<', 7) | |
1 0.000009 let s:const.markers.separator = repeat('\=', 7) | |
1 0.000009 let s:const.markers.theirs = repeat('\>', 7) | |
1 0.000006 let s:const.patterns = {} | |
1 0.000014 let s:const.patterns.ours = printf('%s[^\n]{-}%(\n|$)', s:const.markers.ours) | |
1 0.000014 let s:const.patterns.separator = printf('%s[^\n]{-}%(\n|$)', s:const.markers.separator) | |
1 0.000013 let s:const.patterns.theirs = printf('%s[^\n]{-}%(\n|$)', s:const.markers.theirs) | |
1 0.000007 lockvar s:const | |
1 0.000007 let self.const = s:const | |
FUNCTION <SNR>83__default_compare() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return a:a <# a:b ? -1 : a:a ># a:b ? 1 : 0 | |
FUNCTION <SNR>81_search() | |
Called 32 times | |
Total time: 0.030456 | |
Self time: 0.002099 | |
count total (s) self (s) | |
32 0.023956 0.000469 let paths = s:_vital_files(a:pattern) | |
32 0.005510 0.001025 let modules = sort(map(paths, 's:_file2module(v:val)')) | |
32 0.000800 0.000415 return s:_uniq(modules) | |
FUNCTION <SNR>23_invoke_funcrefs() | |
Called 8 times | |
Total time: 0.083129 | |
Self time: 0.001040 | |
count total (s) self (s) | |
8 0.000794 0.000128 let builder = airline#builder#new(a:context) | |
8 0.018436 0.000214 let err = airline#util#exec_funcrefs(a:funcrefs + s:core_funcrefs, builder, a:context) | |
8 0.000037 if err == 1 | |
8 0.063365 0.000163 let a:context.line = builder.build() | |
8 0.000118 let s:contexts[a:context.winnr] = a:context | |
8 0.000249 call setwinvar(a:context.winnr, '&statusline', '%!airline#statusline('.a:context.winnr.')') | |
8 0.000028 endif | |
FUNCTION <SNR>83_with_index() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let base = a:0 > 0 ? a:1 : 0 | |
return s:zip(a:list, range(base, len(a:list)+base-1)) | |
FUNCTION <SNR>83_take_while() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:span(a:f, a:xs)[0] | |
FUNCTION gita#interface#status#update() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if bufname('%') !=# s:const.bufname | |
call call('s:open', a:000) | |
else | |
call call('s:update', a:000) | |
endif | |
FUNCTION airline#highlighter#highlight_modified_inactive() | |
Called 2 times | |
Total time: 0.000514 | |
Self time: 0.000205 | |
count total (s) self (s) | |
2 0.000023 if getbufvar(a:bufnr, '&modified') | |
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c') ? g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c : [] | |
else | |
2 0.000058 let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c') ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c : [] | |
2 0.000006 endif | |
2 0.000013 if !empty(colors) | |
2 0.000350 0.000042 call airline#highlighter#exec('airline_c'.(a:bufnr).'_inactive', colors) | |
2 0.000007 endif | |
FUNCTION <SNR>101_action_discard() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let statuses = s:ensure_list(a:statuses) | |
let options = extend({ 'confirm': 1,}, a:options) | |
let delete_statuses = [] | |
let checkout_statuses = [] | |
for status in statuses | |
if status.is_untracked || status.is_ignored | |
call add(delete_statuses, status) | |
elseif status.is_staged || status.is_unstaged | |
call add(checkout_statuses, status) | |
else | |
" conflicted | |
call gita#util#info( printf('A discard action cannot be performed on a conflicted file "%s".', status.path)) | |
continue | |
endif | |
endfor | |
if empty(delete_statuses) && empty(checkout_statuses) | |
if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( 'No valid files were selected for discard action',) | |
endif | |
return | |
endif | |
if get(options, 'confirm', 1) | |
call gita#util#warn(join([ 'A discard action will discard all local changes on working tree', 'and the operation is irreversible, mean that you have no chance', 'to revert the operation.',])) | |
if !gita#util#asktf('Are you sure you want to discard the changes?') | |
call gita#util#info( 'The operation has canceled by user.') | |
return | |
endif | |
endif | |
for status in delete_statuses | |
call delete(get(status, 'path2', status.path)) | |
endfor | |
let options.ignore_empty_warning = 1 | |
let options.commit = 'INDEX' | |
let options.force = 1 | |
call s:action_checkout(checkout_statuses, options) | |
call s:update() | |
FUNCTION <SNR>83_foldl1() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if len(a:xs) == 0 | |
throw 'foldl1' | |
endif | |
return s:foldl(a:f, a:xs[0], a:xs[1:]) | |
FUNCTION <SNR>95_spawn() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let shellslash = 0 | |
if s:is_windows | |
let shellslash = &l:shellslash | |
setlocal noshellslash | |
endif | |
try | |
if type(a:expr) is s:TYPE_LIST | |
let special = 1 | |
let cmdline = join(map(a:expr, 'shellescape(v:val, special)'), ' ') | |
elseif type(a:expr) is s:TYPE_STRING | |
let cmdline = a:expr | |
if a:0 && a:1 | |
" for :! command | |
let cmdline = substitute(cmdline, '\([!%#]\|<[^<>]\+>\)', '\\\1', 'g') | |
endif | |
else | |
throw 'Process.spawn(): invalid argument (value type:'.type(a:expr).')' | |
endif | |
if s:is_windows | |
silent execute '!start' cmdline | |
else | |
silent execute '!' cmdline '&' | |
endif | |
finally | |
if s:is_windows | |
let &l:shellslash = shellslash | |
endif | |
endtry | |
return '' | |
FUNCTION <SNR>85_new() | |
Called 2 times | |
Total time: 0.000383 | |
Self time: 0.000183 | |
count total (s) self (s) | |
2 0.000044 let options = extend({ 'description': '',}, get(a:000, 0, {})) | |
2 0.000315 0.000116 let parser = extend(deepcopy(s:parser), s:D.pick(options, [ 'description', 'enable_positional_assign',])) | |
2 0.000009 return parser | |
FUNCTION <SNR>63_get_transitioned_seperator() | |
Called 8 times | |
Total time: 0.011909 | |
Self time: 0.000849 | |
count total (s) self (s) | |
8 0.000045 let line = '' | |
8 0.011475 0.000416 call airline#highlighter#add_separator(a:prev_group, a:group, a:side) | |
8 0.000102 let line .= '%#'.a:prev_group.'_to_'.a:group.'#' | |
8 0.000094 let line .= a:side ? a:self._context.left_sep : a:self._context.right_sep | |
8 0.000064 let line .= '%#'.a:group.'#' | |
8 0.000037 return line | |
FUNCTION <SNR>94_get_remote_hash() | |
Called 4 times | |
Total time: 10.218793 | |
Self time: 10.206084 | |
count total (s) self (s) | |
4 0.001286 0.000112 let filename = s:Path.join(a:repository, 'refs', 'remotes', a:remote, a:branch) | |
4 0.000364 0.000085 let hash = s:_readline(filename) | |
4 0.000030 if empty(hash) | |
" sometime the file is missing | |
4 0.000847 0.000092 let filename = s:Path.join(a:repository, 'packed-refs') | |
4 0.017400 0.006899 let packed_refs = join(s:_readfile(filename), "\n") | |
" Note: | |
" Vim document said '.' does not hit a new line but it is a LIE. | |
" And the behavior of regexpengine=1 is quite annoying thus the | |
" following discusting regex is required... | |
4 0.000145 let pattern = printf('\v(\w|\s)*\ze\srefs/remotes/%s/%s', a:remote, a:branch) | |
4 10.198487 let hash = matchstr(packed_refs, pattern) | |
4 0.000047 endif | |
4 0.000031 return hash | |
FUNCTION <SNR>101_validate_status_add() | |
Called 2 times | |
Total time: 0.000056 | |
Self time: 0.000056 | |
count total (s) self (s) | |
2 0.000027 if a:status.is_unstaged || a:status.is_untracked | |
2 0.000014 return 0 | |
elseif a:status.is_ignored && get(a:options, 'force', 0) | |
return 0 | |
elseif a:status.is_ignored | |
call gita#util#info(printf( 'An ignored file "%s" cannot be added. Use <Plug>(gita-action-ADD) instead.', a:status.path,)) | |
return 1 | |
elseif a:status.is_conflicted | |
if a:status.sign ==# 'DD' | |
call gita#util#error(printf( 'A both deleted conflict file "%s" cannot be added. Use <Plug>(gita-action-rm) instead.', a:status.path,)) | |
return 1 | |
else | |
return 0 | |
endif | |
else | |
call gita#util#info(printf( 'No changes of "%s" exist on working tree.', a:status.path,)) | |
return 1 | |
endif | |
FUNCTION gita#util#ask() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let result = gita#util#input('Question', a:message, get(a:000, 0, '')) | |
redraw | |
return result | |
FUNCTION 26() | |
Called 1 time | |
Total time: 0.000373 | |
Self time: 0.000373 | |
count total (s) self (s) | |
6 0.000037 for [name, value] in items(a:opts) | |
5 0.000073 if name !~# '\v^__.*__$' | |
1 0.000009 let pattern = self.arguments[name].pattern | |
1 0.000006 if !empty(pattern) && value !~# pattern | |
throw printf( 'vital: ArgumentParser: A value of "%s" argument does not a specified pattern "%s".', name, pattern,) | |
endif | |
1 0.000002 endif | |
5 0.000018 silent! unlet name | |
5 0.000016 silent! unlet value | |
5 0.000013 endfor | |
FUNCTION <SNR>99__extend_nested_dict() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let expr1 = deepcopy(a:expr1) | |
for [key, value] in items(a:expr2) | |
if has_key(expr1, key) | |
if type(value) == 4 && type(expr1[key]) == 4 | |
let expr1[key] = s:_extend_nested_dict(expr1[key], value) | |
else | |
let expr1[key] = value | |
endif | |
else | |
let expr1[key] = value | |
endif | |
endfor | |
return expr1 | |
FUNCTION <SNR>82_is_numeric() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let _ = type(a:Value) | |
return _ ==# s:__TYPE_NUMBER || _ ==# s:__TYPE_FLOAT | |
FUNCTION <SNR>83_binary_search() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION <SNR>81__runtime_files() | |
Called 1 time | |
Total time: 0.007616 | |
Self time: 0.007616 | |
count total (s) self (s) | |
1 0.007611 return split(globpath(&runtimepath, a:path, 1), "\n") | |
FUNCTION gita#util#debug() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if !get(g:, 'gita#debug', 0) | |
return | |
endif | |
let parts = [] | |
for x in a:000 | |
call add(parts, string(x)) | |
silent unlet! x | |
endfor | |
call gita#util#echomsg('Comment', 'DEBUG: ' . join(parts)) | |
FUNCTION <SNR>91_new() | |
Called 4 times | |
Total time: 0.000194 | |
Self time: 0.000129 | |
count total (s) self (s) | |
4 0.000182 0.000117 return extend(s:Base.new(), deepcopy(s:cache)) | |
FUNCTION <SNR>101_get_selected_statuses() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let gita = s:get_gita() | |
let statuses_map = get(gita.interface.status, 'statuses_map', {}) | |
let selected_lines = getline(getpos("'<")[1], getpos("'>")[1]) | |
let selected_statuses = [] | |
for selected_line in selected_lines | |
let status = get(statuses_map, selected_line, {}) | |
if !empty(status) | |
call add(selected_statuses, status) | |
endif | |
endfor | |
return selected_statuses | |
FUNCTION <SNR>87__vital_depends() | |
Called 1 time | |
Total time: 0.000010 | |
Self time: 0.000010 | |
count total (s) self (s) | |
1 0.000006 return ['System.Filepath'] | |
FUNCTION <SNR>102_has_ours_marker() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let buflines = s:P.is_list(a:buflines) ? join(a:buflines, "\n") : a:buflines | |
return !empty(matchstr(buflines, '\v' . s:const.patterns.ours)) | |
FUNCTION <SNR>94_find_worktree() | |
Called 1 time | |
Total time: 0.001037 | |
Self time: 0.000568 | |
count total (s) self (s) | |
1 0.000185 0.000025 let path = s:_fnamemodify(s:Prelude.path2directory(a:path), ':p') | |
1 0.000295 0.000181 let d = s:_fnamemodify(finddir('.git', path . ';'), ':p:h') | |
1 0.000375 0.000280 let f = s:_fnamemodify(findfile('.git', path . ';'), ':p') | |
" inside '.git' directory is not a working directory | |
1 0.000034 let d = path =~# printf('\v^%s', d) ? '' : d | |
" use deepest dotgit found | |
1 0.000011 let dotgit = strlen(d) >= strlen(f) ? d : f | |
1 0.000117 0.000017 return strlen(dotgit) ? s:_fnamemodify(dotgit, ':h') : '' | |
FUNCTION gita#interface#status#define_highlights() | |
Called 1 time | |
Total time: 0.000246 | |
Self time: 0.000246 | |
count total (s) self (s) | |
1 0.000085 highlight link GitaComment Comment | |
1 0.000025 highlight link GitaConflicted Error | |
1 0.000025 highlight link GitaUnstaged Constant | |
1 0.000025 highlight link GitaStaged Special | |
1 0.000016 highlight link GitaUntracked GitaUnstaged | |
1 0.000026 highlight link GitaIgnored Identifier | |
1 0.000026 highlight link GitaBranch Title | |
FUNCTION <SNR>94__readline() | |
Called 11 times | |
Total time: 0.001005 | |
Self time: 0.000400 | |
count total (s) self (s) | |
11 0.000810 0.000205 let contents = s:_readfile(a:path) | |
11 0.000124 return empty(contents) ? '' : contents[0] | |
FUNCTION <SNR>93_reverse() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return join(reverse(split(a:str, '.\zs')), '') | |
FUNCTION <SNR>104_get_selected_text() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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) | |
FUNCTION <SNR>82_is_number() | |
Called 3 times | |
Total time: 0.000069 | |
Self time: 0.000069 | |
count total (s) self (s) | |
3 0.000050 return type(a:Value) ==# s:__TYPE_NUMBER | |
FUNCTION <SNR>78_get_parser() | |
Called 1 time | |
Total time: 0.001042 | |
Self time: 0.000068 | |
count total (s) self (s) | |
1 0.000008 if !exists('s:parser') | |
1 0.000213 0.000022 let s:parser = s:ArgumentParser.new({ 'name': 'An altimate git interface of Vim',}) | |
1 0.000803 0.000021 call s:parser.add_argument( 'action', 'An action of the Gita command', { 'terminal': 1, }) | |
1 0.000003 endif | |
1 0.000005 return s:parser | |
FUNCTION 94() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
throw 'vital: Vim.BufferManager: not implemented yet' | |
FUNCTION <SNR>101_ac_quit() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
call gita#util#invoker_focus() | |
FUNCTION 95() | |
Called 1 time | |
Total time: 0.000059 | |
Self time: 0.000047 | |
count total (s) self (s) | |
1 0.000005 if a:0 == 0 | |
return self._config | |
elseif a:0 == 1 && s:P.is_dict(a:1) | |
1 0.000013 call extend(self._config, a:1) | |
1 0.000004 return self | |
elseif a:0 == 1 | |
return get(self._config, a:1) | |
elseif a:0 == 2 | |
let self._config[a:1] = a:2 | |
return self | |
endif | |
throw 'vital: Vim.BufferManager: invalid argument for config()' | |
FUNCTION gita#util#format() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
" format rule: | |
" %{<left>|<right>}<key> | |
" '<left><value><right>' if <value> != '' | |
" '' if <value> == '' | |
" %{<left>}<key> | |
" '<left><value>' if <value> != '' | |
" '' if <value> == '' | |
" %{|<right>}<key> | |
" '<value><right>' if <value> != '' | |
" '' if <value> == '' | |
if empty(a:data) | |
return '' | |
endif | |
let pattern_base = '\v\%%%%(\{([^\}\|]*)%%(\|([^\}\|]*)|)\}|)%s' | |
let str = copy(a:format) | |
for [key, value] in items(a:format_map) | |
let result = s:to_string(get(a:data, value, '')) | |
let pattern = printf(pattern_base, key) | |
let repl = strlen(result) ? printf('\1%s\2', result) : '' | |
let str = substitute(str, pattern, repl, 'g') | |
endfor | |
return substitute(str, '\v^\s+|\s+$', '', 'g') | |
FUNCTION <SNR>83_all() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return !s:any(printf('!(%s)', a:f), a:xs) | |
FUNCTION <SNR>83_find_index() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION airline#highlighter#highlight() | |
Called 2 times | |
Total time: 0.031926 | |
Self time: 0.009134 | |
count total (s) self (s) | |
2 0.000024 let p = g:airline#themes#{g:airline_theme}#palette | |
" draw the base mode, followed by any overrides | |
2 0.000075 let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val') | |
2 0.000021 let suffix = a:modes[0] == 'inactive' ? '_inactive' : '' | |
5 0.000027 for mode in mapped | |
3 0.000049 if exists('g:airline#themes#{g:airline_theme}#palette[mode]') | |
2 0.000022 let dict = g:airline#themes#{g:airline_theme}#palette[mode] | |
22 0.000128 for kvp in items(dict) | |
20 0.000142 let mode_colors = kvp[1] | |
20 0.002694 0.000349 call airline#highlighter#exec(kvp[0].suffix, mode_colors) | |
60 0.000327 for accent in keys(s:accents) | |
40 0.000314 if !has_key(p.accents, accent) | |
continue | |
endif | |
40 0.000353 let colors = copy(mode_colors) | |
40 0.000311 if p.accents[accent][0] != '' | |
20 0.000191 let colors[0] = p.accents[accent][0] | |
20 0.000054 endif | |
40 0.000283 if p.accents[accent][2] != '' | |
20 0.000182 let colors[2] = p.accents[accent][2] | |
20 0.000051 endif | |
40 0.000223 if len(colors) >= 5 | |
24 0.000255 let colors[4] = get(p.accents[accent], 4, '') | |
24 0.000088 else | |
16 0.000234 call add(colors, get(p.accents[accent], 4, '')) | |
16 0.000043 endif | |
40 0.005619 0.000779 call airline#highlighter#exec(kvp[0].suffix.'_'.accent, colors) | |
40 0.000129 endfor | |
20 0.000050 endfor | |
" TODO: optimize this | |
16 0.000094 for sep in items(s:separators) | |
14 0.015979 0.000373 call <sid>exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix) | |
14 0.000048 endfor | |
2 0.000005 endif | |
3 0.000008 endfor | |
FUNCTION <SNR>95_shellescape() | |
Called 69 times | |
Total time: 0.001243 | |
Self time: 0.001243 | |
count total (s) self (s) | |
69 0.000928 return call('shellescape', a:000) | |
FUNCTION <SNR>98_is_ignored() | |
Called 144 times | |
Total time: 0.002688 | |
Self time: 0.002688 | |
count total (s) self (s) | |
144 0.002171 return a:sign =~# s:const.ignored_pattern | |
FUNCTION <SNR>104_is_cmdwin() | |
Called 1 time | |
Total time: 0.000012 | |
Self time: 0.000012 | |
count total (s) self (s) | |
1 0.000007 return getcmdwintype() !=# '' | |
FUNCTION gita#util#invoker_focus() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let winnum = call('gita#util#invoker_get_winnum', a:000) | |
if winnum <= winnr('$') | |
silent execute winnum . 'wincmd w' | |
else | |
silent execute 'wincmd p' | |
endif | |
FUNCTION <SNR>13_SynSet() | |
Called 2 times | |
Total time: 0.033601 | |
Self time: 0.006419 | |
count total (s) self (s) | |
" clear syntax for :set syntax=OFF and any syntax name that doesn't exist | |
2 0.000617 syn clear | |
2 0.000027 if exists("b:current_syntax") | |
unlet b:current_syntax | |
endif | |
2 0.000324 let s = expand("<amatch>") | |
2 0.000015 if s == "ON" | |
" :set syntax=ON | |
if &filetype == "" | |
echohl ErrorMsg | |
echo "filetype unknown" | |
echohl None | |
endif | |
let s = &filetype | |
elseif s == "OFF" | |
let s = "" | |
endif | |
2 0.000010 if s != "" | |
" Load the syntax file(s). When there are several, separated by dots, | |
" load each in sequence. | |
4 0.000074 for name in split(s, '\.') | |
2 0.032331 0.005149 exe "runtime! syntax/" . name . ".vim syntax/" . name . "/*.vim" | |
2 0.000011 endfor | |
2 0.000007 endif | |
FUNCTION airline#parts#ffenc() | |
Called 16 times | |
Total time: 0.001089 | |
Self time: 0.001089 | |
count total (s) self (s) | |
16 0.001021 return printf('%s%s', &fenc, strlen(&ff) > 0 ? '['.&ff.']' : '') | |
FUNCTION <SNR>96_parse() | |
Called 1 time | |
Total time: 0.053142 | |
Self time: 0.020309 | |
count total (s) self (s) | |
1 0.000013 let fail_silently = get(a:000, 0, 1) | |
1 0.000007 let sections = {} | |
1 0.000011 let sections[s:default_section] = {} | |
1 0.000009 let current_section = s:default_section | |
200 0.003778 for line in split(a:ini, '\v%(\r?\n)+') | |
199 0.036362 0.003529 let record = s:parse_record(line) | |
199 0.001359 if record.type ==# 'section' | |
67 0.000488 let current_section = record.name | |
67 0.001011 let sections[current_section] = get(sections, current_section, {}) | |
67 0.000301 elseif record.type ==# 'parameter' | |
132 0.001651 let sections[current_section][record.key] = record.value | |
132 0.000714 elseif record.type ==# 'unknown' && !fail_silently | |
throw 'vital: Text.INI: Parsing a record failed: ' . record.value | |
endif | |
199 0.000694 endfor | |
1 0.000005 return sections | |
FUNCTION <SNR>84_remove_last_separator() | |
Called 5 times | |
Total time: 0.000349 | |
Self time: 0.000238 | |
count total (s) self (s) | |
5 0.000178 0.000067 let sep = s:separator() | |
5 0.000049 let pat = (sep == '\' ? '\\' : '/') . '\+$' | |
5 0.000093 return substitute(a:path, pat, '', '') | |
FUNCTION <SNR>82_is_funcref() | |
Called 1 time | |
Total time: 0.000013 | |
Self time: 0.000013 | |
count total (s) self (s) | |
1 0.000009 return type(a:Value) ==# s:__TYPE_FUNCREF | |
FUNCTION <SNR>94_get_merge_head() | |
Called 4 times | |
Total time: 0.001362 | |
Self time: 0.000231 | |
count total (s) self (s) | |
" When doing a merge, this is the SHA of the branch you’re merging from. | |
4 0.000901 0.000103 let filename = s:Path.join(a:repository, 'MERGE_HEAD') | |
4 0.000428 0.000095 return s:_readline(filename) | |
FUNCTION <SNR>89_GitaStatus() | |
Called 1 time | |
Total time: 3.083868 | |
Self time: 0.000391 | |
count total (s) self (s) | |
1 3.083860 0.000383 call gita#interface#status#open(a:opts) | |
FUNCTION <SNR>92__vital_depends() | |
Called 1 time | |
Total time: 0.000010 | |
Self time: 0.000010 | |
count total (s) self (s) | |
1 0.000007 return ['Prelude', 'Data.String'] | |
FUNCTION <SNR>84_path_extensions() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if !exists('s:path_extensions') | |
if s:is_windows | |
if exists('$PATHEXT') | |
let pathext = $PATHEXT | |
else | |
" get default PATHEXT | |
let pathext = matchstr(system('set pathext'), '^pathext=\zs.*\ze\n', 'i') | |
endif | |
let s:path_extensions = map(split(pathext, s:path_separator), 'tolower(v:val)') | |
elseif s:is_cygwin | |
" cygwin is not use $PATHEXT | |
let s:path_extensions = ['', '.exe'] | |
else | |
let s:path_extensions = [''] | |
endif | |
endif | |
return s:path_extensions | |
FUNCTION <SNR>101_get_gita() | |
Called 11 times | |
Total time: 0.005740 | |
Self time: 0.000951 | |
count total (s) self (s) | |
11 0.005099 0.000311 let gita = call('gita#get', a:000) | |
11 0.000208 let gita.interface = get(gita, 'interface', {}) | |
11 0.000202 let gita.interface.status = get(gita.interface, 'status', {}) | |
11 0.000072 return gita | |
FUNCTION <SNR>93_scan() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let list = [] | |
call substitute(a:str, a:pattern, '\=add(list, submatch(0)) == [] ? "" : ""', 'g') | |
return list | |
FUNCTION <SNR>89_GitaDefault() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let git = s:Git.find(expand('%')) | |
let result = git.exec(a:opts.__args__) | |
if result.status == 0 | |
call gita#util#info( result.stdout, printf('Ok: "%s"', join(result.args))) | |
call gita#util#doautocmd(a:opts.__name__ . '-post') | |
else | |
call gita#util#info( result.stdout, printf('No: "%s"', join(result.args))) | |
endif | |
FUNCTION gita#util#flatten() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return call(s:List.flatten, a:000, s:List) | |
FUNCTION <SNR>84_is_absolute() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return a:path[0] ==# '/' | |
FUNCTION <SNR>102_strip_theirs() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let buflines = s:P.is_list(a:buflines) ? join(a:buflines, "\n") : a:buflines | |
let region_pattern = printf('%s.{-}%s', s:const.patterns.separator, s:const.patterns.theirs,) | |
let buflines = substitute(buflines, '\v' . region_pattern . '\n?', '', 'g') | |
let buflines = substitute(buflines, '\v' . s:const.patterns.ours . '\n?', '', 'g') | |
return get(a:000, 0, s:P.is_list(a:buflines)) ? split(buflines, '\v\r?\n') : buflines | |
FUNCTION <SNR>82_strwidthpart_reverse() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION gita#util#error() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let title = get(a:000, 0, '') | |
if strlen(title) | |
call gita#util#echomsg('Error', title) | |
call gita#util#echomsg('None', a:message) | |
else | |
call gita#util#echomsg('Error', a:message) | |
endif | |
FUNCTION <SNR>35_load() | |
Called 1 time | |
Total time: 0.000038 | |
Self time: 0.000038 | |
count total (s) self (s) | |
1 0.000025 if count(g:niji_matching_filetypes, &ft) > 0 | |
call niji#highlight() | |
endif | |
FUNCTION <SNR>101_update() | |
Called 4 times | |
Total time: 10.940986 | |
Self time: 0.007471 | |
count total (s) self (s) | |
4 0.001745 0.000076 let gita = s:get_gita() | |
4 0.000146 let options = extend(b:_options, extend( get(g:, 'gita#interface#status#default_options', {}), get(a:000, 0, {}))) | |
4 0.345167 0.000267 let result = gita.git.get_parsed_status( extend({ 'no_cache': 1 }, options),) | |
4 0.000043 if get(result, 'status', 0) | |
redraw | call gita#util#error( result.stdout, printf('Fail: %s', join(result.args)),) | |
return | |
endif | |
" create statuses lines & map | |
4 0.000033 let statuses_map = {} | |
4 0.000034 let statuses_lines = [] | |
148 0.000632 for status in result.all | |
144 0.001983 call add(statuses_lines, status.record) | |
144 0.001700 let statuses_map[status.record] = status | |
144 0.000458 endfor | |
4 0.000346 let gita.interface.status.statuses_map = statuses_map | |
" create buffer lines | |
4 10.586548 0.000490 let buflines = s:List.flatten([ ['# Press ?m and/or ?s to toggle a help of mapping and/or short format.'], s:get_help('status_mapping'), s:get_help('short_format'), gita#util#interface_get_misc_lines(), statuses_lines, empty(statuses_map) ? ['Nothing to commit (Working tree is clean).'] : [],]) | |
" update content | |
4 0.000065 setlocal modifiable | |
4 0.000963 0.000074 call gita#util#buffer_update(buflines) | |
4 0.000023 setlocal nomodifiable | |
FUNCTION <SNR>101_action_checkout() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let statuses = s:ensure_list(a:statuses) | |
let options = extend({}, a:options) | |
if !has_key(options, 'commit') | |
let commit = gita#util#ask('Checkout from: ', 'INDEX') | |
if strlen(commit) == 0 | |
redraw || call gita#util#warn('No valid commit was selected. The operation is canceled.') | |
return | |
endif | |
else | |
let commit = options.commit | |
endif | |
let commit = commit ==# 'INDEX' ? '' : commit | |
let valid_statuses = [] | |
for status in statuses | |
if s:validate_status_checkout(status, options) | |
continue | |
endif | |
call add(valid_statuses, status) | |
endfor | |
if empty(valid_statuses) | |
if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( 'No valid files were selected for checkout action',) | |
endif | |
return | |
endif | |
let result = s:get_gita().git.checkout(options, commit, map(valid_statuses, 'v:val.path')) | |
if result.status == 0 | |
call gita#util#doautocmd('checkout-post') | |
else | |
call gita#util#error( result.stdout, printf('Fail: %s', join(result.args)),) | |
endif | |
call s:update() | |
FUNCTION <SNR>83_and() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:all('v:val', a:xs) | |
FUNCTION airline#parts#paste() | |
Called 12 times | |
Total time: 0.000229 | |
Self time: 0.000229 | |
count total (s) self (s) | |
12 0.000172 return g:airline_detect_paste && &paste ? g:airline_symbols.paste : '' | |
FUNCTION <SNR>86_min_by() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if empty(a:dict) | |
throw 'vital: Data.Dict: Empty dictionary' | |
endif | |
return s:_max_by(a:dict, '-(' . a:expr . ')') | |
FUNCTION <SNR>83_any() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return !empty(filter(map(copy(a:xs), a:f), 'v:val')) | |
FUNCTION <SNR>82_truncate() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
" 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 | |
FUNCTION <SNR>97_count_commits_ahead_of_remote() | |
Called 3 times | |
Total time: 0.120020 | |
Self time: 0.020296 | |
count total (s) self (s) | |
3 0.000030 let opts = get(a:000, 0, {}) | |
3 0.099834 0.000110 let result = s:Core.exec(['log', '--oneline', '@{upstream}..'], opts) | |
3 0.020130 return result.status == 0 ? len(split(result.stdout, '\v%(\r?\n)')) : 0 | |
FUNCTION 92() | |
Called 1 time | |
Total time: 0.146764 | |
Self time: 0.000239 | |
count total (s) self (s) | |
1 0.000024 0.000013 if s:B.is_cmdwin() | |
" Note: Failed to open buffer in cmdline window. | |
return { 'loaded': 0, 'newwin': -1, 'newbuf': 0, 'bufnr': -1, } | |
endif | |
1 0.000009 let lastbuf = bufnr('$') | |
1 0.000332 0.000017 let config = s:_make_config(self, a:000) | |
1 0.000957 0.000017 let moved = self.move(config.range) | |
1 0.000008 let Opener = moved ? 'edit' : config.opener | |
1 0.000032 0.000019 while s:P.is_string(Opener) && Opener[0] ==# '=' | |
let Opener = eval(Opener[1 :]) | |
endwhile | |
1 0.145267 0.000022 let loaded = s:B.open(a:bufname, Opener) | |
1 0.000052 let new_bufnr = bufnr('%') | |
1 0.000014 let self._bufnrs[new_bufnr] = a:bufname | |
1 0.000019 return { 'loaded': loaded, 'newwin': moved, 'newbuf': lastbuf < bufnr('%'), 'bufnr': new_bufnr, } | |
FUNCTION <SNR>82_globpath() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let R = globpath(a:path, a:expr, 1) | |
return split(R, '\n') | |
FUNCTION gita#util#invoker_set() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let bufname = get(a:000, 0, '%') | |
call setbufvar(bufname, '_invoker', a:invoker) | |
FUNCTION gita#Gita() | |
Called 1 time | |
Total time: 3.087815 | |
Self time: 0.000092 | |
count total (s) self (s) | |
1 0.000009 if empty(a:opts) | |
" validation failed | |
return | |
elseif !gita#get().enabled | |
call gita#util#warn( 'No git working directory is found on a current buffer',) | |
return | |
endif | |
1 0.000010 let name = get(a:opts, '__name__', '') | |
1 0.000005 if !a:opts.__bang__ | |
1 0.000005 if name ==# 'status' | |
1 3.083889 0.000022 return s:GitaStatus(a:opts) | |
elseif name ==# 'commit' | |
return s:GitaCommit(a:opts) | |
elseif name ==# 'diff' | |
return s:GitaDiff(a:opts) | |
elseif name ==# 'browse' | |
return s:GitaBrowse(a:opts) | |
endif | |
endif | |
return s:GitaDefault(a:opts) | |
FUNCTION <SNR>92_hash() | |
Called 288 times | |
Total time: 0.056638 | |
Self time: 0.032991 | |
count total (s) self (s) | |
288 0.010065 0.005910 let str = s:Prelude.is_string(a:obj) ? a:obj : string(a:obj) | |
288 0.002380 if strlen(str) < 150 | |
" hash might be a filename thus. | |
284 0.001908 let hash = str | |
284 0.004801 let hash = substitute(hash, ':', '=-', 'g') | |
284 0.007306 let hash = substitute(hash, '[/\\]', '=+', 'g') | |
284 0.001114 else | |
4 0.019581 0.000090 let hash = s:String.hash(str) | |
4 0.000019 endif | |
288 0.001542 return hash | |
FUNCTION <SNR>98_is_staged() | |
Called 144 times | |
Total time: 0.004106 | |
Self time: 0.004106 | |
count total (s) self (s) | |
144 0.003584 return a:sign =~# s:const.staged_pattern | |
FUNCTION <SNR>102_strip_conflict() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let buflines = s:P.is_list(a:buflines) ? join(a:buflines, "\n") : a:buflines | |
let region_pattern = printf('%s.{-}%s', s:const.patterns.ours, s:const.patterns.theirs,) | |
let buflines = substitute(buflines, '\v' . region_pattern . '\n?', '', 'g') | |
return get(a:000, 0, s:P.is_list(a:buflines)) ? split(buflines, '\v\r?\n') : buflines | |
FUNCTION <SNR>83_max_by() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if empty(a:list) | |
return 0 | |
endif | |
let list = map(copy(a:list), a:expr) | |
return a:list[index(list, max(list))] | |
FUNCTION <SNR>99_parse() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let obj = {} | |
for line in split(a:config, '\v%(\r?\n)+') | |
let obj = s:_extend_nested_dict(obj, s:parse_record(line)) | |
endfor | |
return obj | |
FUNCTION <SNR>91__vital_loaded() | |
Called 1 time | |
Total time: 0.006829 | |
Self time: 0.000023 | |
count total (s) self (s) | |
1 0.006825 0.000019 let s:Base = a:V.import('System.Cache.Base') | |
FUNCTION airline#parts#readonly() | |
Called 16 times | |
Total time: 0.000233 | |
Self time: 0.000233 | |
count total (s) self (s) | |
16 0.000164 return &readonly ? g:airline_symbols.readonly : '' | |
FUNCTION <SNR>93_nr2byte() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if a:nr < 0x80 | |
return nr2char(a:nr) | |
elseif a:nr < 0x800 | |
return nr2char(a:nr/64+192).nr2char(a:nr%64+128) | |
else | |
return nr2char(a:nr/4096%16+224).nr2char(a:nr/64%64+128).nr2char(a:nr%64+128) | |
endif | |
FUNCTION <SNR>103_is_cmdwin() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
call s:_deprecated("is_cmdwin") | |
return s:B.is_cmdwin() | |
FUNCTION <SNR>82_input_safe() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:input_helper('input', a:000) | |
FUNCTION gita#util#import() | |
Called 14 times | |
Total time: 0.826721 | |
Self time: 0.001207 | |
count total (s) self (s) | |
14 0.000383 let cache_name = printf('_vital_module_%s', substitute(a:name, '\.', '_', 'g')) | |
14 0.000135 if !has_key(s:, cache_name) | |
9 0.825869 0.000354 let s:[cache_name] = s:get_vital().import(a:name) | |
9 0.000032 endif | |
14 0.000098 return s:[cache_name] | |
FUNCTION airline#highlighter#exec() | |
Called 84 times | |
Total time: 0.010119 | |
Self time: 0.010119 | |
count total (s) self (s) | |
84 0.000579 let colors = a:colors | |
84 0.000417 if s:is_win32term | |
let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, '')) | |
let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, '')) | |
endif | |
84 0.006572 exec printf('hi %s %s %s %s %s %s %s %s', a:group, get(colors, 0, '') != '' ? 'guifg='.colors[0] : '', get(colors, 1, '') != '' ? 'guibg='.colors[1] : '', get(colors, 2, '') != '' ? 'ctermfg='.colors[2] : '', get(colors, 3, '') != '' ? 'ctermbg='.colors[3] : '', get(colors, 4, '') != '' ? 'gui='.colors[4] : '', get(colors, 4, '') != '' ? 'cterm='.colors[4] : '', get(colors, 4, '') != '' ? 'term='.colors[4] : '') | |
FUNCTION <SNR>95_system() | |
Called 12 times | |
Total time: 0.384651 | |
Self time: 0.380418 | |
count total (s) self (s) | |
" Process optional arguments at first | |
" because use_vimproc is required later | |
" for a:str argument. | |
12 0.000087 let input = '' | |
12 0.001881 0.000206 let use_vimproc = s:has_vimproc() | |
12 0.000082 let background = 0 | |
12 0.000076 let args = [] | |
12 0.000067 if a:0 ==# 1 | |
" {command} [, {dict}] | |
" a:1 = {dict} | |
12 0.000114 if type(a:1) is s:TYPE_DICT | |
12 0.000109 if has_key(a:1, 'use_vimproc') | |
let use_vimproc = a:1.use_vimproc | |
endif | |
12 0.000098 if has_key(a:1, 'input') | |
let args += [s:iconv(a:1.input, &encoding, 'char')] | |
endif | |
12 0.000100 if use_vimproc && has_key(a:1, 'timeout') | |
" ignores timeout unless you have vimproc. | |
let args += [a:1.timeout] | |
endif | |
12 0.000102 if has_key(a:1, 'background') | |
let background = a:1.background | |
endif | |
12 0.000084 elseif type(a:1) is s:TYPE_STRING | |
let args += [s:iconv(a:1, &encoding, 'char')] | |
else | |
throw 'Process.system(): invalid argument (value type:'.type(a:1).')' | |
endif | |
12 0.000059 elseif a:0 >= 2 | |
" {command} [, {input} [, {timeout}]] | |
" a:000 = [{input} [, {timeout}]] | |
let [input; rest] = a:000 | |
let input = s:iconv(input, &encoding, 'char') | |
let args += [input] + rest | |
endif | |
" Process a:str argument. | |
12 0.000115 if type(a:str) is s:TYPE_LIST | |
12 0.000129 let expr = use_vimproc ? '"''" . v:val . "''"' : 's:shellescape(v:val)' | |
12 0.002713 0.001471 let command = join(map(copy(a:str), expr), ' ') | |
12 0.000095 elseif type(a:str) is s:TYPE_STRING | |
let command = a:str | |
else | |
throw 'Process.system(): invalid argument (value type:'.type(a:str).')' | |
endif | |
12 0.000069 if s:need_trans | |
let command = s:iconv(command, &encoding, 'char') | |
endif | |
12 0.000133 let args = [command] + args | |
12 0.000091 if background && (use_vimproc || !s:is_windows) | |
let args[0] = args[0] . ' &' | |
endif | |
12 0.000118 let funcname = use_vimproc ? 'vimproc#system' : 'system' | |
12 0.373247 let output = call(funcname, args) | |
12 0.002345 0.001029 let output = s:iconv(output, 'char', &encoding) | |
12 0.000108 return output | |
FUNCTION <SNR>59_get_syn() | |
Called 200 times | |
Total time: 0.024887 | |
Self time: 0.024887 | |
count total (s) self (s) | |
" need to pass in mode, known to break on 7.3.547 | |
200 0.003285 let mode = has('gui_running') || (has("termtruecolor") && &guicolors == 1) ? 'gui' : 'cterm' | |
200 0.005021 let color = synIDattr(synIDtrans(hlID(a:group)), a:what, mode) | |
200 0.001419 if empty(color) || color == -1 | |
146 0.003313 let color = synIDattr(synIDtrans(hlID('Normal')), a:what, mode) | |
146 0.000469 endif | |
200 0.001489 if empty(color) || color == -1 | |
if has('gui_running') || (has("termtruecolor") && &guicolors == 1) | |
let color = a:what ==# 'fg' ? '#000000' : '#FFFFFF' | |
else | |
let color = a:what ==# 'fg' ? 0 : 1 | |
endif | |
endif | |
200 0.000886 return color | |
FUNCTION gita#util#invoker_get_winnum() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let invoker = call('gita#util#invoker_get', a:000) | |
let bufnum = invoker.bufnum | |
let winnum = bufwinnr(bufnum) | |
if winnum == -1 | |
let winnum = invoker.winnum | |
endif | |
return winnum | |
FUNCTION <SNR>93_levenshtein_distance() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let letters1 = split(a:str1, '\zs') | |
let letters2 = split(a:str2, '\zs') | |
let length1 = len(letters1) | |
let length2 = len(letters2) | |
let distances = map(range(1, length1 + 1), 'map(range(1, length2 + 1), "0")') | |
for i1 in range(0, length1) | |
let distances[i1][0] = i1 | |
endfor | |
for i2 in range(0, length2) | |
let distances[0][i2] = i2 | |
endfor | |
for i1 in range(1, length1) | |
for i2 in range(1, length2) | |
let cost = (letters1[i1 - 1] ==# letters2[i2 - 1]) ? 0 : 1 | |
let distances[i1][i2] = min([ distances[i1 - 1][i2 ] + 1, distances[i1 ][i2 - 1] + 1, distances[i1 - 1][i2 - 1] + cost,]) | |
endfor | |
endfor | |
return distances[length1][length2] | |
FUNCTION <SNR>83_foldr1() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if len(a:xs) == 0 | |
throw 'foldr1' | |
endif | |
return s:foldr(a:f, a:xs[-1], a:xs[0:-2]) | |
FUNCTION <SNR>83_group_by() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION <SNR>83_partition() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return [filter(copy(a:xs), a:f), filter(copy(a:xs), '!(' . a:f . ')')] | |
FUNCTION <SNR>94_get_relative_path() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if !s:Path.is_absolute(a:path) | |
return a:path | |
endif | |
let prefix = a:worktree . s:Path.separator() | |
return substitute(a:path, prefix, '', '') | |
FUNCTION <SNR>103__make_config() | |
Called 3 times | |
Total time: 0.000933 | |
Self time: 0.000580 | |
count total (s) self (s) | |
3 0.000027 let configs = [a:manager._config] | |
3 0.000021 let user = a:manager._user_config | |
3 0.000074 0.000037 if s:P.is_string(user) | |
let configs += [exists(user) ? {user} : {}] | |
elseif s:P.is_dict(user) | |
3 0.000053 let configs += [map(copy(user), 'exists(v:val) ? {v:val} : {}')] | |
3 0.000010 endif | |
3 0.000016 let config = {} | |
12 0.000054 for c in configs + a:configs | |
9 0.000432 0.000150 call extend(config, s:_config(c)) | |
9 0.000026 endfor | |
3 0.000012 return config | |
FUNCTION <SNR>81__get_module_path() | |
Called 91 times | |
Total time: 0.086171 | |
Self time: 0.017408 | |
count total (s) self (s) | |
91 0.002523 0.001471 if s:_is_absolute_path(a:name) && filereadable(a:name) | |
return a:name | |
endif | |
91 0.000467 if a:name ==# '' | |
14 0.000118 let paths = [s:self_file] | |
14 0.000075 elseif a:name =~# '\v^\u\w*%(\.\u\w*)*$' | |
77 0.068975 0.001264 let paths = s:_vital_files(a:name) | |
77 0.000298 else | |
throw 'vital: Invalid module name: ' . a:name | |
endif | |
91 0.006402 call filter(paths, 'filereadable(expand(v:val, 1))') | |
91 0.000982 let path = get(paths, 0, '') | |
91 0.000627 return path !=# '' ? path : '' | |
FUNCTION <SNR>82_getchar_safe() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let c = s:input_helper('getchar', a:000) | |
return type(c) == type("") ? c : nr2char(c) | |
FUNCTION <SNR>101_validate_status_theirs() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if !a:status.is_conflicted | |
call gita#util#info(printf( 'No theirs version of a non conflicted file "%s" is available. Use <Plug>(gita-action-checkout) instead.', a:status.path,)) | |
return 1 | |
else | |
if a:status.sign ==# 'DD' | |
call gita#util#info(printf( 'No theirs version of a both deleted conflict file "%s" is available. Use <Plug>(gita-action-rm) instead.', a:status.path,)) | |
return 1 | |
elseif a:status.sign ==# 'UD' | |
call gita#util#info(printf( 'No theirs version of a deleted by them conflict file "%s" is available. Use <Plug>(gita-action-add) or <Plug>(gita-action-rm) instead.', a:status.path,)) | |
return 1 | |
else | |
return 0 | |
endif | |
endif | |
FUNCTION <SNR>81__get_functions() | |
Called 21 times | |
Total time: 0.045468 | |
Self time: 0.009458 | |
count total (s) self (s) | |
21 0.036828 0.000818 let funcs = s:_redir(printf("function /\\%%#=2^\<SNR>%d_", a:sid)) | |
21 0.000227 let map_pat = '<SNR>' . a:sid . '_\zs\w\+' | |
21 0.008267 return map(split(funcs, "\n"), 'matchstr(v:val, map_pat)') | |
FUNCTION <SNR>84_join() | |
Called 280 times | |
Total time: 0.059049 | |
Self time: 0.040382 | |
count total (s) self (s) | |
280 0.012124 0.004292 let sep = s:separator() | |
280 0.001926 let path = '' | |
733 0.003844 for part in a:000 | |
453 0.008495 let path .= sep . (type(part) is type([]) ? call('s:join', part) : part) | |
453 0.001829 unlet part | |
453 0.001474 endfor | |
280 0.008173 return substitute(path[1 :], s:path_sep_pattern, sep, 'g') | |
FUNCTION <SNR>81_load() | |
Called 12 times | |
Total time: 0.809102 | |
Self time: 0.353921 | |
count total (s) self (s) | |
44 0.000214 for arg in a:000 | |
32 0.000512 let [name; as] = type(arg) == type([]) ? arg[: 1] : [arg, arg] | |
32 0.000777 let target = split(join(as, ''), '\W\+') | |
32 0.000169 let dict = self | |
96 0.000561 while 1 <= len(target) | |
64 0.000656 let ns = remove(target, 0) | |
64 0.000426 if !has_key(dict, ns) | |
55 0.000364 let dict[ns] = {} | |
55 0.000136 endif | |
64 0.000579 if type(dict[ns]) == type({}) | |
64 0.000405 let dict = dict[ns] | |
64 0.000158 else | |
unlet dict | |
break | |
endif | |
64 0.000204 endwhile | |
32 0.000209 if exists('dict') | |
32 0.382800 0.194901 call extend(dict, s:_import(name)) | |
32 0.000094 endif | |
32 0.000145 unlet arg | |
32 0.000104 endfor | |
12 0.000056 return self | |
FUNCTION <SNR>82__warn_deprecated() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
try | |
echohl Error | |
echomsg "Prelude." . a:name . " is deprecated! Please use " . a:alternative . " instead." | |
finally | |
echohl None | |
endtry | |
FUNCTION 10() | |
Called 2 times | |
Total time: 0.000074 | |
Self time: 0.000074 | |
count total (s) self (s) | |
2 0.000013 let opts = a:opts | |
2 0.000016 if has_key(self.hooks, a:name) | |
let opts = call(self.hooks[a:name], [opts], self) | |
endif | |
2 0.000009 return opts | |
FUNCTION <SNR>93_trim() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return matchstr(a:str,'^\s*\zs.\{-}\ze\s*$') | |
FUNCTION neomake#CursorMoved() | |
Called 7 times | |
Total time: 0.001651 | |
Self time: 0.000367 | |
count total (s) self (s) | |
7 0.000643 0.000167 call neomake#signs#PlaceVisibleSigns() | |
7 0.000954 0.000146 call neomake#EchoCurrentError() | |
FUNCTION <SNR>94_get_remote_fetch() | |
Called 4 times | |
Total time: 0.000226 | |
Self time: 0.000226 | |
count total (s) self (s) | |
" a url of {remote} | |
4 0.000086 let section = get(a:config, printf('remote "%s"', a:remote), {}) | |
4 0.000031 if empty(section) | |
return '' | |
endif | |
4 0.000039 return get(section, 'fetch', '') | |
FUNCTION <SNR>83_map_accum() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION <SNR>83_combinations() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION neomake#EchoCurrentError() | |
Called 7 times | |
Total time: 0.000808 | |
Self time: 0.000808 | |
count total (s) self (s) | |
7 0.000111 if !get(g:, 'neomake_echo_current_error', 1) | |
return | |
endif | |
7 0.000134 if !empty(get(s:, 'neomake_last_echoed_error', {})) | |
unlet s:neomake_last_echoed_error | |
echon '' | |
endif | |
7 0.000108 let errors = get(s:, 'current_errors', {}) | |
7 0.000065 if empty(errors) | |
7 0.000059 return | |
endif | |
let buf = bufnr('%') | |
let buf_errors = get(errors, buf, {}) | |
let ln = line('.') | |
let ln_errors = get(buf_errors, ln, []) | |
if empty(ln_errors) | |
return | |
endif | |
let s:neomake_last_echoed_error = ln_errors[0] | |
for error in ln_errors | |
if error.type ==# 'E' | |
let s:neomake_last_echoed_error = error | |
break | |
endif | |
endfor | |
call neomake#utils#WideMessage(s:neomake_last_echoed_error.text) | |
FUNCTION airline#parts#mode() | |
Called 12 times | |
Total time: 0.000242 | |
Self time: 0.000242 | |
count total (s) self (s) | |
12 0.000192 return get(w:, 'airline_current_mode', '') | |
FUNCTION neomake#signs#PlaceVisibleSigns() | |
Called 8 times | |
Total time: 0.000505 | |
Self time: 0.000505 | |
count total (s) self (s) | |
8 0.000216 let buf = bufnr('%') | |
8 0.000153 if !has_key(s:sign_queue, buf) | |
8 0.000052 return | |
endif | |
let topline = line('w0') | |
let botline = line('w$') | |
for ln in range(topline, botline) | |
if has_key(s:sign_queue[buf], ln) | |
call neomake#signs#PlaceSign(s:sign_queue[buf][ln]) | |
unlet s:sign_queue[buf][ln] | |
endif | |
endfor | |
if empty(s:sign_queue[buf]) | |
unlet s:sign_queue[buf] | |
endif | |
FUNCTION <SNR>90__get_finder() | |
Called 1 time | |
Total time: 0.000400 | |
Self time: 0.000052 | |
count total (s) self (s) | |
1 0.000009 if !exists('s:finder') | |
1 0.000374 0.000026 let s:finder = s:Finder.new(s:_get_finder_cache()) | |
1 0.000003 endif | |
1 0.000004 return s:finder | |
FUNCTION <SNR>84_dirname() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let path = a:path | |
let orig = a:path | |
let path = s:remove_last_separator(path) | |
if path == '' | |
return orig " root directory | |
endif | |
let path = fnamemodify(path, ':h') | |
return path | |
FUNCTION gita#set() | |
Called 1 time | |
Total time: 0.000094 | |
Self time: 0.000094 | |
count total (s) self (s) | |
1 0.000013 let bufname = get(a:000, 0, bufname('%')) | |
1 0.000025 if bufexists(bufname) | |
1 0.000026 let bufnum = bufnr(bufname) | |
1 0.000019 call setbufvar(bufnum, '_gita', a:gita) | |
1 0.000003 endif | |
FUNCTION <SNR>81_exists() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:_get_module_path(a:name) !=# '' | |
FUNCTION <SNR>82__path2project_directory_git() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION <SNR>103__vital_depends() | |
Called 1 time | |
Total time: 0.000010 | |
Self time: 0.000010 | |
count total (s) self (s) | |
1 0.000007 return ['Prelude', 'Vim.Buffer'] | |
FUNCTION <SNR>85_splitargs() | |
Called 1 time | |
Total time: 0.000116 | |
Self time: 0.000116 | |
count total (s) self (s) | |
1 0.000008 let single_quote = '\v''\zs[^'']+\ze''' | |
1 0.000007 let double_quote = '\v"\zs[^"]+\ze"' | |
1 0.000007 let bare_strings = '\v[^ \t''"]+' | |
1 0.000015 let pattern = printf('\v%%(%s|%s|%s)', single_quote, double_quote, bare_strings,) | |
1 0.000071 return split(a:str, printf('\v%s*\zs%%(\s+|$)\ze', pattern)) | |
FUNCTION <SNR>83_has_index() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
" 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) | |
FUNCTION <SNR>82_set_default() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if !exists(a:var) || type({a:var}) != type(a:val) | |
let {a:var} = a:val | |
endif | |
FUNCTION <SNR>68_showErrWarning() | |
Called 12 times | |
Total time: 0.001163 | |
Self time: 0.001163 | |
count total (s) self (s) | |
12 0.000163 let w = get(a:counts, 'W', 0) | |
12 0.000136 let e = get(a:counts, 'E', 0) | |
12 0.000074 if w || e | |
let result = a:prefix | |
if e | |
let result .= 'E:'.e | |
endif | |
if w | |
let result .= 'W:'.w | |
endif | |
return result | |
else | |
12 0.000056 return '' | |
endif | |
FUNCTION <SNR>102_has_conflict_marker() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let buflines = s:P.is_list(a:buflines) ? join(a:buflines, "\n") : a:buflines | |
let ours_or_theirs = printf('%%(%s|%s)', s:const.patterns.ours, s:const.patterns.theirs,) | |
return !empty(matchstr(buflines, '\v' . ours_or_theirs)) | |
FUNCTION <SNR>103_new() | |
Called 1 time | |
Total time: 0.000169 | |
Self time: 0.000056 | |
count total (s) self (s) | |
1 0.000164 0.000051 return deepcopy(s:Manager).config(a:0 ? s:_config(a:1) : {}).user_config(2 <= a:0 ? a:2 : {}) | |
FUNCTION <SNR>101_validate_filetype() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if &filetype !=# s:const.filetype | |
call gita#util#error( printf('%s required to be called on %s buffer', a:name, s:const.bufname), 'FileType miss match',) | |
return 1 | |
endif | |
return 0 | |
FUNCTION <SNR>83_product() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION <SNR>83_has() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return index(a:list, a:value) isnot -1 | |
FUNCTION <SNR>82_smart_execute_command() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
execute a:action . ' ' . (a:word == '' ? '' : '`=a:word`') | |
FUNCTION <SNR>83_unshift() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return insert(a:list, a:val) | |
FUNCTION gita#util#invoker_get() | |
Called 1 time | |
Total time: 0.000074 | |
Self time: 0.000074 | |
count total (s) self (s) | |
1 0.000009 let bufname = get(a:000, 0, '%') | |
1 0.000011 let invoker = getbufvar(bufname, '_invoker', {}) | |
1 0.000006 if empty(invoker) | |
1 0.000009 let bufnum = bufnr(bufname) | |
1 0.000008 let winnum = bufwinnr(bufnum) | |
1 0.000010 let invoker = { 'bufnum': bufnum, 'winnum': winnum,} | |
1 0.000003 endif | |
1 0.000004 return invoker | |
FUNCTION <SNR>81__concat() | |
Called 12 times | |
Total time: 0.000886 | |
Self time: 0.000886 | |
count total (s) self (s) | |
12 0.000085 let result_list = [] | |
44 0.000170 for list in a:lists | |
32 0.000208 let result_list += list | |
32 0.000087 endfor | |
12 0.000055 return result_list | |
FUNCTION <SNR>79_to_string() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if gita#util#is_string(a:value) | |
return a:value | |
elseif gita#util#is_numeric(a:value) | |
return a:value ? string(a:value) : '' | |
elseif gita#util#is_list(a:value) || gita#util#is_dict(a:value) | |
return empty(a:value) ? string(a:value) : '' | |
else | |
return string(a:value) | |
endif | |
FUNCTION <SNR>103_open() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
call s:_deprecated("open") | |
return s:B.open(a:buffer, a:opener) | |
FUNCTION <SNR>83_uniq_by() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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]') | |
FUNCTION <SNR>76_Doxygen_Hilights() | |
Called 1 time | |
Total time: 0.000704 | |
Self time: 0.000704 | |
count total (s) self (s) | |
" Pick a sensible default for 'codeword'. | |
1 0.000006 let font='' | |
1 0.000010 if exists('g:doxygen_codeword_font') | |
if g:doxygen_codeword_font !~ '\<\k\+=' | |
let font='font='.g:doxygen_codeword_font | |
else | |
let font=g:doxygen_codeword_font | |
endif | |
else | |
" Try and pick a font (only some platforms have been tested). | |
1 0.000012 if has('gui_running') | |
1 0.000011 if has('gui_gtk2') | |
if &guifont == '' | |
let font="font='FreeSerif 12'" | |
else | |
let font="font='".substitute(&guifont, '^.\{-}\([0-9]\+\)$', 'FreeSerif \1','')."'" | |
endif | |
elseif has('gui_win32') || has('gui_win16') || has('gui_win95') | |
if exists('g:doxygen_use_bitsream_vera') && g:doxygen_use_bitsream_vera | |
let font_base='Bitstream_Vera_Sans_Mono' | |
else | |
let font_base='Lucida_Console' | |
endif | |
if &guifont == '' | |
let font='font='.font_base.':h10' | |
else | |
let font='font='.matchstr(substitute(&guifont, '^[^:]*', font_base,''),'[^,]*') | |
endif | |
elseif has('gui_athena') || has('gui_gtk') || &guifont=~'^\(-[^-]\+\)\{14}' | |
if &guifont == '' | |
let font='font=-b&h-lucidatypewriter-medium-r-normal-*-*-140-*-*-m-*-iso8859-1' | |
else | |
" let font='font='.substitute(&guifont,'^\(-[^-]\+\)\{7}-\([0-9]\+\).*', '-b\&h-lucidatypewriter-medium-r-normal-*-*-\2-*-*-m-*-iso8859-1','') | |
" The above line works, but it is hard to expect the combination of | |
" the two fonts will look good. | |
endif | |
elseif has('gui_kde') | |
" let font='font=Bitstream\ Vera\ Sans\ Mono/12/-1/5/50/0/0/0/0/0' | |
endif | |
1 0.000003 endif | |
1 0.000003 endif | |
1 0.000011 if font=='' | let font='gui=bold' | endif | |
1 0.000030 exe 'SynColor doxygenCodeWord term=bold cterm=bold '.font | |
1 0.000019 if (exists('g:doxygen_enhanced_color') && g:doxygen_enhanced_color) || (exists('g:doxygen_enhanced_colour') && g:doxygen_enhanced_colour) | |
if &background=='light' | |
SynColor doxygenComment ctermfg=DarkRed guifg=DarkRed | |
SynColor doxygenBrief cterm=bold ctermfg=Cyan guifg=DarkBlue gui=bold | |
SynColor doxygenBody ctermfg=DarkBlue guifg=DarkBlue | |
SynColor doxygenSpecialTypeOnelineDesc cterm=bold ctermfg=DarkRed guifg=firebrick3 gui=bold | |
SynColor doxygenBOther cterm=bold ctermfg=DarkMagenta guifg=#aa50aa gui=bold | |
SynColor doxygenParam ctermfg=DarkGray guifg=#aa50aa | |
SynColor doxygenParamName cterm=italic ctermfg=DarkBlue guifg=DeepSkyBlue4 gui=italic,bold | |
SynColor doxygenSpecialOnelineDesc cterm=bold ctermfg=DarkCyan guifg=DodgerBlue3 gui=bold | |
SynColor doxygenSpecialHeading cterm=bold ctermfg=DarkBlue guifg=DeepSkyBlue4 gui=bold | |
SynColor doxygenPrev ctermfg=DarkGreen guifg=DarkGreen | |
else | |
SynColor doxygenComment ctermfg=LightRed guifg=LightRed | |
SynColor doxygenBrief cterm=bold ctermfg=Cyan ctermbg=darkgrey guifg=LightBlue gui=Bold,Italic | |
SynColor doxygenBody ctermfg=Cyan guifg=LightBlue | |
SynColor doxygenSpecialTypeOnelineDesc cterm=bold ctermfg=Red guifg=firebrick3 gui=bold | |
SynColor doxygenBOther cterm=bold ctermfg=Magenta guifg=#aa50aa gui=bold | |
SynColor doxygenParam ctermfg=LightGray guifg=LightGray | |
SynColor doxygenParamName cterm=italic ctermfg=LightBlue guifg=LightBlue gui=italic,bold | |
SynColor doxygenSpecialOnelineDesc cterm=bold ctermfg=LightCyan guifg=LightCyan gui=bold | |
SynColor doxygenSpecialHeading cterm=bold ctermfg=LightBlue guifg=LightBlue gui=bold | |
SynColor doxygenPrev ctermfg=LightGreen guifg=LightGreen | |
endif | |
else | |
1 0.000024 SynLink doxygenComment SpecialComment | |
1 0.000023 SynLink doxygenBrief Statement | |
1 0.000023 SynLink doxygenBody Comment | |
1 0.000022 SynLink doxygenSpecialTypeOnelineDesc Statement | |
1 0.000022 SynLink doxygenBOther Constant | |
1 0.000021 SynLink doxygenParam SpecialComment | |
1 0.000021 SynLink doxygenParamName Underlined | |
1 0.000022 SynLink doxygenSpecialOnelineDesc Statement | |
1 0.000021 SynLink doxygenSpecialHeading Statement | |
1 0.000022 SynLink doxygenPrev SpecialComment | |
1 0.000003 endif | |
FUNCTION <SNR>83_zip() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return map(range(min(map(copy(a:000), 'len(v:val)'))), "map(copy(a:000), 'v:val['.v:val.']')") | |
FUNCTION <SNR>81__redir() | |
Called 132 times | |
Total time: 0.332595 | |
Self time: 0.332595 | |
count total (s) self (s) | |
132 0.001854 let [save_verbose, save_verbosefile] = [&verbose, &verbosefile] | |
132 0.001874 set verbose=0 verbosefile= | |
132 0.001059 redir => res | |
132 0.321269 silent! execute a:cmd | |
132 0.001673 redir END | |
132 0.002241 let [&verbose, &verbosefile] = [save_verbose, save_verbosefile] | |
132 0.000923 return res | |
FUNCTION <SNR>97_get_parsed_commit() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let defs = { 'all': 0, 'patch': 0, 'reuse_message': '=', 'reedit_message': '=', 'fixup': '=', 'squash': '=', 'reset_author': 0, 'short': 0, 'z': 0, 'file': '=', 'author': '=', 'date': '=', 'message': '=', 'template': '=', 'signoff': 0, 'no_verify': 0, 'allow_empty': 0, 'allow_empty_message': 0, 'cleanup': '=default', 'edit': 0, 'amend': 0, 'include': 0, 'only': 0, 'untracked_files': '=all', 'verbose': 0, 'quiet': 0, 'status': 0,} | |
let opts = get(a:000, 0, {}) | |
let args = ['commit', '--dry-run', '--porcelain', '--no-status'] + s:opts2args(opts, defs) | |
let result = s:Core.exec(args, s:Dict.omit(opts, keys(defs))) | |
" Note: | |
" I'm not sure but apparently the exit status is 1 | |
if result.status != 1 | |
return result | |
endif | |
return s:StatusParser.parse(result.stdout, { 'fail_silently': 1 }) | |
FUNCTION <SNR>93_split_leftright() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let [left, _, right] = s:split3(a:expr, a:pattern) | |
return [left, right] | |
FUNCTION <SNR>101_action_solve2() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let options = extend({ 'opener': 'edit',}, a:options) | |
if s:validate_status_conflict(a:status, options) | |
return | |
endif | |
call gita#util#invoker_focus() | |
call gita#interface#conflict#open2(a:status, options) | |
FUNCTION <SNR>79_get_vital() | |
Called 9 times | |
Total time: 0.018113 | |
Self time: 0.000968 | |
count total (s) self (s) | |
9 0.000113 if !exists('s:_vital_module_Vital') | |
1 0.017788 0.000643 let s:_vital_module_Vital = vital#of('vim_gita') | |
1 0.000006 endif | |
9 0.000062 return s:_vital_module_Vital | |
FUNCTION neomake#statusline#LoclistStatus() | |
Called 12 times | |
Total time: 0.002559 | |
Self time: 0.000514 | |
count total (s) self (s) | |
12 0.002505 0.000461 return s:showErrWarning(neomake#statusline#LoclistCounts(), a:0 ? a:1 : '') | |
FUNCTION <SNR>93_chop() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return substitute(a:str, '.$', '', '') | |
FUNCTION <SNR>64_get_section() | |
Called 52 times | |
Total time: 0.005800 | |
Self time: 0.005101 | |
count total (s) self (s) | |
52 0.000524 if has_key(s:section_truncate_width, a:key) | |
28 0.000293 if winwidth(a:winnr) < s:section_truncate_width[a:key] | |
return '' | |
endif | |
28 0.000082 endif | |
52 0.000379 let spc = g:airline_symbols.space | |
52 0.001856 0.001158 let text = airline#util#getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key}) | |
52 0.000981 let [prefix, suffix] = [get(a:000, 0, '%('.spc), get(a:000, 1, spc.'%)')] | |
52 0.000524 return empty(text) ? '' : prefix.text.suffix | |
FUNCTION <SNR>102_has_theirs_marker() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let buflines = s:P.is_list(a:buflines) ? join(a:buflines, "\n") : a:buflines | |
return !empty(matchstr(buflines, '\v' . s:const.patterns.theirs)) | |
FUNCTION <SNR>82_wcswidth() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
call s:_warn_deprecated("wcswidth", "Data.String.wcswidth") | |
return strwidth(a:str) | |
FUNCTION <SNR>9_DetectMoon() | |
Called 1 time | |
Total time: 0.000030 | |
Self time: 0.000030 | |
count total (s) self (s) | |
1 0.000016 if getline(1) =~ '^#!.*\<moon\>' | |
set filetype=moon | |
endif | |
FUNCTION gita#util#buffer_get_name() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let sep = has('unix') ? ':' : '#' | |
return join(['vim-gita'] + a:000 + [a:name], sep) | |
FUNCTION <SNR>83_clear() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if !empty(a:list) | |
unlet! a:list[0 : len(a:list) - 1] | |
endif | |
return a:list | |
FUNCTION airline#extensions#neomake#apply() | |
Called 4 times | |
Total time: 0.000146 | |
Self time: 0.000146 | |
count total (s) self (s) | |
4 0.000068 let w:airline_section_warning = get(w:, 'airline_section_warning', g:airline_section_warning) | |
4 0.000057 let w:airline_section_warning .= s:spc.'%{neomake#statusline#LoclistStatus()}' | |
FUNCTION <SNR>94_get_absolute_path() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if !s:Path.is_relative(a:path) | |
return a:path | |
endif | |
return s:Path.join([a:worktree, a:path]) | |
FUNCTION <SNR>83_has_common_items() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return !empty(filter(copy(a:list1), 'index(a:list2, v:val) isnot -1')) | |
FUNCTION <SNR>94_get_head() | |
Called 1 time | |
Total time: 0.000396 | |
Self time: 0.000057 | |
count total (s) self (s) | |
" The current ref that you’re looking at. | |
1 0.000205 0.000027 let filename = s:Path.join(a:repository, 'HEAD') | |
1 0.000180 0.000020 return s:_readline(filename) | |
FUNCTION <SNR>83_zip_fill() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION <SNR>90_find() | |
Called 1 time | |
Total time: 0.003489 | |
Self time: 0.000088 | |
count total (s) self (s) | |
1 0.000011 let options = get(a:000, 0, {}) | |
1 0.000414 0.000014 let finder = s:_get_finder() | |
1 0.002191 0.000020 let found = finder.find(a:path, options) | |
1 0.000006 if empty(found) | |
return {} | |
endif | |
1 0.000851 0.000020 return s:new(found.worktree, found.repository, options) | |
FUNCTION gita#argument#complete() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let bang = a:cmdline =~# '\v^Gita!' | |
let cmdline = substitute(a:cmdline, '\v^Gita!?\s?', '', '') | |
let parser = s:get_parser() | |
let opts = parser.parse_cmdline(cmdline) | |
if bang || !has_key(opts, 'action') || opts.action !~# s:gita_command_names_pattern | |
let candidates = filter( copy(s:git_command_names), 'v:val =~# "^" . a:arglead',) | |
else | |
let parser = call(printf('gita#argument#%s#get_parser', opts.action), []) | |
let opts = parser.parse_args(opts.__unknown__, { '__name__': opts.action,}) | |
let candidates = call( parser.complete, [ a:arglead, join(opts.__unknown__), a:cursorpos, opts, ], parser) | |
endif | |
return candidates | |
FUNCTION 42() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return self.choices | |
FUNCTION <SNR>87__new_choice_completer() | |
Called 2 times | |
Total time: 0.000241 | |
Self time: 0.000132 | |
count total (s) self (s) | |
2 0.000036 let options = extend({ 'choices': [],}, get(a:000, 0, {})) | |
2 0.000137 0.000028 let completer = s:get_abstract_completer() | |
2 0.000013 function! completer.gather_candidates(arglead, cmdline, cursorpos, args) abort | |
return self.choices | |
endfunction | |
2 0.000022 return extend(completer, options) | |
FUNCTION gita#get() | |
Called 16 times | |
Total time: 0.010078 | |
Self time: 0.006495 | |
count total (s) self (s) | |
16 0.000381 let bufname = get(a:000, 0, bufname('%')) | |
16 0.000611 if bufexists(bufname) | |
16 0.002049 let bufnum = bufnr(bufname) | |
16 0.000323 let buftype = getbufvar(bufnum, '&buftype') | |
16 0.000372 let gita = getbufvar(bufnum, '_gita', deepcopy(s:gita)) | |
16 0.000355 if empty(get(gita, 'bufname', '')) || (empty(buftype) && bufname !=# gita.bufname) | |
1 0.000006 if empty(buftype) | |
1 0.003525 0.000037 let git = s:Git.find(fnamemodify(bufname, ':p')) | |
1 0.000022 let gita = extend(gita, { 'enabled': !empty(git), 'bufname': bufname, 'git': git,}) | |
1 0.000003 else | |
" Not a file, use a current directory | |
let git = s:Git.find(getcwd()) | |
let gita = extend(gita, { 'enabled': !empty(git), 'bufname': '', 'git': git,}) | |
endif | |
1 0.000110 0.000015 call gita#set(gita, bufname) | |
1 0.000003 endif | |
16 0.000069 else | |
let git = s:Git.find(fnamemodify(bufname, ':p')) | |
let gita = extend(deepcopy(s:gita), { 'enabled': !empty(git), 'bufname': bufname, 'git': git,}) | |
endif | |
16 0.000107 return gita | |
FUNCTION <SNR>81__is_absolute_path() | |
Called 91 times | |
Total time: 0.001052 | |
Self time: 0.001052 | |
count total (s) self (s) | |
91 0.000748 return a:path[0] ==# '/' | |
FUNCTION <SNR>87__new_file_completer() | |
Called 2 times | |
Total time: 0.000289 | |
Self time: 0.000177 | |
count total (s) self (s) | |
2 0.000035 let options = extend({ 'base_dir': '.',}, get(a:000, 0, {})) | |
2 0.000141 0.000029 let completer = s:get_abstract_completer() | |
2 0.000013 function! completer.gather_candidates(arglead, cmdline, cursorpos, args) abort | |
" Ref: Vital.vim OptionParser.vim | |
let candidates = split( glob(s:P.join(self.base_dir, a:arglead . '*'), 0), "\n") | |
" substitute 'base_dir' | |
call map(candidates, printf("substitute(v:val, '^%s/', '', '')", self.base_dir)) | |
" substitute /home/<username> to ~/ if ~/ is specified | |
if a:arglead =~# '^\~' | |
let home_dir = expand('~') | |
call map(candidates, printf("substitute(v:val, '^%s', '~', '')", home_dir)) | |
endif | |
call map(candidates, "escape(isdirectory(v:val) ? v:val.'/' : v:val, ' \\')") | |
return candidates | |
endfunction | |
2 0.000022 return extend(completer, options) | |
FUNCTION <SNR>91__vital_depends() | |
Called 1 time | |
Total time: 0.000010 | |
Self time: 0.000010 | |
count total (s) self (s) | |
1 0.000006 return ['System.Cache.Base'] | |
FUNCTION <SNR>93_pad_left() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let char = get(a:, 1, ' ') | |
if strdisplaywidth(char) != 1 | |
throw "vital: Data.String: Can't use non-half-width characters for padding." | |
endif | |
let left = max([0, a:width - strdisplaywidth(a:str)]) | |
return s:_pad_with_char(a:str, left, 0, char) | |
FUNCTION airline#extensions#quickfix#apply() | |
Called 4 times | |
Total time: 0.000154 | |
Self time: 0.000154 | |
count total (s) self (s) | |
4 0.000036 if &buftype == 'quickfix' | |
let w:airline_section_a = s:get_text() | |
let w:airline_section_b = '%{get(w:, "quickfix_title", "")}' | |
let w:airline_section_c = '' | |
let w:airline_section_x = '' | |
endif | |
FUNCTION gita#util#is_string() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return call(s:Prelude.is_string, a:000, s:Prelude) | |
FUNCTION <SNR>83_find() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
for x in a:list | |
if eval(substitute(a:f, 'v:val', string(x), 'g')) | |
return x | |
endif | |
endfor | |
return a:default | |
FUNCTION <SNR>93_chomp() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return substitute(a:str, '\%(\r\n\|[\r\n]\)$', '', '') | |
FUNCTION <SNR>94_system() | |
Called 12 times | |
Total time: 0.418058 | |
Self time: 0.024243 | |
count total (s) self (s) | |
12 0.000175 let saved_cwd = getcwd() | |
12 0.007690 0.000297 let args = s:List.flatten(a:args) | |
12 0.000381 let opts = extend({ 'stdin': '', 'timeout': 0, 'cwd': saved_cwd,}, get(a:000, 0, {})) | |
12 0.000208 let original_opts = deepcopy(opts) | |
" prevent E677 | |
12 0.000103 if strlen(opts.stdin) | |
let opts.input = opts.stdin | |
endif | |
12 0.000070 try | |
12 0.000966 0.000266 let cwd = s:Prelude.path2directory(opts.cwd) | |
12 0.000857 silent execute 'lcd' fnameescape(cwd) | |
12 0.385138 0.000487 let stdout = s:Process.system(args, opts) | |
12 0.000075 finally | |
12 0.001185 silent execute 'lcd' fnameescape(saved_cwd) | |
12 0.000072 endtry | |
" remove trailing newline | |
12 0.018926 let stdout = substitute(stdout, '\v%(\r?\n)$', '', '') | |
12 0.001390 0.000319 let status = s:Process.get_last_status() | |
12 0.000260 return { 'stdout': stdout, 'status': status, 'args': args, 'opts': original_opts } | |
FUNCTION <SNR>94_get_config() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:_config | |
FUNCTION <SNR>83_break() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:span(printf('!(%s)', a:f), a:xs) | |
FUNCTION <SNR>82__path2project_directory_others() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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') | |
FUNCTION <SNR>101_action_add() | |
Called 1 time | |
Total time: 2.900780 | |
Self time: 0.000552 | |
count total (s) self (s) | |
1 0.000083 0.000028 let statuses = s:ensure_list(a:statuses) | |
1 0.000036 let options = extend({ 'force': 0 }, a:options) | |
1 0.000013 let valid_statuses = [] | |
2 0.000018 for status in statuses | |
1 0.000053 0.000026 if s:validate_status_add(status, options) | |
continue | |
endif | |
1 0.000021 call add(valid_statuses, status) | |
1 0.000005 endfor | |
1 0.000012 if empty(valid_statuses) | |
if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( 'No valid files were selected for add action',) | |
endif | |
return | |
endif | |
1 0.032965 0.000118 let result = s:get_gita().git.add(options, map(valid_statuses, 'v:val.path')) | |
1 0.000012 if result.status | |
call gita#util#error( result.stdout, printf('Fail: %s', join(result.args)),) | |
else | |
1 0.000346 0.000043 call gita#util#doautocmd('add-post') | |
1 0.000005 endif | |
1 2.867049 0.000054 call s:update() | |
FUNCTION <SNR>93_nsplit() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let pattern = get(a:000, 0, '\s') | |
let keepempty = get(a:000, 1, 1) | |
let ret = [] | |
let expr = a:expr | |
if a:n <= 1 | |
return [expr] | |
endif | |
while 1 | |
let pos = match(expr, pattern) | |
if pos == -1 | |
if expr !~ pattern || keepempty | |
call add(ret, expr) | |
endif | |
break | |
elseif pos >= 0 | |
let left = pos > 0 ? expr[:pos-1] : '' | |
if pos > 0 || keepempty | |
call add(ret, left) | |
endif | |
let ml = len(matchstr(expr, pattern)) | |
if pos == 0 && ml == 0 | |
let pos = 1 | |
endif | |
let expr = expr[pos+ml :] | |
endif | |
if len(expr) == 0 | |
break | |
endif | |
if len(ret) == a:n - 1 | |
call add(ret, expr) | |
break | |
endif | |
endwhile | |
return ret | |
FUNCTION <SNR>101_validate_status_conflict() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if !a:status.is_conflicted | |
call gita#util#info(printf( 'A conflict action cannot be performed on a non conflicted file "%s".', a:status.path,)) | |
return 1 | |
else | |
if a:status.sign ==# 'DD' | |
call gita#util#info(printf( 'A conflic action cannot be performed on a both deleted conflict file "%s".', a:status.path,)) | |
return 1 | |
elseif a:status.sign ==# 'DU' | |
call gita#util#info(printf( 'A conflic action cannot be performed on a deleted by us conflict file "%s".', a:status.path,)) | |
return 1 | |
elseif a:status.sign ==# 'UD' | |
call gita#util#info(printf( 'A conflic action cannot be performed on a deleted by them conflict file "%s".', a:status.path,)) | |
return 1 | |
else | |
return 0 | |
endif | |
endif | |
FUNCTION <SNR>82_is_mac() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:is_mac | |
FUNCTION <SNR>97_get_parsed_config() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let defs = { 'local': 0, 'global': 0, 'system': 0, 'file': '', 'blob': '', 'bool': 0, 'int': 0, 'bool_or_int': 0, 'path': 0, 'includes': 0,} | |
let opts = get(a:000, 0, {}) | |
let args = ['config', '--list'] + s:opts2args(opts, defs) | |
let result = s:Core.exec(args, s:Dict.omit(opts, keys(defs))) | |
if result.status != 0 | |
return result | |
endif | |
return s:ConfigParser.parse(result.stdout) | |
FUNCTION gita#util#echomsg() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
execute 'echohl' a:hl | |
try | |
for m in split(a:msg, '\v\r?\n') | |
echomsg m | |
endfor | |
finally | |
echohl None | |
endtry | |
FUNCTION <SNR>101_action_theirs() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let statuses = s:ensure_list(a:statuses) | |
let options = extend({}, a:options) | |
let options.theirs = 1 | |
let valid_statuses = [] | |
for status in statuses | |
if s:validate_status_theirs(status, options) | |
continue | |
endif | |
call add(valid_statuses, status) | |
endfor | |
if empty(valid_statuses) | |
if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( 'No valid files were selected for ours action',) | |
endif | |
return | |
endif | |
let result = s:get_gita().git.checkout(options, '', map(valid_statuses, 'v:val.path')) | |
if result.status == 0 | |
call gita#util#doautocmd('checkout-post') | |
else | |
call gita#util#error( result.stdout, printf('Fail: %s', join(result.args)),) | |
endif | |
call s:update() | |
FUNCTION <SNR>90__vital_loaded() | |
Called 1 time | |
Total time: 0.052378 | |
Self time: 0.000215 | |
count total (s) self (s) | |
1 0.006121 0.000020 let s:Dict = a:V.import('Data.Dict') | |
1 0.004991 0.000026 let s:List = a:V.import('Data.List') | |
1 0.005502 0.000025 let s:Prelude = a:V.import('Prelude') | |
1 0.005610 0.000022 let s:Path = a:V.import('System.Filepath') | |
1 0.006896 0.000021 let s:Cache = a:V.import('System.Cache.Simple') | |
1 0.006745 0.000022 let s:Core = a:V.import('VCS.Git.Core') | |
1 0.007906 0.000021 let s:Misc = a:V.import('VCS.Git.Misc') | |
1 0.008539 0.000022 let s:Finder = a:V.import('VCS.Git.Finder') | |
1 0.000047 0.000017 let s:SEPARATOR = s:Path.separator() | |
FUNCTION <SNR>94_get_branch_remote() | |
Called 4 times | |
Total time: 0.000246 | |
Self time: 0.000246 | |
count total (s) self (s) | |
" a name of remote which the {local_branch} connect | |
4 0.000095 let section = get(a:config, printf('branch "%s"', a:local_branch), {}) | |
4 0.000033 if empty(section) | |
return '' | |
endif | |
4 0.000038 return get(section, 'remote', '') | |
FUNCTION <SNR>83_shift() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return remove(a:list, 0) | |
FUNCTION <SNR>83_sort() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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') | |
FUNCTION <SNR>94_get_branch_merge() | |
Called 4 times | |
Total time: 0.000338 | |
Self time: 0.000338 | |
count total (s) self (s) | |
" a branch name of remote which {local_branch} connect | |
4 0.000046 let truncate = get(a:000, 0, 0) | |
4 0.000079 let section = get(a:config, printf('branch "%s"', a:local_branch), {}) | |
4 0.000030 if empty(section) | |
return '' | |
endif | |
4 0.000047 let merge = get(section, 'merge', '') | |
4 0.000043 return truncate ? substitute(merge, '\v^refs/heads/', '', '') : merge | |
FUNCTION <SNR>87_get_completers() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return deepcopy(s:_completers) | |
FUNCTION <SNR>98_is_conflicted() | |
Called 144 times | |
Total time: 0.012731 | |
Self time: 0.012731 | |
count total (s) self (s) | |
144 0.012188 return a:sign =~# s:const.conflicted_pattern | |
FUNCTION <SNR>97_count_commits_behind_remote() | |
Called 3 times | |
Total time: 0.054330 | |
Self time: 0.000582 | |
count total (s) self (s) | |
3 0.000030 let opts = get(a:000, 0, {}) | |
3 0.053847 0.000099 let result = s:Core.exec(['log', '--oneline', '..@{upstream}'], opts) | |
3 0.000433 return result.status == 0 ? len(split(result.stdout, '\v%(\r?\n)')) : 0 | |
FUNCTION airline#statusline() | |
Called 16 times | |
Total time: 0.000806 | |
Self time: 0.000806 | |
count total (s) self (s) | |
16 0.000333 if has_key(s:contexts, a:winnr) | |
16 0.000341 return '%{airline#check_mode('.a:winnr.')}'.s:contexts[a:winnr].line | |
endif | |
" in rare circumstances this happens...see #276 | |
return '' | |
FUNCTION <SNR>81__get_sid_by_script() | |
Called 111 times | |
Total time: 0.562978 | |
Self time: 0.184433 | |
count total (s) self (s) | |
111 0.012435 0.001719 let path = s:_unify_path(a:path) | |
838 0.393421 0.096836 for line in filter(split(s:_redir('scriptnames'), "\n"), 'stridx(v:val, s:self_version) > 0') | |
818 0.055347 let list = matchlist(line, '^\s*\(\d\+\):\s\+\(.\+\)\s*$') | |
818 0.086860 0.015616 if !empty(list) && s:_unify_path(list[2]) ==# path | |
91 0.000756 return list[1] - 0 | |
endif | |
727 0.002808 endfor | |
20 0.000080 return 0 | |
FUNCTION <SNR>102_strip_ours() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let buflines = s:P.is_list(a:buflines) ? join(a:buflines, "\n") : a:buflines | |
let region_pattern = printf('%s.{-}%s', s:const.patterns.ours, s:const.patterns.separator,) | |
let buflines = substitute(buflines, '\v' . region_pattern . '\n?', '', 'g') | |
let buflines = substitute(buflines, '\v' . s:const.patterns.theirs . '\n?', '', 'g') | |
return get(a:000, 0, s:P.is_list(a:buflines)) ? split(buflines, '\v\r?\n') : buflines | |
FUNCTION <SNR>94_get_repository_config() | |
Called 1 time | |
Total time: 0.053693 | |
Self time: 0.000082 | |
count total (s) self (s) | |
1 0.000195 0.000021 let filename = s:Path.join(a:repository, 'config') | |
1 0.000020 if !filereadable(filename) | |
return {} | |
endif | |
1 0.053463 0.000026 return s:INI.parse_file(filename) | |
FUNCTION gita#util#buffer_clear_undo() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let saved_undolevels = &undolevels | |
setlocal undolevels=-1 | |
silent execute "normal a \<BS>\<ESC>" | |
silent execute 'setlocal undolevels=' . saved_undolevels | |
FUNCTION <SNR>86_swap() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:make(values(a:dict), keys(a:dict)) | |
FUNCTION <SNR>93_replace_first() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:_replace(a:str, a:from, a:to, '') | |
FUNCTION <SNR>92_new() | |
Called 4 times | |
Total time: 0.000065 | |
Self time: 0.000065 | |
count total (s) self (s) | |
4 0.000046 return deepcopy(s:cache) | |
FUNCTION <SNR>93_split3() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let ERROR = ['', '', ''] | |
if a:expr ==# '' || a:pattern ==# '' | |
return ERROR | |
endif | |
let begin = match(a:expr, a:pattern) | |
if begin is -1 | |
return ERROR | |
endif | |
let end = matchend(a:expr, a:pattern) | |
let left = begin <=# 0 ? '' : a:expr[: begin - 1] | |
let right = a:expr[end :] | |
return [left, a:expr[begin : end-1], right] | |
FUNCTION <SNR>87_get_abstract_completer() | |
Called 4 times | |
Total time: 0.000220 | |
Self time: 0.000220 | |
count total (s) self (s) | |
4 0.000038 let completer = { 'candidates': [],} | |
4 0.000029 function! completer.complete(arglead, cmdline, cursorpos, args) abort | |
let candidates = self.gather_candidates( a:arglead, a:cmdline, a:cursorpos, a:args,) | |
let candidates = filter( deepcopy(candidates), printf('v:val =~# "^%s"', a:arglead),) | |
return candidates | |
endfunction | |
4 0.000028 function! completer.gather_candidates(arglead, cmdline, cursorpos, args) abort | |
return self.candidates | |
endfunction | |
4 0.000020 return completer | |
FUNCTION <SNR>93_strwidthpart_reverse() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if a:width <= 0 | |
return '' | |
endif | |
let strarr = split(a:str, '\zs') | |
let width = s:wcswidth(a:str) | |
let strlen = len(strarr) | |
let diff = (strlen + 1) / 2 | |
let leftindex = 0 | |
let index = -1 | |
while width > a:width | |
let index = min([leftindex + diff, strlen]) - 1 | |
let partwidth = s:wcswidth(join(strarr[(leftindex):(index)], '')) | |
if width - partwidth >= a:width || diff <= 1 | |
let width -= partwidth | |
let leftindex = index + 1 | |
endif | |
if diff > 1 | |
let diff = diff / 2 | |
endif | |
endwhile | |
return index < strlen ? join(strarr[(index + 1):], '') : '' | |
FUNCTION <SNR>84_basename() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let path = a:path | |
let orig = a:path | |
let path = s:remove_last_separator(path) | |
if path == '' | |
return orig " root directory | |
endif | |
let path = fnamemodify(path, ':t') | |
return path | |
FUNCTION <SNR>82__path2project_directory_svn() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION <SNR>85__vital_loaded() | |
Called 1 time | |
Total time: 0.020977 | |
Self time: 0.000174 | |
count total (s) self (s) | |
1 0.005012 0.000023 let s:P = a:V.import('Prelude') | |
1 0.005152 0.000022 let s:D = a:V.import('Data.Dict') | |
1 0.005233 0.000025 let s:L = a:V.import('Data.List') | |
1 0.005497 0.000022 let s:C = a:V.import('ArgumentParser.Completer') | |
1 0.000006 let s:const = {} | |
1 0.000008 let s:const.types = {} | |
1 0.000007 let s:const.types.any = 0 | |
1 0.000006 let s:const.types.value = 1 | |
1 0.000006 let s:const.types.switch = 2 | |
1 0.000006 let s:const.types.choice = 3 | |
1 0.000006 lockvar s:const | |
1 0.000011 call extend(self, s:const) | |
FUNCTION <SNR>94__vital_loaded() | |
Called 1 time | |
Total time: 0.030289 | |
Self time: 0.000134 | |
count total (s) self (s) | |
1 0.000007 let s:V = a:V | |
1 0.005387 0.000023 let s:Prelude = a:V.import('Prelude') | |
1 0.007291 0.000021 let s:Process = a:V.import('Process') | |
1 0.004905 0.000027 let s:List = a:V.import('Data.List') | |
1 0.005716 0.000024 let s:Path = a:V.import('System.Filepath') | |
1 0.006971 0.000020 let s:INI = a:V.import('Text.INI') | |
FUNCTION airline#extensions#apply() | |
Called 8 times | |
Total time: 0.002967 | |
Self time: 0.001467 | |
count total (s) self (s) | |
8 0.000072 let s:active_winnr = winnr() | |
8 0.001617 0.000116 if s:is_excluded_window() | |
return -1 | |
endif | |
8 0.000053 if &buftype == 'help' | |
call airline#extensions#apply_left_override('Help', '%f') | |
let w:airline_section_x = '' | |
let w:airline_section_y = '' | |
let w:airline_render_right = 1 | |
endif | |
8 0.000039 if &previewwindow | |
let w:airline_section_a = 'Preview' | |
let w:airline_section_b = '' | |
let w:airline_section_c = bufname(winbufnr(winnr())) | |
endif | |
8 0.000173 if has_key(s:filetype_overrides, &ft) | |
let args = s:filetype_overrides[&ft] | |
call airline#extensions#apply_left_override(args[0], args[1]) | |
endif | |
8 0.000080 for item in items(s:filetype_regex_overrides) | |
if match(&ft, item[0]) >= 0 | |
call airline#extensions#apply_left_override(item[1][0], item[1][1]) | |
endif | |
endfor | |
FUNCTION <SNR>81_expand_modules() | |
Called 32 times | |
Total time: 0.035768 | |
Self time: 0.005312 | |
count total (s) self (s) | |
32 0.000348 if type(a:entry) == type([]) | |
let candidates = s:_concat(map(copy(a:entry), 's:search(v:val)')) | |
if empty(candidates) | |
throw printf('vital: Any of module %s is not found', string(a:entry)) | |
endif | |
if eval(join(map(copy(candidates), 'has_key(a:all, v:val)'), '+')) | |
let modules = [] | |
else | |
let modules = [candidates[0]] | |
endif | |
else | |
32 0.030893 0.000437 let modules = s:search(a:entry) | |
32 0.000209 if empty(modules) | |
throw printf('vital: Module %s is not found', a:entry) | |
endif | |
32 0.000092 endif | |
32 0.000588 call filter(modules, '!has_key(a:all, v:val)') | |
64 0.000313 for module in modules | |
32 0.000247 let a:all[module] = 1 | |
32 0.000099 endfor | |
32 0.000172 return modules | |
FUNCTION <SNR>98_parse_record() | |
Called 144 times | |
Total time: 0.109912 | |
Self time: 0.074948 | |
count total (s) self (s) | |
144 0.011354 let opts = extend({ 'fail_silently': 0,}, get(a:000, 0, {})) | |
144 0.001550 for pattern in s:const.status_patterns | |
144 0.010752 let m = matchlist(a:line, pattern) | |
144 0.000953 let result = {} | |
144 0.001710 if len(m) > 5 && m[4] !=# '' | |
" 'XY PATH1 -> PATH2' pattern | |
let result.index = m[1] | |
let result.worktree = m[2] | |
let result.path = substitute(m[3], '\v%(^"|"$)', '', 'g') | |
let result.path2 = substitute(m[4], '\v%(^"|"$)', '', 'g') | |
let result.record = a:line | |
let result.sign = m[1] . m[2] | |
let result.is_conflicted = s:is_conflicted(result.sign) | |
let result.is_staged = s:is_staged(result.sign) | |
let result.is_unstaged = s:is_unstaged(result.sign) | |
let result.is_untracked = s:is_untracked(result.sign) | |
let result.is_ignored = s:is_ignored(result.sign) | |
return result | |
elseif len(m) > 4 && m[3] !=# '' | |
" 'XY PATH' pattern | |
144 0.001428 let result.index = m[1] | |
144 0.001528 let result.worktree = m[2] | |
144 0.007623 let result.path = substitute(m[3], '\v%(^"|"$)', '', 'g') | |
144 0.001291 let result.record = a:line | |
144 0.001774 let result.sign = m[1] . m[2] | |
144 0.015689 0.002958 let result.is_conflicted = s:is_conflicted(result.sign) | |
144 0.007034 0.002929 let result.is_staged = s:is_staged(result.sign) | |
144 0.015150 0.003062 let result.is_unstaged = s:is_unstaged(result.sign) | |
144 0.006331 0.002981 let result.is_untracked = s:is_untracked(result.sign) | |
144 0.005648 0.002960 let result.is_ignored = s:is_ignored(result.sign) | |
144 0.000785 return result | |
endif | |
endfor | |
for pattern in s:const.header_patterns | |
let m = matchlist(a:line, pattern) | |
if len(m) > 2 && m[1] !=# '' | |
return { 'current_branch': m[1], 'remote_branch': m[2],} | |
elseif len(m) > 1 && m[0] !=# '' | |
return { 'current_branch': m[1], 'remote_branch': '',} | |
endif | |
endfor | |
if opts.fail_silently | |
return {} | |
endif | |
throw printf('vital: VCS.Git.StatusParser: Parsing a record failed: "%s"', a:line) | |
FUNCTION <SNR>87_register() | |
Called 2 times | |
Total time: 0.000034 | |
Self time: 0.000034 | |
count total (s) self (s) | |
2 0.000024 let s:_completers[a:name] = a:callback | |
FUNCTION <SNR>101_smart_map() | |
Called 2 times | |
Total time: 0.001876 | |
Self time: 0.000158 | |
count total (s) self (s) | |
2 0.001855 0.000138 return empty(s:get_selected_status()) ? a:lhs : a:rhs | |
FUNCTION <SNR>101_get_selected_status() | |
Called 4 times | |
Total time: 0.003042 | |
Self time: 0.000417 | |
count total (s) self (s) | |
4 0.002741 0.000116 let gita = s:get_gita() | |
4 0.000091 let statuses_map = get(gita.interface.status, 'statuses_map', {}) | |
4 0.000072 let selected_line = getline('.') | |
4 0.000074 return get(statuses_map, selected_line, {}) | |
FUNCTION <SNR>90__get_finder_cache() | |
Called 1 time | |
Total time: 0.000164 | |
Self time: 0.000062 | |
count total (s) self (s) | |
1 0.000009 if !exists('s:finder_cache') | |
1 0.000062 0.000013 let config = s:get_config() | |
1 0.000076 0.000022 let s:finder_cache = call( config.cache.finder.new, config.cache.finder_args, config.cache.finder,) | |
1 0.000004 endif | |
1 0.000005 return s:finder_cache | |
FUNCTION <SNR>101_validate_status_checkout() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if a:status.is_unstaged | |
if get(a:options, 'force', 0) | |
return 0 | |
else | |
call gita#util#info(printf( 'A file "%s" has unstaged changes. Use <Plug>(gita-action-CHECKOUT) instead.', a:status.path,)) | |
return 1 | |
endif | |
elseif a:status.is_untracked || a:status.is_ignored | |
call gita#util#info(printf( 'An untracked/ignored file "%s" cannot be checked out.', a:status.path,)) | |
return 1 | |
elseif a:status.is_conflicted | |
call gita#util#error(printf( 'A conflicted file "%s" cannot be checked out. Use <Plug>(gita-action-ours) or <Plug>(gita-action-theirs) instead.', a:status.path,)) | |
return 1 | |
else | |
return 0 | |
endif | |
FUNCTION <SNR>101_action_update() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
call s:update(a:options) | |
redraw! | |
FUNCTION gita#util#info() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let title = get(a:000, 0, '') | |
if strlen(title) | |
call gita#util#echomsg('Title', title) | |
call gita#util#echomsg('None', a:message) | |
else | |
call gita#util#echomsg('Title', a:message) | |
endif | |
FUNCTION <SNR>90_set_config() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let s:config = extend(s:config, a:config) | |
" clear settings | |
unlet! s:finder_cache | |
unlet! s:finder | |
unlet! s:instance_cache | |
" apply settings | |
call s:Core.set_config(s:config) | |
FUNCTION <SNR>81__uniq() | |
Called 32 times | |
Total time: 0.000385 | |
Self time: 0.000385 | |
count total (s) self (s) | |
32 0.000282 return uniq(a:list) | |
FUNCTION <SNR>86_max_by() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if empty(a:dict) | |
throw 'vital: Data.Dict: Empty dictionary' | |
endif | |
return s:_max_by(a:dict, a:expr) | |
FUNCTION <SNR>102__vital_depends() | |
Called 1 time | |
Total time: 0.000010 | |
Self time: 0.000010 | |
count total (s) self (s) | |
1 0.000007 return [ 'Prelude', 'VCS.Git.Core',] | |
FUNCTION <SNR>83_span() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 :]] | |
FUNCTION <SNR>93_pad_right() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let char = get(a:, 1, ' ') | |
if strdisplaywidth(char) != 1 | |
throw "vital: Data.String: Can't use non-half-width characters for padding." | |
endif | |
let right = max([0, a:width - strdisplaywidth(a:str)]) | |
return s:_pad_with_char(a:str, 0, right, char) | |
FUNCTION <SNR>84_path_separator() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return s:path_separator | |
FUNCTION <SNR>98__vital_loaded() | |
Called 1 time | |
Total time: 0.000028 | |
Self time: 0.000028 | |
count total (s) self (s) | |
" define constant variables | |
1 0.000022 call extend(self, s:const) | |
FUNCTION <SNR>94_exec() | |
Called 12 times | |
Total time: 0.418929 | |
Self time: 0.000871 | |
count total (s) self (s) | |
12 0.000206 let args = [s:_config.executable, s:_config.arguments, a:args] | |
12 0.000135 let opts = get(a:000, 0, {}) | |
12 0.418492 0.000434 return s:system(args, opts) | |
FUNCTION <SNR>82_path2project_directory() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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) | |
FUNCTION <SNR>64_add_section() | |
Called 40 times | |
Total time: 0.008124 | |
Self time: 0.002795 | |
count total (s) self (s) | |
" i have no idea why the warning section needs special treatment, but it's | |
" needed to prevent separators from showing up | |
40 0.000283 if a:key == 'warning' | |
4 0.000111 0.000048 call a:builder.add_raw('%(') | |
4 0.000014 endif | |
40 0.006232 0.001027 call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key)) | |
40 0.000247 if a:key == 'warning' | |
4 0.000104 0.000043 call a:builder.add_raw('%)') | |
4 0.000014 endif | |
FUNCTION gita#util#is_numeric() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return call(s:Prelude.is_numeric, a:000, s:Prelude) | |
FUNCTION 54() | |
Called 4 times | |
Total time: 10.226554 | |
Self time: 0.000700 | |
count total (s) self (s) | |
4 0.000089 let options = extend({ 'no_cache': 0,}, get(a:000, 0, {})) | |
4 0.001100 0.000097 let name = s:Path.join('refs', 'remotes', a:remote, a:branch) | |
4 0.000040 let cache = self.cache.repository | |
4 0.004571 0.000092 if self.is_updated(name) || options.no_cache || !cache.has(name) | |
4 10.218924 0.000131 let result = s:Core.get_remote_hash(self.repository, a:remote, a:branch) | |
4 0.000965 0.000120 call cache.set(name, result) | |
4 0.000013 endif | |
4 0.000790 0.000056 return cache.get(name) | |
FUNCTION <SNR>82_glob() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return glob(a:expr, 1, 1) | |
FUNCTION <SNR>100__vital_loaded() | |
Called 1 time | |
Total time: 0.018667 | |
Self time: 0.000086 | |
count total (s) self (s) | |
1 0.000006 let s:V = a:V | |
1 0.005568 0.000025 let s:Prelude = a:V.import('Prelude') | |
1 0.005805 0.000021 let s:Path = a:V.import('System.Filepath') | |
1 0.007278 0.000024 let s:Core = a:V.import('VCS.Git.Core') | |
FUNCTION <SNR>97_get_parsed_status() | |
Called 4 times | |
Total time: 0.315929 | |
Self time: 0.000806 | |
count total (s) self (s) | |
4 0.000084 let defs = { 'branch': 0, 'untracked_files': '=all', 'ignore_submodules': '=all', 'ignored': 0, 'z': 0,} | |
4 0.000047 let opts = get(a:000, 0, {}) | |
4 0.004311 0.000114 let args = ['status', '--porcelain'] + s:opts2args(opts, defs) | |
4 0.171916 0.000263 let result = s:Core.exec(args, s:Dict.omit(opts, keys(defs))) | |
4 0.000032 if result.status != 0 | |
return result | |
endif | |
4 0.139429 0.000156 return s:StatusParser.parse(result.stdout, { 'fail_silently': 1 }) | |
FUNCTION <SNR>101_action_rm() | |
Called 1 time | |
Total time: 0.000187 | |
Self time: 0.000150 | |
count total (s) self (s) | |
1 0.000056 0.000019 let statuses = s:ensure_list(a:statuses) | |
1 0.000049 let options = extend({ 'force': 0 }, a:options) | |
1 0.000007 let valid_statuses = [] | |
1 0.000006 for status in statuses | |
if s:validate_status_rm(status, options) | |
continue | |
endif | |
call add(valid_statuses, status) | |
endfor | |
1 0.000007 if empty(valid_statuses) | |
1 0.000009 if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( 'No valid files were selected for rm action',) | |
endif | |
1 0.000003 return | |
endif | |
let result = s:get_gita().git.rm(options, map(valid_statuses, 'v:val.path')) | |
if result.status | |
call gita#util#error( result.stdout, printf('Fail: %s', join(result.args)),) | |
else | |
call gita#util#doautocmd('rm-post') | |
endif | |
call s:update() | |
FUNCTION <SNR>84_is_relative() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return !s:is_absolute(a:path) | |
FUNCTION <SNR>84_unify_separator() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return substitute(a:path, s:path_sep_pattern, '/', 'g') | |
FUNCTION <SNR>82_input_helper() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let success = 0 | |
if inputsave() !=# success | |
throw 'inputsave() failed' | |
endif | |
try | |
return call(a:funcname, a:args) | |
finally | |
if inputrestore() !=# success | |
throw 'inputrestore() failed' | |
endif | |
endtry | |
FUNCTION gita#interface#status#action() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if s:validate_filetype('gita#interface#status#action()') | |
return | |
endif | |
call call('s:action', extend([a:name], a:000)) | |
FUNCTION <SNR>83_pop() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return remove(a:list, -1) | |
FUNCTION <SNR>82_is_float() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return type(a:Value) ==# s:__TYPE_FLOAT | |
FUNCTION <SNR>44_LocalBrowse() | |
Called 1 time | |
Total time: 0.000166 | |
Self time: 0.000166 | |
count total (s) self (s) | |
" Unfortunate interaction -- only DechoMsg debugging calls can be safely used here. | |
" Otherwise, the BufEnter event gets triggered when attempts to write to | |
" the DBG buffer are made. | |
1 0.000009 if !exists("s:vimentered") | |
" If s:vimentered doesn't exist, then the VimEnter event hasn't fired. It will, | |
" and so s:VimEnter() will then be calling this routine, but this time with s:vimentered defined. | |
" call Dfunc("s:LocalBrowse(dirname<".a:dirname.">) (s:vimentered doesn't exist)") | |
" call Dret("s:LocalBrowse") | |
return | |
endif | |
" call Dfunc("s:LocalBrowse(dirname<".a:dirname.">) (s:vimentered=".s:vimentered.")") | |
1 0.000016 if has("amiga") | |
" The check against '' is made for the Amiga, where the empty | |
" string is the current directory and not checking would break | |
" things such as the help command. | |
" call Decho("(LocalBrowse) dirname<".a:dirname."> (isdirectory, amiga)") | |
if a:dirname != '' && isdirectory(a:dirname) | |
sil! call netrw#LocalBrowseCheck(a:dirname) | |
if exists("w:netrw_bannercnt") | |
exe w:netrw_bannercnt | |
endif | |
endif | |
elseif isdirectory(a:dirname) | |
" call Decho("(LocalBrowse) dirname<".a:dirname."> ft=".&ft." (isdirectory, not amiga)") | |
" call Dredir("LocalBrowse ft last set: ","verbose set ft") | |
sil! call netrw#LocalBrowseCheck(a:dirname) | |
if exists("w:netrw_bannercnt") | |
exe w:netrw_bannercnt | |
endif | |
else | |
" not a directory, ignore it | |
" call Decho("(LocalBrowse) dirname<".a:dirname."> not a directory, ignoring...") | |
1 0.000003 endif | |
" call Dret("s:LocalBrowse") | |
FUNCTION <SNR>83_find_indices() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION <SNR>82_truncate_skipping() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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) | |
FUNCTION vital#of() | |
Called 1 time | |
Total time: 0.016978 | |
Self time: 0.002858 | |
count total (s) self (s) | |
1 0.001997 let files = globpath(&runtimepath, 'autoload/vital/' . a:name . '.vital') | |
1 0.000036 let file = split(files, "\n") | |
1 0.000015 if empty(file) | |
throw 'vital: version file not found: ' . a:name | |
endif | |
1 0.000126 let ver = readfile(file[0], 'b') | |
1 0.000014 if empty(ver) | |
throw 'vital: invalid version file: ' . a:name | |
endif | |
1 0.014737 0.000617 return vital#_{substitute(ver[0], '\W', '', 'g')}#new() | |
FUNCTION <SNR>59_exec_separator() | |
Called 22 times | |
Total time: 0.026297 | |
Self time: 0.002776 | |
count total (s) self (s) | |
22 0.011606 0.000405 let l:from = airline#themes#get_highlight(a:from.a:suffix) | |
22 0.010127 0.000431 let l:to = airline#themes#get_highlight(a:to.a:suffix) | |
22 0.000257 let group = a:from.'_to_'.a:to.a:suffix | |
22 0.000103 if a:inverse | |
4 0.000080 let colors = [ l:from[1], l:to[1], l:from[3], l:to[3] ] | |
4 0.000013 else | |
18 0.000276 let colors = [ l:to[1], l:from[1], l:to[3], l:from[3] ] | |
18 0.000061 endif | |
22 0.000213 let a:dict[group] = colors | |
22 0.002995 0.000371 call airline#highlighter#exec(group, colors) | |
FUNCTION <SNR>83_char_range() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return map( range(char2nr(a:from), char2nr(a:to)), 'nr2char(v:val)') | |
FUNCTION <SNR>85__vital_depends() | |
Called 1 time | |
Total time: 0.000013 | |
Self time: 0.000013 | |
count total (s) self (s) | |
1 0.000010 return ['Prelude', 'Data.Dict', 'Data.List', 'ArgumentParser.Completer'] | |
FUNCTION <SNR>82_substitute_path_separator() | |
Called 14 times | |
Total time: 0.000240 | |
Self time: 0.000240 | |
count total (s) self (s) | |
14 0.000170 return s:is_windows ? substitute(a:path, '\\', '/', 'g') : a:path | |
FUNCTION gita#util#is_funcref() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return call(s:Prelude.is_funcref, a:000, s:Prelude) | |
FUNCTION <SNR>101_action_ours() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
let statuses = s:ensure_list(a:statuses) | |
let options = extend({}, a:options) | |
let options.ours = 1 | |
let valid_statuses = [] | |
for status in statuses | |
if s:validate_status_ours(status, options) | |
continue | |
endif | |
call add(valid_statuses, status) | |
endfor | |
if empty(valid_statuses) | |
if !get(options, 'ignore_empty_warning', 0) | |
call gita#util#warn( 'No valid files were selected for ours action',) | |
endif | |
return | |
endif | |
let result = s:get_gita().git.checkout(options, '', map(valid_statuses, 'v:val.path')) | |
if result.status == 0 | |
call gita#util#doautocmd('checkout-post') | |
else | |
call gita#util#error( result.stdout, printf('Fail: %s', join(result.args)),) | |
endif | |
call s:update() | |
FUNCTION <SNR>104__vital_loaded() | |
Called 1 time | |
Total time: 0.005402 | |
Self time: 0.000033 | |
count total (s) self (s) | |
1 0.000007 let s:V = a:V | |
1 0.005389 0.000021 let s:P = s:V.import('Prelude') | |
FUNCTION <SNR>63_get_seperator() | |
Called 28 times | |
Total time: 0.028992 | |
Self time: 0.001317 | |
count total (s) self (s) | |
28 0.028169 0.000493 if s:should_change_group(a:prev_group, a:group) | |
return s:get_transitioned_seperator(a:self, a:prev_group, a:group, a:side) | |
else | |
28 0.000279 return a:side ? a:self._context.left_alt_sep : a:self._context.right_alt_sep | |
endif | |
FUNCTION <SNR>93_truncate() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
" Original function is from mattn. | |
" http://github.com/mattn/googlereader-vim/tree/master | |
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 | |
FUNCTION <SNR>93_common_head() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
if empty(a:strs) | |
return '' | |
endif | |
let len = len(a:strs) | |
if len == 1 | |
return a:strs[0] | |
endif | |
let strs = len == 2 ? a:strs : sort(copy(a:strs)) | |
let pat = substitute(strs[0], '.', '\="[" . escape(submatch(0), "^\\") . "]"', 'g') | |
return pat == '' ? '' : matchstr(strs[-1], '\C^\%[' . pat . ']') | |
FUNCTION <SNR>83_permutations() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
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 | |
FUNCTION <SNR>94_get_fetch_head() | |
Called 1 time | |
Total time: 0.002821 | |
Self time: 0.000050 | |
count total (s) self (s) | |
" The SHAs of branch/remote heads that were updated during the last git fetch | |
1 0.000199 0.000021 let filename = s:Path.join(a:repository, 'FETCH_HEAD') | |
1 0.002614 0.000021 return s:_readfile(filename) | |
FUNCTION <SNR>93_contains_multibyte() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return strlen(a:str) != s:strchars(a:str) | |
FUNCTION gita#util#interface_open() | |
Called 1 time | |
Total time: 0.231258 | |
Self time: 0.000125 | |
count total (s) self (s) | |
1 0.000010 let config = get(a:000, 0, {}) | |
1 0.000014 let vname = printf('interface_buffer_manager_%s', a:group) | |
1 0.000008 if !has_key(s:, vname) | |
1 0.084216 0.000016 let BM = gita#util#import('Vim.BufferManager') | |
1 0.000198 0.000029 let s:{vname} = BM.new(config) | |
1 0.000003 endif | |
1 0.146795 0.000031 return s:{vname}.open(a:name, get(a:000, 0, {})) | |
FUNCTION <SNR>86_omit() | |
Called 26 times | |
Total time: 0.003536 | |
Self time: 0.003536 | |
count total (s) self (s) | |
26 0.000335 let new_dict = copy(a:dict) | |
85 0.000456 for key in a:keys | |
59 0.000552 if has_key(a:dict, key) | |
22 0.000292 call remove(new_dict, key) | |
22 0.000064 endif | |
59 0.000223 endfor | |
26 0.000135 return new_dict | |
FUNCTION <SNR>93_lines() | |
Called 0 times | |
Total time: 0.000000 | |
Self time: 0.000000 | |
count total (s) self (s) | |
return split(a:str, '\r\?\n') | |
FUNCTION airline#builder#new() | |
Called 8 times | |
Total time: 0.000666 | |
Self time: 0.000666 | |
count total (s) self (s) | |
8 0.000120 let builder = copy(s:prototype) | |
8 0.000066 let builder._context = a:context | |
8 0.000053 let builder._sections = [] | |
8 0.000290 call extend(builder._context, { 'left_sep': g:airline_left_sep, 'left_alt_sep': g:airline_left_alt_sep, 'right_sep': g:airline_right_sep, 'right_alt_sep': g:airline_right_alt_sep, }, 'keep') | |
8 0.000039 return builder | |
FUNCTIONS SORTED ON TOTAL TIME | |
count total (s) self (s) function | |
4 10.940986 0.007471 <SNR>101_update() | |
4 10.578254 0.001194 gita#util#interface_get_misc_lines() | |
4 10.563247 0.002220 68() | |
4 10.226554 0.000700 54() | |
4 10.218793 10.206084 <SNR>94_get_remote_hash() | |
2 8.288692 0.000695 <SNR>101_action() | |
1 5.497515 0.000598 <SNR>101_action_stage() | |
1 3.791536 0.001090 <SNR>19_Gita() | |
1 3.087815 0.000092 gita#Gita() | |
1 3.083868 0.000391 <SNR>89_GitaStatus() | |
1 3.028717 0.000033 gita#interface#status#open() | |
1 3.028684 0.000688 <SNR>101_open() | |
1 2.900780 0.000552 <SNR>101_action_add() | |
1 2.789103 0.000065 <SNR>101_action_unstage() | |
1 2.789039 0.000489 <SNR>101_action_reset() | |
91 1.885098 0.126079 <SNR>81__import() | |
91 1.186817 0.939069 <SNR>81__build_module() | |
45 1.028872 0.006160 <SNR>81_import() | |
14 0.826721 0.001207 gita#util#import() | |
12 0.809102 0.353921 <SNR>81_load() | |
FUNCTIONS SORTED ON SELF TIME | |
count total (s) self (s) function | |
4 10.218793 10.206084 <SNR>94_get_remote_hash() | |
91 1.186817 0.939069 <SNR>81__build_module() | |
12 0.384651 0.380418 <SNR>95_system() | |
12 0.809102 0.353921 <SNR>81_load() | |
132 0.332595 <SNR>81__redir() | |
111 0.562978 0.184433 <SNR>81__get_sid_by_script() | |
91 1.885098 0.126079 <SNR>81__import() | |
109 0.091198 0.083582 <SNR>81__vital_files() | |
929 0.081960 <SNR>81__unify_path() | |
144 0.109912 0.074948 <SNR>98_parse_record() | |
280 0.059049 0.040382 <SNR>84_join() | |
288 0.056638 0.032991 <SNR>92_hash() | |
199 0.032833 <SNR>96_parse_record() | |
4 0.139272 0.029361 <SNR>98_parse() | |
200 0.024887 <SNR>59_get_syn() | |
12 0.418058 0.024243 <SNR>94_system() | |
68 0.027067 0.021179 <SNR>83_flatten() | |
1 0.053142 0.020309 <SNR>96_parse() | |
3 0.120020 0.020296 <SNR>97_count_commits_ahead_of_remote() | |
4 0.019491 <SNR>93_hash() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment