Skip to content

Instantly share code, notes, and snippets.

@tyru
Created April 20, 2018 15:04
Show Gist options
  • Select an option

  • Save tyru/c421b61929c6e7e221cbef2984b7ecff to your computer and use it in GitHub Desktop.

Select an option

Save tyru/c421b61929c6e7e221cbef2984b7ecff to your computer and use it in GitHub Desktop.
:ImportQF to import the output of shell command as quickfix-list or location-list
command! -nargs=+ -complete=shellcmd ImportQF call s:import_qf(<q-args>, -1)
command! -nargs=+ -complete=shellcmd LImportQF call s:import_qf(<q-args>, winnr())
function! s:import_qf(shellcmd, winnr) abort
if a:winnr >=# 0
call setloclist(
\ a:winnr, [], 'r', {'lines': systemlist(a:shellcmd)}
\)
else
call setqflist(
\ [], 'r', {'lines': systemlist(a:shellcmd)}
\)
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment