Просмотр исходного кода

Reuse the current tab if it contains a single new unmodified file.
With this, we can just open vim like a regular text editor and open past
files from the MRU menu. The default tab with "no name" file will be
overwritten if it is unmodified.

Anish Sane 5 лет назад
Родитель
Сommit
b9e9b7f4fa
1 измененных файлов с 7 добавлено и 3 удалено
  1. 7 3
      plugin/mru.vim

+ 7 - 3
plugin/mru.vim

@@ -316,9 +316,13 @@ func! s:MRU_Open_File_In_Tab(fname, esc_fname) abort
 	    " Goto the tab containing the file
 	    exe 'tabnext ' . i
 	else
-	    " Open a new tab as the last tab page
-	    tablast
-	    exe 'tabnew ' . a:esc_fname
+        if (winnr("$") == 1) && (bufname("") == "") && !&modified
+            exe 'e ' . a:esc_fname
+        else
+            " Open a new tab as the last tab page
+            tablast
+            exe 'tabnew ' . a:esc_fname
+        endif
 	endif
     endif