Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
80 lines
2.4 KiB
VimL
80 lines
2.4 KiB
VimL
"=============================================================================
|
|
" FILE: history_unite.vim
|
|
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
|
|
" License: MIT license
|
|
"=============================================================================
|
|
|
|
let s:save_cpo = &cpo
|
|
set cpo&vim
|
|
|
|
" Variables "{{{
|
|
let s:unite_histories = []
|
|
|
|
" the last modified time of the unite histories file.
|
|
let s:unite_histories_file_mtime = 0
|
|
|
|
call unite#util#set_default('g:unite_source_history_unite_file',
|
|
\ unite#get_data_directory() . '/history_unite')
|
|
|
|
call unite#util#set_default('g:unite_source_history_unite_limit', 100)
|
|
"}}}
|
|
|
|
function! unite#sources#history_unite#add(unite) abort"{{{
|
|
let s:unite_histories = filter(s:unite_histories,
|
|
\ 'v:val.sources !=# a:unite.sources
|
|
\ && v:val.context.input !=# a:unite.context.input')
|
|
\[ : g:unite_source_history_unite_limit - 1]
|
|
|
|
if !empty(filter(copy(a:unite.sources),
|
|
\ "v:val.name ==# 'history/unite' || !v:val.is_listed"))
|
|
" Don't save non listed source or history/unite
|
|
return
|
|
endif
|
|
|
|
let context = deepcopy(a:unite.original_context)
|
|
let context.input = a:unite.context.input
|
|
call insert(s:unite_histories, {
|
|
\ 'sources' : deepcopy(a:unite.sources),
|
|
\ 'context' : context,
|
|
\ 'source_args' :
|
|
\ join(map(copy(a:unite.sources),
|
|
\ 'unite#view#_get_source_name_string(v:val)')),
|
|
\ 'time' : localtime()
|
|
\ })
|
|
endfunction"}}}
|
|
|
|
function! unite#sources#history_unite#define() abort
|
|
return s:source
|
|
endfunction
|
|
|
|
let s:source = {
|
|
\ 'name' : 'history/unite',
|
|
\ 'description' : 'candidates from unite history',
|
|
\ 'action_table' : {},
|
|
\ 'default_action' : 'start',
|
|
\}
|
|
|
|
function! s:source.gather_candidates(args, context) abort "{{{
|
|
return map(copy(s:unite_histories), "{
|
|
\ 'word' : v:val.source_args,
|
|
\ 'abbr' : v:val.source_args . ' -- ' . v:val.context.input,
|
|
\ 'source__history' : v:val,
|
|
\}")
|
|
endfunction"}}}
|
|
|
|
" Actions "{{{
|
|
let s:source.action_table.start = {
|
|
\ 'description' : 'start sources',
|
|
\ 'is_start' : 1,
|
|
\ }
|
|
function! s:source.action_table.start.func(candidate) abort "{{{
|
|
let history = a:candidate.source__history
|
|
let history.context.split = unite#get_context().split
|
|
let history.context.no_split = 0
|
|
call unite#start(history.sources, history.context)
|
|
endfunction"}}}
|
|
"}}}
|
|
|
|
let &cpo = s:save_cpo
|
|
unlet s:save_cpo
|