Skip to content

Instantly share code, notes, and snippets.

@tenfyzhong
Created July 10, 2017 10:47
Show Gist options
  • Save tenfyzhong/951d60f9520bc5982b85a51d6ed28a3c to your computer and use it in GitHub Desktop.
Save tenfyzhong/951d60f9520bc5982b85a51d6ed28a3c to your computer and use it in GitHub Desktop.
function! s:to_qf()
redir => output
silent messages
redir END
let contents = split(output, '\n')
" echom 'contents: ' . output
" call setqflist(contents)
let qflist = []
let bufnr = bufnr('%')
for c in contents
if c !~# 'E\d\+'
continue
endif
let item = {'bufnr': bufnr, 'lnum': 0, 'text': c}
call add(qflist, item)
endfor
let winnr = winnr()
call setloclist(winnr, qflist)
endfunction
command! ToQf call <SID>to_qf()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment