[ADD] conf for archlinux, <init>
[arrow.git] / archlinux_conf / home / .vim / autoload / tlib / comments.vim
blob54ab5c77dbe09eb2b880d89b67fdcf956636724d
1 " comments.vim
2 " @Author:      Thomas Link (mailto:micathom AT gmail com?subject=[vim])
3 " @Website:     http://www.vim.org/account/profile.php?user_id=4037
4 " @License:     GPL (see http://www.gnu.org/licenses/gpl.txt)
5 " @Created:     2007-11-15.
6 " @Last Change: 2007-11-16.
7 " @Revision:    0.0.23
9 if &cp || exists("loaded_tlib_comments_autoload")
10     finish
11 endif
12 let loaded_tlib_comments_autoload = 1
13 let s:save_cpo = &cpo
14 set cpo&vim
17 " function! tlib#comments#Comments(?rx='')
18 function! tlib#comments#Comments(...)
19     TVarArg ['rx', '']
20     let comments = {}
21     let co = &comments
22     while !empty(co)
23         " TLogVAR co
24         let [m_0, m_key, m_val, m_val1, co0, co; rest] = matchlist(co, '^\([^:]*\):\(\(\\.\|[^,]*\)\+\)\(,\(.*\)$\|$\)')
25         " TLogVAR m_key, m_val, co
26         if empty(m_key)
27             let m_key = ':'
28         endif
29         if empty(rx) || m_key =~ rx
30             let comments[m_key] = m_val
31         endif
32     endwh
33     return comments
34 endf
37 " function! tlib#comments#PartitionLine(line) "{{{3
38 "     if !empty(&commentstring)
39 "         let cs = '^\(\s*\)\('. printf(tlib#rx#Escape(&commentstring), '\)\(.\{-}\)\(') .'\)\(.*\)$'
40 "         let ml = matchlist(a:line, cs)
41 "     else
42 "         let ml = []
43 "     endif
44 "     if !empty(ml)
45 "         let [m_0, pre, open, line, close, post; rest] = ml
46 "     else
47 "         let [m_0, pre, line; rest] = matchstr(a:line, '^\(\s*\)\(.*\)$')
48 "         for [key, val] in tlib#comments#Comments()
49 "             if +++
50 "         endfor
51 "     endif
52 "     return {'pre': pre, 'open': open, 'line': line, 'close': close, 'post': post}
53 " endf
56 let &cpo = s:save_cpo
57 unlet s:save_cpo