diff src/buffer.c @ 6843:50cdebea094f v7.4.742

patch 7.4.742 Problem: Cannot specify a vertical split when loading a buffer for a quickfix command. Solution: Add the "vsplit" value to 'switchbuf'. (Brook Hong)
author Bram Moolenaar <bram@vim.org>
date Fri, 19 Jun 2015 14:41:49 +0200
parents 97cc4ee3e095
children 62ba356c2d4e
line wrap: on
line diff
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2071,17 +2071,21 @@ buflist_getfile(n, lnum, options, forcei
 	 * "buf" if one exists */
 	if (swb_flags & SWB_USEOPEN)
 	    wp = buf_jump_open_win(buf);
+
 	/* If 'switchbuf' contains "usetab": jump to first window in any tab
 	 * page containing "buf" if one exists */
 	if (wp == NULL && (swb_flags & SWB_USETAB))
 	    wp = buf_jump_open_tab(buf);
-	/* If 'switchbuf' contains "split" or "newtab" and the current buffer
-	 * isn't empty: open new window */
-	if (wp == NULL && (swb_flags & (SWB_SPLIT | SWB_NEWTAB)) && !bufempty())
+
+	/* If 'switchbuf' contains "split", "vsplit" or "newtab" and the
+	 * current buffer isn't empty: open new tab or window */
+	if (wp == NULL && (swb_flags & (SWB_VSPLIT | SWB_SPLIT | SWB_NEWTAB))
+							       && !bufempty())
 	{
-	    if (swb_flags & SWB_NEWTAB)		/* Open in a new tab */
+	    if (swb_flags & SWB_NEWTAB)
 		tabpage_new();
-	    else if (win_split(0, 0) == FAIL)	/* Open in a new window */
+	    else if (win_split(0, (swb_flags & SWB_VSPLIT) ? WSP_VERT : 0)
+								      == FAIL)
 		return FAIL;
 	    RESET_BINDING(curwin);
 	}