diff options
author | watiko <service@mail.watiko.net> | 2016-02-07 17:28:54 +0900 |
---|---|---|
committer | watiko <service@mail.watiko.net> | 2016-02-07 17:54:37 +0900 |
commit | ba8ec7e963d944f6acbc2983db24144d63939b85 (patch) | |
tree | dc192fdcaee253dfcc0aff37276b34e955eadc18 | |
parent | 827e267800417b8fdd1340d54f5dc5fa9d81bb92 (diff) | |
download | rneovim-ba8ec7e963d944f6acbc2983db24144d63939b85.tar.gz rneovim-ba8ec7e963d944f6acbc2983db24144d63939b85.tar.bz2 rneovim-ba8ec7e963d944f6acbc2983db24144d63939b85.zip |
vim-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)
https://github.com/vim/vim/commit/a594d77ffcccf2ac0e4079c41342ca55d4c9bb08
-rw-r--r-- | runtime/doc/options.txt | 1 | ||||
-rw-r--r-- | src/nvim/buffer.c | 29 | ||||
-rw-r--r-- | src/nvim/option_defs.h | 3 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
4 files changed, 22 insertions, 13 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 51bfc12f9d..d8d8caef56 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -6177,6 +6177,7 @@ A jump table for the options with a short description can be found at |Q_op|. split If included, split the current window before loading a buffer for a |quickfix| command that display errors. Otherwise: do not split, use current window. + vsplit Just like "split" but split vertically. newtab Like "split", but open a new tab page. Overrules "split" when both are present. diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 34e24712cd..0883ee93b8 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1601,21 +1601,28 @@ int buflist_getfile(int n, linenr_T lnum, int options, int forceit) col = 0; if (options & GETF_SWITCH) { - /* If 'switchbuf' contains "useopen": jump to first window containing - * "buf" if one exists */ - if (swb_flags & SWB_USEOPEN) + // If 'switchbuf' contains "useopen": jump to first window containing + // "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)) + } + + // 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 (swb_flags & SWB_NEWTAB) /* Open in a new tab */ + } + + // 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) { 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); } } diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 11b5e31f77..d37b15b142 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -571,12 +571,13 @@ EXTERN char_u *p_su; // 'suffixes' EXTERN char_u *p_swb; // 'switchbuf' EXTERN unsigned swb_flags; #ifdef IN_OPTION_C -static char *(p_swb_values[]) = {"useopen", "usetab", "split", "newtab", NULL}; +static char *(p_swb_values[]) = {"useopen", "usetab", "split", "newtab", "vsplit", NULL}; #endif #define SWB_USEOPEN 0x001 #define SWB_USETAB 0x002 #define SWB_SPLIT 0x004 #define SWB_NEWTAB 0x008 +#define SWB_VSPLIT 0x010 EXTERN int p_tbs; /* 'tagbsearch' */ EXTERN long p_tl; /* 'taglength' */ EXTERN int p_tr; /* 'tagrelative' */ diff --git a/src/nvim/version.c b/src/nvim/version.c index 026eab46d0..7d03969d81 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -546,7 +546,7 @@ static int included_patches[] = { 745, // 744 NA // 743, - // 742, + 742, 741, 740, 739, |