annotate vim/vimfiles/bundle/ctrlp.vim/autoload/ctrlp/quickfix.vim @ 7:86e0ac713642

Re-added the latest ctrlp.vim plugin. The ctrlp.vim commit was e61e7d5b801ade5fcefeab3aca75c1f37d54bdf1.
author Brian Neal <bgneal@gmail.com>
date Sun, 29 Apr 2012 16:20:31 -0500
parents
children
rev   line source
bgneal@7 1 " =============================================================================
bgneal@7 2 " File: autoload/ctrlp/quickfix.vim
bgneal@7 3 " Description: Quickfix extension
bgneal@7 4 " Author: Kien Nguyen <github.com/kien>
bgneal@7 5 " =============================================================================
bgneal@7 6
bgneal@7 7 " Init {{{1
bgneal@7 8 if exists('g:loaded_ctrlp_quickfix') && g:loaded_ctrlp_quickfix
bgneal@7 9 fini
bgneal@7 10 en
bgneal@7 11 let g:loaded_ctrlp_quickfix = 1
bgneal@7 12
bgneal@7 13 cal add(g:ctrlp_ext_vars, {
bgneal@7 14 \ 'init': 'ctrlp#quickfix#init()',
bgneal@7 15 \ 'accept': 'ctrlp#quickfix#accept',
bgneal@7 16 \ 'lname': 'quickfix',
bgneal@7 17 \ 'sname': 'qfx',
bgneal@7 18 \ 'type': 'line',
bgneal@7 19 \ 'sort': 0,
bgneal@7 20 \ 'nolim': 1,
bgneal@7 21 \ })
bgneal@7 22
bgneal@7 23 let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
bgneal@7 24
bgneal@7 25 fu! s:lineout(dict)
bgneal@7 26 retu printf('%s|%d:%d| %s', bufname(a:dict['bufnr']), a:dict['lnum'],
bgneal@7 27 \ a:dict['col'], matchstr(a:dict['text'], '\s*\zs.*\S'))
bgneal@7 28 endf
bgneal@7 29 " Utilities {{{1
bgneal@7 30 fu! s:syntax()
bgneal@7 31 if !ctrlp#nosy()
bgneal@7 32 cal ctrlp#hicheck('CtrlPqfLineCol', 'Search')
bgneal@7 33 sy match CtrlPqfLineCol '|\zs\d\+:\d\+\ze|'
bgneal@7 34 en
bgneal@7 35 endf
bgneal@7 36 " Public {{{1
bgneal@7 37 fu! ctrlp#quickfix#init()
bgneal@7 38 cal s:syntax()
bgneal@7 39 retu map(getqflist(), 's:lineout(v:val)')
bgneal@7 40 endf
bgneal@7 41
bgneal@7 42 fu! ctrlp#quickfix#accept(mode, str)
bgneal@7 43 let items = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|')
bgneal@7 44 if items == [] | retu | en
bgneal@7 45 let [md, filpath] = [a:mode, fnamemodify(items[1], ':p')]
bgneal@7 46 if empty(filpath) | retu | en
bgneal@7 47 cal ctrlp#exit()
bgneal@7 48 let cmd = md == 't' ? 'tabe' : md == 'h' ? 'new' : md == 'v' ? 'vne'
bgneal@7 49 \ : ctrlp#normcmd('e')
bgneal@7 50 let cmd = cmd == 'e' && &modified ? 'hid e' : cmd
bgneal@7 51 exe cmd ctrlp#fnesc(filpath)
bgneal@7 52 cal cursor(items[2], items[3])
bgneal@7 53 sil! norm! zvzz
bgneal@7 54 cal ctrlp#setlcdir()
bgneal@7 55 endf
bgneal@7 56
bgneal@7 57 fu! ctrlp#quickfix#id()
bgneal@7 58 retu s:id
bgneal@7 59 endf
bgneal@7 60 "}}}
bgneal@7 61
bgneal@7 62 " vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2