mirror of
https://github.com/amix/vimrc
synced 2024-12-30 13:53:07 +00:00
3f1cdba799
Added update_plugins.py which can fetch new plugins from GitHub. New plugins added: zencoding, vim-indent-object, taglist, nginx.vim
65 lines
1.8 KiB
VimL
65 lines
1.8 KiB
VimL
" =============================================================================
|
|
" File: autoload/ctrlp/line.vim
|
|
" Description: Line extension
|
|
" Author: Kien Nguyen <github.com/kien>
|
|
" =============================================================================
|
|
|
|
" Init {{{1
|
|
if exists('g:loaded_ctrlp_line') && g:loaded_ctrlp_line
|
|
fini
|
|
en
|
|
let g:loaded_ctrlp_line = 1
|
|
|
|
cal add(g:ctrlp_ext_vars, {
|
|
\ 'init': 'ctrlp#line#init()',
|
|
\ 'accept': 'ctrlp#line#accept',
|
|
\ 'lname': 'lines',
|
|
\ 'sname': 'lns',
|
|
\ 'type': 'tabe',
|
|
\ })
|
|
|
|
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
" Utilities {{{1
|
|
fu! s:syntax()
|
|
if !ctrlp#nosy()
|
|
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
|
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
|
sy match CtrlPBufName '\t|\zs[^|]\+\ze|\d\+:\d\+|$'
|
|
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
|
en
|
|
endf
|
|
" Public {{{1
|
|
fu! ctrlp#line#init()
|
|
let [bufs, lines] = [ctrlp#buffers('id'), []]
|
|
for bufnr in bufs
|
|
let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)]
|
|
if lfb == [] && bufn != ''
|
|
let lfb = ctrlp#utils#readfile(fnamemodify(bufn, ':p'))
|
|
en
|
|
cal map(lfb, 'tr(v:val, '' '', '' '')')
|
|
let [linenr, len_lfb] = [1, len(lfb)]
|
|
let buft = bufn == '' ? '[No Name]' : fnamemodify(bufn, ':t')
|
|
wh linenr <= len_lfb
|
|
let lfb[linenr - 1] .= ' |'.buft.'|'.bufnr.':'.linenr.'|'
|
|
let linenr += 1
|
|
endw
|
|
cal extend(lines, filter(lfb, 'v:val !~ ''^\s*\t|[^|]\+|\d\+:\d\+|$'''))
|
|
endfo
|
|
cal s:syntax()
|
|
retu lines
|
|
endf
|
|
|
|
fu! ctrlp#line#accept(mode, str)
|
|
let info = matchlist(a:str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$')
|
|
let bufnr = str2nr(get(info, 1))
|
|
if bufnr
|
|
cal ctrlp#acceptfile(a:mode, bufnr, get(info, 2))
|
|
en
|
|
endf
|
|
|
|
fu! ctrlp#line#id()
|
|
retu s:id
|
|
endf
|
|
"}}}
|
|
|
|
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|