File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ local default_config = {
2626 -- Should write to a file
2727 use_file = true ,
2828
29+ -- Should write to the quickfix list
30+ use_quickfix = false ,
31+
2932 -- Any messages above this level will be logged.
3033 level = p_debug and " debug" or " info" ,
3134
@@ -137,6 +140,19 @@ log.new = function(config, standalone)
137140 fp :write (str )
138141 fp :close ()
139142 end
143+
144+ -- Output to quickfix
145+ if config .use_quickfix then
146+ local formatted_msg = string.format (" [%s] %s" , nameupper , msg )
147+ local qf_entry = {
148+ -- remove the @ getinfo adds to the file path
149+ filename = info .source :sub (2 ),
150+ lnum = info .currentline ,
151+ col = 1 ,
152+ text = formatted_msg ,
153+ }
154+ vim .fn .setqflist ({ qf_entry }, " a" )
155+ end
140156 end
141157
142158 for i , x in ipairs (config .modes ) do
You can’t perform that action at this time.
0 commit comments