"============================================================================= " File : autoload/unite/sources/outline/defaults/php.vim " Author : h1mesuke " Updated : 2012-01-11 " " Contributed by hamaco " " Licensed under the MIT license: " http://www.opensource.org/licenses/mit-license.php " "============================================================================= " Default outline info for PHP " Version: 0.1.2 function! unite#sources#outline#defaults#php#outline_info() abort return s:outline_info endfunction let s:Util = unite#sources#outline#import('Util') "--------------------------------------- " Sub Pattern let s:pat_type = '\%(interface\|class\|trait\|function\)\>' "----------------------------------------------------------------------------- " Outline Info let s:outline_info = { \ 'heading-1': s:Util.shared_pattern('cpp', 'heading-1'), \ 'heading' : '^\s*\%(\h\w*\s\+\)*' . s:pat_type, \ \ 'skip': { \ 'header': { \ 'leading': '^\%(' " Interface let heading.type = 'interface' let heading.word = matchstr(heading.word, '\zs\' " Class let heading.type = 'class' let heading.word = matchstr(heading.word, '\zs\' " Trait let heading.type = 'trait' let heading.word = matchstr(heading.word, '\zs\' let heading.word = '+ ' . heading.word elseif modifiers =~ '^\s*protected\>' let heading.word = '# ' . heading.word elseif modifiers =~ '^\s*private\>' let heading.word = '- ' . heading.word elseif heading.level > 3 let heading.word = substitute(heading.word, '\%(&\|\h\)\@=', '+ ', '') endif let heading.word = substitute(heading.word, '\S\zs(', ' (', '') endif " Append modifiers. let modifiers = substitute(modifiers, '\%(public\|protected\|private\)', '', 'g') if modifiers !~ '^\s*$' let heading.word .= ' <' . join(split(modifiers, '\s\+'), ',') . '>' endif endif return heading endfunction function! s:outline_info.need_blank_between(cand1, cand2, memo) abort if a:cand1.source__heading_group == 'function' && a:cand2.source__heading_group == 'function' " Don't insert a blank between two sibling functions. return 0 else return (a:cand1.source__heading_group != a:cand2.source__heading_group || \ a:cand1.source__has_marked_child || a:cand2.source__has_marked_child) endif endfunction