scriptencoding utf-8 function! unite#sources#quickfix#define() return s:source endfunction let s:source = { \ "name" : "quickfix", \ "description" : "output quickfix", \ "syntax" : "uniteSource__QuickFix", \ "hooks" : {}, \ "converters" : "converter_quickfix_default" \} function! s:qflist_to_unite(val) let bufnr = a:val.bufnr let fname = bufnr == 0 ? "" : bufname(bufnr) let line = bufnr == 0 ? 0 : a:val.lnum return extend({ \ "source": "quickfix", \ "kind": a:val.valid ? ["common", "jump_list"] : ["common"], \ "action__line" : line, \ "action__pattern" : a:val.pattern, \ "action__quickfix_val" : a:val, \ "action__quickfix_type" : "quickfix", \ }, \ (!filereadable(fname) ? { "action__buffer_nr" : bufnr } : { "action__path" : fname }), \ ) endfunction function! unite#sources#quickfix#get_quickfix_title(...) let tabnr = tabpagenr() let is_location_list = get(a:, 1, 0) let result = "" try noautocmd tabnew silent! execute "noautocmd" is_location_list ? "lopen" : "copen" silent! let result = w:quickfix_title finally execute "noautocmd" is_location_list ? "lclose" : "cclose" noautocmd bdelete execute "tabnext" tabnr endtry return result endfunction function! s:source.gather_candidates(args, context) call unite#print_source_message(strtrans(unite#sources#quickfix#get_quickfix_title()), "quickfix") let qfolder = empty(a:args) ? 0 : a:args[0] if qfolder == 0 return map(getqflist(), "s:qflist_to_unite(v:val)") else try execute "colder" qfolder return map(getqflist(), "s:qflist_to_unite(v:val)") finally execute "cnewer" qfolder endtry endif endfunction function! unite#sources#quickfix#color_tag_syntax(name, first, last) " syntax match uniteSource__QuickFix_Bold /|B>.*' contained conceal " syntax match uniteSource__QuickFix_BoldHiddenEnd '", "", "", "E|", "|E<") highlight default link uniteSource__QuickFix_Error UniteQuickFixError call unite#sources#quickfix#color_tag_syntax("Warning", ">W|", "|W<") highlight default link uniteSource__QuickFix_Warning UniteQuickFixWarning let marked_icon = unite#util#escape_pattern(a:context.marked_icon) call s:highlighter.add("uniteMarkedLine", "uniteMarkedLine", '^' . marked_icon . '.*$', 5) call unite#sources#quickfix#highlight_enable() endfunction function! s:source.hooks.on_syntax(args, context) call unite#sources#quickfix#hl_candidates(a:context) let self.source__old_concealcursor = &l:concealcursor setlocal concealcursor=incv endfunction function! s:source.hooks.on_close(args, context) if &l:concealcursor == "incv" && exists("self.source__old_concealcursor") let &l:concealcursor = self.source__old_concealcursor endif call unite#sources#quickfix#highlight_disable() endfunction if expand("%:p") == expand(":p") call unite#define_source(s:source) endif