Revision | 811895f5d5c90da38d80d9c7d2109b03521b5b40 (tree) |
---|---|
Time | 2023-05-04 21:24:26 |
Author | badcoff33 <none@none> |
Commiter | badcoff33 |
RgFiles output to buffer
@@ -79,39 +79,51 @@ export def CloseCb(ch: channel) | ||
79 | 79 | |
80 | 80 | for d in g:run_dict |
81 | 81 | if d.channel == ch_nr |
82 | + | |
82 | 83 | if has_key(d, "timer") |
83 | 84 | timer_stop(d.timer) |
84 | 85 | endif |
85 | - setqflist([], " ", { | |
86 | - efm: d.regexp, | |
87 | - title: d.full_cmd, | |
88 | - lines: getbufline(d.bufnr, 1, "$") | |
89 | - }) | |
90 | - for e in getqflist({ "nr": "$", "all": 0 }).items | |
91 | - lines = lines + 1 | |
92 | - warnings += e.type ==? "w" ? 1 : 0 | |
93 | - errors += e.type ==? "e" ? 1 : 0 | |
94 | - endfor | |
95 | - UpdatePopupPosition() | |
96 | - var done_str = printf("%s took %dsec | %d lines", | |
97 | - d.short_cmd, | |
98 | - localtime() - d.started, | |
99 | - lines) | |
100 | - if warnings == 1 | |
101 | - done_str ..= printf(" | %d warning", warnings) | |
102 | - elseif warnings > 1 | |
103 | - done_str ..= printf(" | %d warnings", warnings) | |
104 | - endif | |
105 | - if errors == 1 | |
106 | - done_str ..= printf(" | %d error", errors) | |
107 | - elseif errors > 1 | |
108 | - done_str ..= printf(" | %d errors", errors) | |
109 | - endif | |
110 | - popup_create(done_str, g:WinoptsDone()) | |
86 | + | |
111 | 87 | if has_key(d, "winid") |
112 | 88 | popup_close(d.winid) |
113 | 89 | endif |
114 | 90 | |
91 | + if d.name == "quickfix" | |
92 | + setqflist([], " ", { | |
93 | + efm: d.regexp, | |
94 | + title: d.full_cmd, | |
95 | + lines: getbufline(d.bufnr, 1, "$") | |
96 | + }) | |
97 | + for e in getqflist({ "nr": "$", "all": 0 }).items | |
98 | + lines = lines + 1 | |
99 | + warnings += e.type ==? "w" ? 1 : 0 | |
100 | + errors += e.type ==? "e" ? 1 : 0 | |
101 | + endfor | |
102 | + | |
103 | + var done_str = printf("%s took %dsec | %d lines", | |
104 | + d.short_cmd, | |
105 | + localtime() - d.started, | |
106 | + lines) | |
107 | + if warnings == 1 | |
108 | + done_str ..= printf(" | %d warning", warnings) | |
109 | + elseif warnings > 1 | |
110 | + done_str ..= printf(" | %d warnings", warnings) | |
111 | + endif | |
112 | + if errors == 1 | |
113 | + done_str ..= printf(" | %d error", errors) | |
114 | + elseif errors > 1 | |
115 | + done_str ..= printf(" | %d errors", errors) | |
116 | + endif | |
117 | + UpdatePopupPosition() | |
118 | + popup_create(done_str, g:WinoptsDone()) | |
119 | + else | |
120 | + var b = bufadd(d.name) | |
121 | + execute "drop" d.name | |
122 | + setline(line("$") + 1, [d.full_cmd] + getbufline(d.bufnr, 1, "$")) | |
123 | + setlocal buftype=nofile nomodified | |
124 | + | |
125 | + endif | |
126 | + | |
115 | 127 | execute "silent bwipe" d.bufnr |
116 | 128 | |
117 | 129 | try |
@@ -156,8 +168,8 @@ def ConditionalWriteAll(dict: dict<any>) | ||
156 | 168 | catch /.*/ |
157 | 169 | echomsg "No autowrite. Not all modified buffers written" |
158 | 170 | ls + |
159 | - finally | |
160 | - endtry | |
171 | + finally | |
172 | + endtry | |
161 | 173 | enddef |
162 | 174 | |
163 | 175 | var indicator = ["-", "\\", "|", "/"] |
@@ -263,6 +275,7 @@ def StartBuffered(dict: dict<any>): job | ||
263 | 275 | run_dict_entry.callback = get(dict, "callback", "") |
264 | 276 | run_dict_entry.started = localtime() |
265 | 277 | run_dict_entry.timer = timer_start(333, RunJobMonitoringCb, {repeat: -1}) |
278 | + run_dict_entry.name = get(dict, "name", "quickfix") | |
266 | 279 | |
267 | 280 | if has_key(dict, "no_popup") && (dict.no_popup == true) |
268 | 281 | run_dict_entry.winid = 0 |
@@ -43,7 +43,7 @@ enddef | ||
43 | 43 | set grepprg=rg\ --vimgrep\ $* |
44 | 44 | set grepformat=%f:%l:%c:%m |
45 | 45 | |
46 | -command! -complete=file -nargs=* RgFiles run.RunStart({cmd: "rg --files" .. g:RgGlobSwitch() .. join(split('<args>', " "), g:RgGlobSwitch() ), regexp: "%f"}) | |
46 | +command! -complete=file -nargs=* RgFiles run.RunStart({cmd: "rg --files" .. g:RgGlobSwitch() .. join(split('<args>', " "), g:RgGlobSwitch() ), name: "RgFiles"}) | |
47 | 47 | command! -complete=file -nargs=* Rg run.RunStart({cmd: 'rg --vimgrep ' .. ' <args> ' .. join(g:rg_paths, " "), regexp: &grepformat, no_popup: true}) |
48 | 48 | |
49 | 49 | nnoremap <Leader>F :RgFiles **<Left> |