Răsfoiți Sursa

Fix error with older versions of Vim

Yegappan Lakshmanan 4 ani în urmă
părinte
comite
54a5b06b0c
3 a modificat fișierele cu 13 adăugiri și 4 ștergeri
  1. 1 1
      doc/mru.txt
  2. 7 3
      plugin/mru.vim
  3. 5 0
      test/unit_tests.vim

+ 1 - 1
doc/mru.txt

@@ -2,7 +2,7 @@
 
 Author: Yegappan Lakshmanan  (yegappan AT yahoo DOT com)
 For Vim version 7.0 and above
-Last change: Jan 30, 2021
+Last change: Feb 1, 2021
 
 ==============================================================================
 						*mru-license*

+ 7 - 3
plugin/mru.vim

@@ -1,7 +1,7 @@
 " File: mru.vim
 " Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
-" Version: 3.9.3
-" Last Modified: Jan 30, 2021
+" Version: 3.10
+" Last Modified: Feb 1, 2021
 " Copyright: Copyright (C) 2003-2021 Yegappan Lakshmanan
 " License:   Permission is hereby granted to use and distribute this code,
 "            with or without modifications, provided that this copyright
@@ -322,7 +322,11 @@ func! s:MRU_Open_File_In_Tab(fname, esc_fname) abort
 	    exe 'e ' . a:esc_fname
 	  else
 	    " Open a new tab as the last tab page
-	    exe '$tabnew ' . a:esc_fname
+	    if v:version >= 800
+	      exe '$tabnew ' . a:esc_fname
+	    else
+	      exe '99999tabnew ' . a:esc_fname
+	    endif
 	  endif
 	endif
     endif

+ 5 - 0
test/unit_tests.vim

@@ -1180,6 +1180,10 @@ endfunc
 " Using a command modifier with the MRU command to open the MRU window
 " ==========================================================================
 func Test_42()
+  if v:version < 800
+    " The <mods> command modifier is supported only by Vim 8.0 and above
+    return
+  endif
   let test_name = 'test42'
   enew | only
   topleft MRU
@@ -1301,6 +1305,7 @@ let s:tests = split(substitute(@q, '\(function\) \(\k*()\)', '\2', 'g'))
 
 " Run the tests
 set nomore
+set debug=beep
 for one_test in sort(s:tests)
   exe 'call ' . one_test
 endfor