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