annotate vim/vimfiles/autoload/ctrlp/line.vim @ 4:6bb800967ce5

Turn off spell checking by default. Use the Unix/Linux syntax for wildignore.
author Brian Neal <bgneal@gmail.com>
date Thu, 05 Jan 2012 20:05:42 -0600
parents 92af3257a261
children
rev   line source
bgneal@0 1 " =============================================================================
bgneal@0 2 " File: autoload/ctrlp/line.vim
bgneal@0 3 " Description: Line extension - find a line in any buffer.
bgneal@0 4 " Author: Kien Nguyen <github.com/kien>
bgneal@0 5 " =============================================================================
bgneal@0 6
bgneal@0 7 " Init {{{1
bgneal@0 8 if exists('g:loaded_ctrlp_line') && g:loaded_ctrlp_line
bgneal@0 9 fini
bgneal@0 10 en
bgneal@0 11 let g:loaded_ctrlp_line = 1
bgneal@0 12
bgneal@3 13 let s:line_var = ['ctrlp#line#init()', 'ctrlp#line#accept', 'lines', 'lns']
bgneal@0 14
bgneal@0 15 let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
bgneal@0 16 \ ? add(g:ctrlp_ext_vars, s:line_var) : [s:line_var]
bgneal@0 17
bgneal@0 18 let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
bgneal@0 19 " Public {{{1
bgneal@0 20 fu! ctrlp#line#init()
bgneal@0 21 let [bufs, lines] = [[], []]
bgneal@0 22 for each in range(1, bufnr('$'))
bgneal@0 23 if getbufvar(each, '&bl')
bgneal@0 24 let bufname = bufname(each)
bgneal@0 25 if strlen(bufname) && bufname != 'ControlP'
bgneal@0 26 cal add(bufs, fnamemodify(bufname, ':p'))
bgneal@0 27 en
bgneal@0 28 en
bgneal@0 29 endfo
bgneal@0 30 cal filter(bufs, 'filereadable(v:val)')
bgneal@0 31 for each in bufs
bgneal@0 32 let from_file = readfile(each)
bgneal@0 33 cal map(from_file, 'tr(v:val, '' '', '' '')')
bgneal@0 34 let [id, len_ff, bufnr] = [1, len(from_file), bufnr(each)]
bgneal@0 35 wh id <= len_ff
bgneal@0 36 let from_file[id-1] .= ' #:'.bufnr.':'.id
bgneal@0 37 let id += 1
bgneal@0 38 endw
bgneal@0 39 cal filter(from_file, 'v:val !~ ''^\s*\t#:\d\+:\d\+$''')
bgneal@0 40 cal extend(lines, from_file)
bgneal@0 41 endfo
bgneal@0 42 sy match CtrlPTabExtra '\zs\t.*\ze$'
bgneal@0 43 hi link CtrlPTabExtra Comment
bgneal@0 44 retu lines
bgneal@0 45 endf
bgneal@0 46
bgneal@0 47 fu! ctrlp#line#accept(mode, str)
bgneal@0 48 let info = get(split(a:str, '\t#:\ze\d\+:\d\+$'), 1, 0)
bgneal@0 49 let bufnr = str2nr(get(split(info, ':'), 0, 0))
bgneal@0 50 let linenr = get(split(info, ':'), 1, 0)
bgneal@0 51 if bufnr
bgneal@0 52 cal ctrlp#acceptfile(a:mode, fnamemodify(bufname(bufnr), ':p'), linenr)
bgneal@0 53 en
bgneal@0 54 endf
bgneal@0 55
bgneal@0 56 fu! ctrlp#line#id()
bgneal@0 57 retu s:id
bgneal@0 58 endf
bgneal@0 59 "}}}
bgneal@0 60
bgneal@0 61 " vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2