Class-Dot

 view release on metacpan or  search on metacpan

contrib/vim/taglist.vim  view on Meta::CPAN

113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
" taglist window
if !exists('Tlist_GainFocus_On_ToggleOpen')
    let Tlist_GainFocus_On_ToggleOpen = 0
endif
 
" Process files even when the taglist window is not open
if !exists('Tlist_Process_File_Always')
    let Tlist_Process_File_Always = 0
endif
 
if !exists('Tlist_Show_Menu')
    let Tlist_Show_Menu = 0
endif
 
" Tag listing sort type - 'name' or 'order'
if !exists('Tlist_Sort_Type')
    let Tlist_Sort_Type = 'order'
endif
 
" Tag listing window split (horizontal/vertical) control
if !exists('Tlist_Use_Horiz_Window')
    let Tlist_Use_Horiz_Window = 0

contrib/vim/taglist.vim  view on Meta::CPAN

248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
" on Vim startup
if g:Tlist_Auto_Open
    autocmd VimEnter * nested call s:Tlist_Window_Check_Auto_Open()
endif
 
" Refresh the taglist
if g:Tlist_Process_File_Always
    autocmd BufEnter * call s:Tlist_Refresh()
endif
 
if g:Tlist_Show_Menu
    autocmd GUIEnter * call s:Tlist_Menu_Init()
endif
 
" When the taglist buffer is created when loading a Vim session file,
" the taglist buffer needs to be initialized. The BufFilePost event
" is used to handle this case.
autocmd BufFilePost __Tag_List__ call s:Tlist_Vim_Session_Load()
 
" Define the user commands to manage the taglist window
command! -nargs=0 -bar TlistToggle call s:Tlist_Window_Toggle()
command! -nargs=0 -bar TlistOpen call s:Tlist_Window_Open()

contrib/vim/taglist.vim  view on Meta::CPAN

301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
    " Trick to get the current script ID
    map <SID>xx <SID>xx
    let s:tlist_sid = substitute(maparg('<SID>xx'), '<SNR>\(\d\+_\)xx$',
                                \ '\1', '')
    unmap <SID>xx
 
    exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_* source ' .
                \ escape(expand('<sfile>'), ' ')
    exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_Window_* source ' .
                \ escape(expand('<sfile>'), ' ')
    exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_Menu_* source ' .
                \ escape(expand('<sfile>'), ' ')
    exe 'autocmd FuncUndefined Tlist_* source ' .
                \ escape(expand('<sfile>'), ' ')
    exe 'autocmd FuncUndefined TagList_* source ' .
                \ escape(expand('<sfile>'), ' ')
 
    let loaded_taglist = 'fast_load_done'
 
    if g:Tlist_Show_Menu && has('gui_running')
        call s:Tlist_Menu_Init()
    endif
 
    " restore 'cpo'
    let &cpo = s:cpo_save
    finish
endif
 
if !exists('s:tlist_sid')
    " Two or more versions of taglist plugin are installed. Don't
    " load this version of the plugin.

contrib/vim/taglist.vim  view on Meta::CPAN

1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
        autocmd BufEnter * silent
            \ call s:Tlist_Window_Open_File_Fold(expand('<abuf>'))
    endif
    " Exit Vim itself if only the taglist window is present (optional)
    if g:Tlist_Exit_OnlyWindow
        autocmd BufEnter __Tag_List__ nested
                    \ call s:Tlist_Window_Exit_Only_Window()
    endif
    if s:tlist_app_name != "winmanager" &&
                \ !g:Tlist_Process_File_Always &&
                \ (!has('gui_running') || !g:Tlist_Show_Menu)
        " Auto refresh the taglist window
        autocmd BufEnter * call s:Tlist_Refresh()
    endif
 
    if !g:Tlist_Use_Horiz_Window
        if v:version < 700
            autocmd WinEnter * call s:Tlist_Window_Check_Width()
        endif
    endif
augroup end

contrib/vim/taglist.vim  view on Meta::CPAN

