error message issue

51 views
Skip to first unread message

shawn wilson

unread,
Aug 4, 2012, 4:50:20 PM8/4/12
to vim...@googlegroups.com
so, i go to open a file:
:o t2.pl
E37: No write since last change (add ! to override)

ok, fine:
:o! t2.pl
E477: No ! allowed

so, what is the issue and shouldn't the error be better / more descriptive?

--
Shawn Wilson
703-517-1201

Florian Rehnisch

unread,
Aug 4, 2012, 5:31:52 PM8/4/12
to vim...@googlegroups.com
On Sat, Aug 04, 2012 at 04:50:20PM -0400, shawn wilson wrote:
> so, i go to open a file:
> :o t2.pl
> E37: No write since last change (add ! to override)
>
> ok, fine:
> :o! t2.pl
> E477: No ! allowed
>
> so, what is the issue and shouldn't the error be better / more descriptive?

Yepp, there is an inconsitency between ":open! file" and
":visual! file"/":edit! file" (The latter two silently
drop your old changes).

In Joy's good old vi :open stood for something
completely different, namely switch to a mode
suited for really dumb terminals.

Vi clones don't have this open mode, so :open
was aliased to :visual in Vim.

But to implement the ! flag was forgotten, as
nearly everyone would use :edit to load
another file, I guess.

flori

Tony Mechelynck

unread,
Aug 5, 2012, 5:18:06 AM8/5/12
to vim...@googlegroups.com, Florian Rehnisch
There is no :open file, it's :open or :open /pattern/, to simulate
legacy Vi's command for going out of ex mode into open mode (in Vim:
into Normal mode): a rarely used command in Vim, except maybe for vi
old-timers. In no case does it open a new file. See :help :open

To open a file in a running Vim, there is:

:e[dit] file
open the new file in the current window

one of
:new file
:sp[lit] file
open the file in a new window in the current tab

one of
:tabnew file
:tabe[dit] file
:tab new file
:tab sp[lit] file
open the file in a new tab

or, in the same order but readonly
:vie[w] file " same window
:sv[iew] file " new window, same tab
:tab sv[iew] file " new tab

Don't type the brackets, of course: they are just there to show how far
the command names may be abbreviated.

Best regards,
Tony.
--
You know you've been spending too much time on the computer when your
friend misdates a check, and you suggest adding a "++" to fix it.

Christian Brabandt

unread,
Aug 5, 2012, 8:39:28 AM8/5/12
to vim...@googlegroups.com, vim-dev Mailingliste
Hi shawn!

On Sa, 04 Aug 2012, shawn wilson wrote:

> so, i go to open a file:
> :o t2.pl
> E37: No write since last change (add ! to override)
>
> ok, fine:
> :o! t2.pl
> E477: No ! allowed
>
> so, what is the issue and shouldn't the error be better / more descriptive?

Here is a patch, allowing :o!

diff --git a/src/ex_cmds.h b/src/ex_cmds.h
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -662,7 +662,7 @@
EX(CMD_nunmenu, "nunmenu", ex_menu,
EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
EX(CMD_open, "open", ex_open,
- RANGE|EXTRA),
+ RANGE|EXTRA|BANG),
EX(CMD_oldfiles, "oldfiles", ex_oldfiles,
BANG|TRLBAR|SBOXOK|CMDWIN),
EX(CMD_omap, "omap", ex_map,


regards,
Christian

Bram Moolenaar

unread,
Aug 5, 2012, 10:07:22 AM8/5/12
to shawn wilson, vim...@googlegroups.com

Shawn Wilson wrote:

> so, i go to open a file:
> :o t2.pl
> E37: No write since last change (add ! to override)
>
> ok, fine:
> :o! t2.pl
> E477: No ! allowed
>
> so, what is the issue and shouldn't the error be better / more descriptive?

Look up the help for :open and you will see that it's not acutally
supported. It's an outdated Vi command. Perhaps you want to use :edit ?

--
hundred-and-one symptoms of being an internet addict:
213. Your kids start referring to you as "that guy in front of the monitor."

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages