frawor / plugin / frawor / history.vim

ZyX_I 6798d28 

ZyX_I 3163ec6 
ZyX_I 6798d28 

ZyX_I db58a7e 
ZyX_I 6798d28 

ZyX_I db58a7e 
ZyX_I 6798d28 
ZyX_I db58a7e 
ZyX_I 6798d28 

"▶1 Header
scriptencoding utf-8
execute frawor#Setup('0.0', {'@/resources': '0.0',
            \     '@/decorators/altervars': '0.0',})
let s:history={}
"▶1 history.get :: htype + history → [String]
function s:history.get(htype)
    let r=[]
    let i=1
    let lasthist=histnr(a:htype)
    while i<=lasthist
        let histline=histget(a:htype, i)
        if !empty(histline)
            call add(r, histline)
        let i+=1
    return r
"▶1 history.clear :: htype → + history
let s:history.clear=function('histdel')
"▶1 history.set :: htype, [String] → + history
function s:history.set(htype, histlines)
    call s:history.clear(a:htype)
    let i=0
    let lhistlines=len(a:histlines)
    while i<lhistlines
        call histadd(a:htype, a:histlines[i])
        let i+=1
"▶1 Post resource
call s:_f.postresource('history', s:history)
"▶1 Create altspecial
let s:histtypes=['input', '@', 'expr', '=', 'cmd', ':', 'search', '/']
function s:F.histchecker(arg)
    return index(s:histtypes, a:arg[0])!=-1
function s:F.histset(histlines, htype)
    return s:history.set(a:htype, a:histlines)
call s:_f.addaltspecial('history', s:history.get, s:F.histset,
            \           {'requiresarg': 1, 'checker': s:F.histchecker,})
call frawor#Lockvar(s:, '')
" vim: fmr=▶,▲ sw=4 ts=4 sts=4 et tw=80
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.