@@ -536,7 +536,11 @@ internal.oldfiles = function(opts)
536536 local current_file = vim .api .nvim_buf_get_name (current_buffer )
537537 local results = {}
538538
539- if utils .iswin then -- for slash problem in windows
539+ local function has_protocol (path )
540+ return string.match (path , " ^[A-z0-9]+://" )
541+ end
542+
543+ if utils .iswin and not has_protocol (current_file ) then -- for slash problem in windows
540544 current_file = current_file :gsub (" /" , " \\ " )
541545 end
542546
@@ -546,23 +550,26 @@ internal.oldfiles = function(opts)
546550 local open_by_lsp = string.match (buffer , " line 0$" )
547551 if match and not open_by_lsp then
548552 local file = vim .api .nvim_buf_get_name (match )
553+ local protocol = has_protocol (file )
549554 if utils .iswin then
550555 file = file :gsub (" /" , " \\ " )
551556 end
552- if vim .uv .fs_stat (file ) and match ~= current_buffer then
557+ if match ~= current_buffer and ( protocol or vim .uv .fs_stat (file )) then
553558 table.insert (results , file )
554559 end
555560 end
556561 end
557562 end
558563
559564 for _ , file in ipairs (vim .v .oldfiles ) do
565+ local protocol = has_protocol (file )
560566 if utils .iswin then
561567 file = file :gsub (" /" , " \\ " )
562568 end
563- local file_stat = vim .uv .fs_stat (file )
564- if file_stat and file_stat .type == " file" and not vim .tbl_contains (results , file ) and file ~= current_file then
565- table.insert (results , file )
569+ local file_stat = vim .loop .fs_stat (file )
570+ if ((file_stat and file_stat .type == " file" ) or (protocol and protocol ~= " file://" and protocol ~= " term://" )) and
571+ not vim .tbl_contains (results , file ) and file ~= current_file then
572+ table.insert (results , file )
566573 end
567574 end
568575
0 commit comments