• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision811895f5d5c90da38d80d9c7d2109b03521b5b40 (tree)
Time2023-05-04 21:24:26
Authorbadcoff33 <none@none>
Commiterbadcoff33

Log Message

RgFiles output to buffer

Change Summary

Incremental Difference

--- a/autoload/run.vim
+++ b/autoload/run.vim
@@ -79,39 +79,51 @@ export def CloseCb(ch: channel)
7979
8080 for d in g:run_dict
8181 if d.channel == ch_nr
82+
8283 if has_key(d, "timer")
8384 timer_stop(d.timer)
8485 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+
11187 if has_key(d, "winid")
11288 popup_close(d.winid)
11389 endif
11490
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+
115127 execute "silent bwipe" d.bufnr
116128
117129 try
@@ -156,8 +168,8 @@ def ConditionalWriteAll(dict: dict<any>)
156168 catch /.*/
157169 echomsg "No autowrite. Not all modified buffers written"
158170 ls +
159- finally
160- endtry
171+ finally
172+ endtry
161173 enddef
162174
163175 var indicator = ["-", "\\", "|", "/"]
@@ -263,6 +275,7 @@ def StartBuffered(dict: dict<any>): job
263275 run_dict_entry.callback = get(dict, "callback", "")
264276 run_dict_entry.started = localtime()
265277 run_dict_entry.timer = timer_start(333, RunJobMonitoringCb, {repeat: -1})
278+ run_dict_entry.name = get(dict, "name", "quickfix")
266279
267280 if has_key(dict, "no_popup") && (dict.no_popup == true)
268281 run_dict_entry.winid = 0
--- a/plugin/ripgrep.vim
+++ b/plugin/ripgrep.vim
@@ -43,7 +43,7 @@ enddef
4343 set grepprg=rg\ --vimgrep\ $*
4444 set grepformat=%f:%l:%c:%m
4545
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"})
4747 command! -complete=file -nargs=* Rg run.RunStart({cmd: 'rg --vimgrep ' .. ' <args> ' .. join(g:rg_paths, " "), regexp: &grepformat, no_popup: true})
4848
4949 nnoremap <Leader>F :RgFiles **<Left>