diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-02-09 02:19:17 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-02-09 02:19:17 -0500 |
commit | 25a70469f4b1bae0cb7b152bccae4dd3ea346277 (patch) | |
tree | 6549875ed0df6b67fcad9c7611a8d131fd1e070a /src/nvim/buffer.c | |
parent | 6fbb9ceb5e123cef5a3a8f1bcf48e05a62749bba (diff) | |
parent | bf6c5bc225654f52022ef5c02684cc4e25d32200 (diff) | |
download | rneovim-25a70469f4b1bae0cb7b152bccae4dd3ea346277.tar.gz rneovim-25a70469f4b1bae0cb7b152bccae4dd3ea346277.tar.bz2 rneovim-25a70469f4b1bae0cb7b152bccae4dd3ea346277.zip |
Merge pull request #4187 from watiko/vim-7.4.742
vim-patch:7.4.742
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index f56c64f109..9806623433 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); } } |