1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
    " include the empty line after the last line
    if g:Tlist_Compact_Format
        let end = s:tlist_{fidx}_end
    else
        let end = s:tlist_{fidx}_end + 1
    endif
    call s:Tlist_Window_Update_Line_Offsets(fidx + 1, 1, end - start + 1)
 
    " Now that we have updated the taglist window, update the tags
    " menu (if present)
    if g:Tlist_Show_Menu
        call s:Tlist_Menu_Update_File(1)
    endif
endfunction
 
" Tlist_Init_File
" Initialize the variables for a new file
function! s:Tlist_Init_File(filename, ftype)
    call s:Tlist_Log_Msg('Tlist_Init_File (' . a:filename . ')')
    " Add new files at the end of the list
    let fidx = s:tlist_file_count
    let s:tlist_file_count = s:tlist_file_count + 1

contrib/vim/taglist.vim  view on Meta::CPAN

2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
            exe 'normal! ' . save_col . '|'
        endif
 
        if winnr() != save_winnr
            " Go back to the original window
            call s:Tlist_Exe_Cmd_No_Acmds(save_winnr . 'wincmd w')
        endif
    endif
 
    " Update the taglist menu
    if g:Tlist_Show_Menu
        call s:Tlist_Menu_Update_File(1)
    endif
endfunction
 
" Tlist_Window_Close
" Close the taglist window
function! s:Tlist_Window_Close()
    call s:Tlist_Log_Msg('Tlist_Window_Close()')
    " Make sure the taglist window exists
    let winnum = bufwinnr(g:TagList_title)
    if winnum == -1

contrib/vim/taglist.vim  view on Meta::CPAN

2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
    call s:Tlist_Window_Open()
 
    " Go back to the original window, if Tlist_GainFocus_On_ToggleOpen is not
    " set
    if !g:Tlist_GainFocus_On_ToggleOpen
        call s:Tlist_Exe_Cmd_No_Acmds('wincmd p')
    endif
 
    " Update the taglist menu
    if g:Tlist_Show_Menu
        call s:Tlist_Menu_Update_File(0)
    endif
endfunction
 
" Tlist_Process_Filelist
" Process multiple files. Each filename is separated by "\n"
" Returns the number of processed files
function! s:Tlist_Process_Filelist(file_names)
    let flist = a:file_names
 
    " Enable lazy screen updates

contrib/vim/taglist.vim  view on Meta::CPAN

2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
" Tlist_Refresh()
" Refresh the taglist
function! s:Tlist_Refresh()
    call s:Tlist_Log_Msg('Tlist_Refresh (Skip_Refresh = ' .
                \ s:Tlist_Skip_Refresh . ', ' . bufname('%') . ')')
    " If we are entering the buffer from one of the taglist functions, then
    " no need to refresh the taglist window again.
    if s:Tlist_Skip_Refresh
        " We still need to update the taglist menu
        if g:Tlist_Show_Menu
            call s:Tlist_Menu_Update_File(0)
        endif
        return
    endif
 
    " If part of the winmanager plugin and not configured to process
    " tags always and not configured to display the tags menu, then return
    if (s:tlist_app_name == 'winmanager') && !g:Tlist_Process_File_Always
                \ && !g:Tlist_Show_Menu
        return
    endif
 
    " Skip buffers with 'https://metacpan.org/pod/buftype">buftype' set to nofile, nowrite, quickfix or help
    if &buftype != ''
        return
    endif
 
    let filename = fnamemodify(bufname('%'), ':p')
    let ftype = &filetype
 
    " If the file doesn't support tag listing, skip it
    if s:Tlist_Skip_File(filename, ftype)
        return
    endif
 
    let tlist_win = bufwinnr(g:TagList_title)
 
    " If the taglist window is not opened and not configured to process
    " tags always and not displaying the tags menu, then return
    if tlist_win == -1 && !g:Tlist_Process_File_Always && !g:Tlist_Show_Menu
        return
    endif
 
    let fidx = s:Tlist_Get_File_Index(filename)
    if fidx == -1
        " Check whether this file is removed based on user request
        " If it is, then don't display the tags for this file
        if s:Tlist_User_Removed_File(filename)
            return
        endif

