@@ -532,7 +532,11 @@ internal.oldfiles = function(opts)
532532 local current_file = vim .api .nvim_buf_get_name (current_buffer )
533533 local results = {}
534534
535- if utils .iswin then -- for slash problem in windows
535+ local function has_protocol (path )
536+ return string.match (path , " ^[A-z0-9]+://" )
537+ end
538+
539+ if utils .iswin and not has_protocol (current_file ) then -- for slash problem in windows
536540 current_file = current_file :gsub (" /" , " \\ " )
537541 end
538542
@@ -542,23 +546,27 @@ internal.oldfiles = function(opts)
542546 local open_by_lsp = string.match (buffer , " line 0$" )
543547 if match and not open_by_lsp then
544548 local file = vim .api .nvim_buf_get_name (match )
549+ local protocol = has_protocol (file )
545550 if utils .iswin then
546551 file = file :gsub (" /" , " \\ " )
547552 end
548- if vim .loop .fs_stat (file ) and match ~= current_buffer then
553+
554+ if match ~= current_buffer and (protocol or vim .uv .fs_stat (file )) then
549555 table.insert (results , file )
550556 end
551557 end
552558 end
553559 end
554560
555561 for _ , file in ipairs (vim .v .oldfiles ) do
562+ local protocol = has_protocol (file )
556563 if utils .iswin then
557564 file = file :gsub (" /" , " \\ " )
558565 end
559566 local file_stat = vim .loop .fs_stat (file )
560- if file_stat and file_stat .type == " file" and not vim .tbl_contains (results , file ) and file ~= current_file then
561- table.insert (results , file )
567+ if ((file_stat and file_stat .type == " file" ) or (protocol and protocol ~= " file://" and protocol ~= " term://" )) and
568+ not vim .tbl_contains (results , file ) and file ~= current_file then
569+ table.insert (results , file )
562570 end
563571 end
564572
0 commit comments