Created
April 20, 2018 15:04
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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