contrib/vim/taglist.vim  view on Meta::CPAN

2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
        " Jump back to the original window
        if save_winnr != winnr()
            call s:Tlist_Exe_Cmd_No_Acmds(save_winnr . 'wincmd w')
        endif
 
        " Restore screen updates
        let &lazyredraw = old_lazyredraw
    endif
 
    " Update the taglist menu
    if g:Tlist_Show_Menu
        call s:Tlist_Menu_Update_File(0)
    endif
endfunction
 
" Tlist_Change_Sort()
" Change the sort order of the tag listing
" caller == 'cmd', command used in the taglist window
" caller == 'menu', taglist menu
" action == 'toggle', toggle sort from name to order and vice versa
" action == 'set', set the sort order to sort_type
function! s:Tlist_Change_Sort(caller, action, sort_type)

contrib/vim/taglist.vim  view on Meta::CPAN

2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
        let curline = '\V\^' . getline('.') . '\$'
 
        call s:Tlist_Window_Refresh_File(s:tlist_{fidx}_filename,
                    \   s:tlist_{fidx}_filetype)
 
        exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'foldopen!'
 
        " Go back to the cursor line before the tag list is sorted
        call search(curline, 'w')
 
        call s:Tlist_Menu_Update_File(1)
    else
        call s:Tlist_Menu_Remove_File()
 
        call s:Tlist_Refresh()
    endif
endfunction
 
" Tlist_Update_Current_File()
" Update taglist for the current buffer by regenerating the tag list
" Contributed by WEN Guopeng.
function! s:Tlist_Update_Current_File()
    call s:Tlist_Log_Msg('Tlist_Update_Current_File()')

contrib/vim/taglist.vim  view on Meta::CPAN

4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
        endif
        let i = i + 1
        let buf_num = winbufnr(i)
    endwhile
 
    if open_window
        call s:Tlist_Window_Toggle()
    endif
endfunction
 
function! s:Tlist_Menu_Add_Base_Menu()
    call s:Tlist_Log_Msg('Adding the base menu')
 
    " Add the menu
    anoremenu <silent> T&ags.Refresh\ menu :call <SID>Tlist_Menu_Refresh()<CR>
    anoremenu <silent> T&ags.Sort\ menu\ by.Name
                    \ :call <SID>Tlist_Change_Sort('menu', 'set', 'name')<CR>
    anoremenu <silent> T&ags.Sort\ menu\ by.Order
                    \ :call <SID>Tlist_Change_Sort('menu', 'set', 'order')<CR>
    anoremenu T&ags.-SEP1-           :
 
    if &mousemodel =~ 'popup'
        anoremenu <silent> PopUp.T&ags.Refresh\ menu
                    \ :call <SID>Tlist_Menu_Refresh()<CR>
        anoremenu <silent> PopUp.T&ags.Sort\ menu\ by.Name
                  \ :call <SID>Tlist_Change_Sort('menu', 'set', 'name')<CR>
        anoremenu <silent> PopUp.T&ags.Sort\ menu\ by.Order
                  \ :call <SID>Tlist_Change_Sort('menu', 'set', 'order')<CR>
        anoremenu PopUp.T&ags.-SEP1-           :
    endif
endfunction
 
let s:menu_char_prefix =
            \ '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
" Tlist_Menu_Get_Tag_Type_Cmd
" Get the menu command for the specified tag type
" fidx - File type index
" ftype - File Type
" add_ttype_name - To add or not to add the tag type name to the menu entries
" ttype_idx - Tag type index
function! s:Tlist_Menu_Get_Tag_Type_Cmd(fidx, ftype, add_ttype_name, ttype_idx)
    " Curly brace variable name optimization
    let ftype_ttype_idx = a:ftype . '_' . a:ttype_idx
 
    let ttype = s:tlist_{ftype_ttype_idx}_name
    if a:add_ttype_name
        " If the tag type name contains space characters, escape it. This
        " will be used to create the menu entries.
        let ttype_fullname = escape(s:tlist_{ftype_ttype_idx}_fullname, ' ')
    endif

contrib/vim/taglist.vim  view on Meta::CPAN

4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
        " Character prefix used to number the menu items (hotkey)
        let m_prefix_idx = 0
 
        while j <= final_index
            let tidx = s:tlist_{fidx_ttype}_{j}
 
            let tname = s:tlist_{a:fidx}_{tidx}_tag_name
 
            let mcmd = mcmd . m_prefix . '\&' .
                        \ s:menu_char_prefix[m_prefix_idx] . '\.' .
                        \ tname . ' :call <SID>Tlist_Menu_Jump_To_Tag(' .
                        \ tidx . ')<CR>|'
 
            let m_prefix_idx = m_prefix_idx + 1
            let j = j + 1
        endwhile
    endwhile
else
    " Character prefix used to number the menu items (hotkey)
    let m_prefix_idx = 0

contrib/vim/taglist.vim  view on Meta::CPAN

4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
            let m_prefix = m_prefix . ttype_fullname . '.'
        endif
        let j = 1
        while j <= tcnt
            let tidx = s:tlist_{fidx_ttype}_{j}
 
            let tname = s:tlist_{a:fidx}_{tidx}_tag_name
 
            let mcmd = mcmd . m_prefix . '\&' .
                        \ s:menu_char_prefix[m_prefix_idx] . '\.' .
                        \ tname . ' :call <SID>Tlist_Menu_Jump_To_Tag(' . tidx
                        \ . ')<CR>|'
 
            let m_prefix_idx = m_prefix_idx + 1
            let j = j + 1
        endwhile
    endif
 
    return mcmd
endfunction
 
" Update the taglist menu with the tags for the specified file
function! s:Tlist_Menu_File_Refresh(fidx)
    call s:Tlist_Log_Msg('Refreshing the tag menu for ' . s:tlist_{a:fidx}_filename)
    " The 'B' flag is needed in the 'cpoptions' option
    let old_cpoptions = &cpoptions
    set cpoptions&vim
 
    exe s:tlist_{a:fidx}_menu_cmd
 
    " Update the popup menu (if enabled)
    if &mousemodel =~ 'popup'
        let cmd = substitute(s:tlist_{a:fidx}_menu_cmd, ' T\\&ags\.',

contrib/vim/taglist.vim  view on Meta::CPAN

4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
        exe cmd
    endif
 
    " The taglist menu is not empty now
    let s:tlist_menu_empty = 0
 
    " Restore the 'cpoptions' settings
    let &cpoptions = old_cpoptions
endfunction
 
" Tlist_Menu_Update_File
" Add the taglist menu
function! s:Tlist_Menu_Update_File(clear_menu)
    if !has('gui_running')
        " Not running in GUI mode
        return
    endif
 
    call s:Tlist_Log_Msg('Updating the tag menu, clear_menu = ' . a:clear_menu)
 
    " Remove the tags menu
    if a:clear_menu
        call s:Tlist_Menu_Remove_File()
 
    endif
 
    " Skip buffers with 'https://metacpan.org/pod/buftype">buftype' set to nofile, nowrite, quickfix or help
    if &buftype != ''
        return
    endif
 
    let filename = fnamemodify(bufname('%'), ':p')
    let ftype = &filetype

contrib/vim/taglist.vim  view on Meta::CPAN

4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
    exe 'anoremenu T&ags.' .  fname . ' <Nop>'
    anoremenu T&ags.-SEP2-           :
endif
 
if !s:tlist_{fidx}_tag_count
    return
endif
 
if s:tlist_{fidx}_menu_cmd != ''
    " Update the menu with the cached command
    call s:Tlist_Menu_File_Refresh(fidx)
 
    return
endif
 
" We are going to add entries to the tags menu, so the menu won't be
" empty
let s:tlist_menu_empty = 0
 
let cmd = ''

contrib/vim/taglist.vim  view on Meta::CPAN

4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
        let ttype = s:tlist_{ftype}_{i}_name
        if s:tlist_{fidx}_{ttype}_count
            let add_ttype_name = add_ttype_name + 1
        endif
        let i = i + 1
    endwhile
 
    " Process the tags by the tag type and get the menu command
    let i = 1
    while i <= s:tlist_{ftype}_count
        let mcmd = s:Tlist_Menu_Get_Tag_Type_Cmd(fidx, ftype, add_ttype_name, i)
        if mcmd != ''
            let cmd = cmd . mcmd
        endif
 
        let i = i + 1
    endwhile
 
    " Cache the menu command for reuse
    let s:tlist_{fidx}_menu_cmd = cmd
 
    " Update the menu
    call s:Tlist_Menu_File_Refresh(fidx)
endfunction
 
" Tlist_Menu_Remove_File
" Remove the tags displayed in the tags menu
function! s:Tlist_Menu_Remove_File()
    if !has('gui_running') || s:tlist_menu_empty
        return
    endif
 
    call s:Tlist_Log_Msg('Removing the tags menu for a file')
 
    " Cleanup the Tags menu
    silent! unmenu T&ags
    if &mousemodel =~ 'popup'
        silent! unmenu PopUp.T&ags
    endif
 
    " Add a dummy menu item to retain teared off menu
    noremenu T&ags.Dummy l
 
    silent! unmenu! T&ags
    if &mousemodel =~ 'popup'
        silent! unmenu! PopUp.T&ags
    endif
 
    call s:Tlist_Menu_Add_Base_Menu()
 
    " Remove the dummy menu item
    unmenu T&ags.Dummy
 
    let s:tlist_menu_empty = 1
endfunction
 
" Tlist_Menu_Refresh
" Refresh the taglist menu
function! s:Tlist_Menu_Refresh()
    call s:Tlist_Log_Msg('Refreshing the tags menu')
    let fidx = s:Tlist_Get_File_Index(fnamemodify(bufname('%'), ':p'))
    if fidx != -1
        " Invalidate the cached menu command
        let s:tlist_{fidx}_menu_cmd = ''
    endif
 
    " Update the taglist, menu and window
    call s:Tlist_Update_Current_File()
endfunction
 
" Tlist_Menu_Jump_To_Tag
" Jump to the selected tag
function! s:Tlist_Menu_Jump_To_Tag(tidx)
    let fidx = s:Tlist_Get_File_Index(fnamemodify(bufname('%'), ':p'))
    if fidx == -1
        return
    endif
 
    let tagpat = s:Tlist_Get_Tag_SearchPat(fidx, a:tidx)
    if tagpat == ''
        return
    endif

contrib/vim/taglist.vim  view on Meta::CPAN

4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
    " Bring the line to the middle of the window
    normal! z.
 
    " If the line is inside a fold, open the fold
    if foldclosed('.') != -1
        .foldopen
    endif
endfunction
 
" Tlist_Menu_Init
" Initialize the taglist menu
function! s:Tlist_Menu_Init()
    call s:Tlist_Menu_Add_Base_Menu()
 
    " Automatically add the tags defined in the current file to the menu
    augroup TagListMenuCmds
        autocmd!
 
        if !g:Tlist_Process_File_Always
            autocmd BufEnter * call s:Tlist_Refresh()
        endif
        autocmd BufLeave * call s:Tlist_Menu_Remove_File()
    augroup end
 
    call s:Tlist_Menu_Update_File(0)
endfunction
 
" Tlist_Vim_Session_Load
" Initialize the taglist window/buffer, which is created when loading
" a Vim session file.
function! s:Tlist_Vim_Session_Load()
    call s:Tlist_Log_Msg('Tlist_Vim_Session_Load')
 
    " Initialize the taglist window
    call s:Tlist_Window_Init()



( run in 0.513 second using v1.01-cache-2.11-cpan-87723dcf8b7 )