Am 2014-03-12 23:01, schrieb Bram Moolenaar:
Christian Brabandt wrote:
On Mi, 12 Mär 2014, Liang Li wrote:
> The following happens to me in vim 7.4:
>
> :e bufA
> (modify bufA)
> :vsp "This works fine
> :vsp bufA "This will throw an E37 error
> :vsp! bufA "This will abandon changes and split the buffer, even though the
buffer is never hidden
>
> A minor thing but it seems unexpected. If I do this from a different split,
':vsp bufA' works as expected, eg:
>
> :e bufA
> (modify bufA)
> :vsp bufB
> :vsp bufA "works fine
>
> This mostly arises as an issue during scripting.
I think, this patch fixes it:
[...]
This would need a better check for the argument being equal to the
current file name. Or perhaps any loaded buffer name.
This also needs documenting. Especially that ":sp bufA" does not
reload
while ":sp bufB" does, if bufB is open in another window.
On the other hand, this behavior change might cause trouble for those
who depend on the buffer being reloaded.
Attached is an updated patch, including update to the documentation.
Best,
Christian
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt
--- a/runtime/doc/windows.txt
+++ b/runtime/doc/windows.txt
@@ -132,13 +132,17 @@
CTRL-W s *CTRL-W_s*
CTRL-W S *CTRL-W_S*
CTRL-W CTRL-S *CTRL-W_CTRL-S*
-:[N]sp[lit] [++opt] [+cmd] *:sp* *:split*
+:[N]sp[lit] [++opt] [+cmd] [file] *:sp* *:split*
Split current window in two. The result is two viewports on
the same file. Make new window N high (default is to use half
the height of the current window). Reduces the current window
height to create room (and others, if the 'equalalways' option
is set, 'eadirection' isn't "hor", and one of them is higher
than the current or the new window).
+ If [file] is given and it is not loaded in any buffer, it will
+ be opened from disc, else it will open the already loaded
+ buffer.
+
Note: CTRL-S does not work on all terminals and might block
further input, use CTRL-Q to get going again.
Also see |++opt| and |+cmd|.
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -7903,7 +7903,7 @@
&& eap->cmdidx != CMD_vsplit
#endif
)
- || *eap->arg != NUL
+ || (*eap->arg != NUL && buflist_findname_exp(eap->arg) == NULL)
#ifdef FEAT_BROWSE
|| cmdmod.browse
#endif
@@ -7976,6 +7976,8 @@
}
else
{
+ if (eap->arg != NULL)
+ goto_buffer(eap, DOBUF_CURRENT, FORWARD, 0);
if (eap->do_ecmd_cmd != NULL)
do_cmdline_cmd(eap->do_ecmd_cmd);
#ifdef FEAT_TITLE