2012-08-16 23:41:25 -04:00
|
|
|
" Filter_cnfd.vim
|
|
|
|
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
|
|
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
|
|
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
|
|
" @Created: 2008-11-25.
|
2014-03-11 16:10:50 -04:00
|
|
|
" @Last Change: 2014-01-23.
|
|
|
|
" @Revision: 0.0.57
|
2012-08-16 23:41:25 -04:00
|
|
|
|
|
|
|
let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_cnfd'], 'name': 'cnfd'}) "{{{2
|
2013-11-16 14:45:48 -05:00
|
|
|
let s:prototype.highlight = g:tlib#input#higroup
|
2012-08-16 23:41:25 -04:00
|
|
|
|
|
|
|
|
2013-04-13 13:45:21 -04:00
|
|
|
" The same as |tlib#Filter_cnf#New()| but a dot is expanded to '\.\{-}'.
|
2012-08-16 23:41:25 -04:00
|
|
|
" As a consequence, patterns cannot match dots.
|
|
|
|
" The pattern is a '/\V' very no-'/magic' regexp pattern.
|
|
|
|
function! tlib#Filter_cnfd#New(...) "{{{3
|
|
|
|
let object = s:prototype.New(a:0 >= 1 ? a:1 : {})
|
|
|
|
return object
|
|
|
|
endf
|
|
|
|
|
|
|
|
|
|
|
|
" :nodoc:
|
|
|
|
function! s:prototype.Init(world) dict "{{{3
|
|
|
|
endf
|
|
|
|
|
|
|
|
|
2013-04-13 13:45:21 -04:00
|
|
|
let s:Help = s:prototype.Help
|
|
|
|
|
|
|
|
" :nodoc:
|
|
|
|
function! s:prototype.Help(world) dict "{{{3
|
|
|
|
call call(s:Help, [a:world], self)
|
2014-03-11 16:10:50 -04:00
|
|
|
call a:world.PushHelp('.', 'Any characters')
|
2013-04-13 13:45:21 -04:00
|
|
|
endf
|
|
|
|
|
|
|
|
|
2012-08-16 23:41:25 -04:00
|
|
|
" :nodoc:
|
|
|
|
function! s:prototype.SetFrontFilter(world, pattern) dict "{{{3
|
|
|
|
let pattern = substitute(a:pattern, '\.', '\\.\\{-}', 'g')
|
|
|
|
let a:world.filter[0] = reverse(split(pattern, '\s*|\s*')) + a:world.filter[0][1 : -1]
|
|
|
|
endf
|
|
|
|
|
|
|
|
|
|
|
|
" :nodoc:
|
|
|
|
function! s:prototype.PushFrontFilter(world, char) dict "{{{3
|
|
|
|
let a:world.filter[0][0] .= a:char == 46 ? '\.\{-}' : nr2char(a:char)
|
|
|
|
endf
|
|
|
|
|
|
|
|
|
|
|
|
" :nodoc:
|
|
|
|
function! s:prototype.CleanFilter(filter) dict "{{{3
|
|
|
|
return substitute(a:filter, '\\.\\{-}', '.', 'g')
|
|
|
|
endf
|
|
|
|
|