The command is :write, abbreviated :w. You can read about it and
its variations here:
:help save-file
To quit, or to write and quit, see the commands here:
:help write-quit
Regards,
Gary
First, this is probably the wrong place to ask that.
Second, I advise you to go through the vimtutor first...
:wq
:help write-quit
HTH,
Tony.
--
"There was an interesting development in the CBS-Westmoreland trial:
both sides agreed that after the trial, Andy Rooney would be allowed to
talk to the jury for three minutes about little things that annoyed him
during the trial."
-- David Letterman
On Mi, 08 Jun 2011, urbanpcguru wrote:
> I can open vim with sudo vim /etc/hosts for example.. But how do I
> save and close it? I can't seem to find the answer to this
> anywhere!? Why would one easy question be so freaking hard to
> find??!!!
Because you are using the one and only true editor. We don't want, that
anybody simply can use our editor. After all, we don't provide
documentation or man pages, have no wiki don't distribute plugins and of
course won't answer questions. Drat, how did you even find our mailing
list?
> How do I save a file? <--- Is this too easy a question to be
> answered? I have been driven mad for 3 hours trying to find this one
> simple thing!!
Yes, this is too easy. Remember, you are using an editor, not a saver.
We don't save our files, we edit them! But here is a trick, you can use
to convince vim to save your file:
:w !tee %
to save and quit, we use:
:exe 'w !tee %' | exe '!kill -9' getpid()
I've heard, some people have mapped the former to :w and the latter to
:wq but that must be rumours, after all this is the true editor. There
is no easier way to do what you want than using it's builtin functions.
SCNR,
Christian
The same way you close it when you run it without sudo!
> I can't seem to find the answer to this
> anywhere!?
Most people here did find the answer somewhere.
> Why would one easy question be so freaking hard to
> find??!!!
What if that question was, in fact, "freaking easy"?
> How do I save a file? <--- Is this too easy a question to be
> answered?
I don't know. What about asking politely before asking angrily?
> I have been driven mad for 3 hours trying to find this one
> simple thing!!
> please
http://lmgtfy.com/?q=vim+save+and+quit
My pleasure.
P!
--
Français, English, 日本語, 한국어
Wow! Christian, you're a genius! It might even work. But maybe not on
Windows (or have the "tee and "kill" commands been added since I left?).
Best regards,
Tony.
--
Man is the only animal that blushes -- or needs to.
-- Mark Twain
On Do, 09 Jun 2011, Tony Mechelynck wrote:
> On 09/06/11 09:07, Christian Brabandt wrote:
> [...]
> >to save and quit, we use:
> >
> >:exe 'w !tee %' | exe '!kill -9' getpid()
> [...]
>
> Wow! Christian, you're a genius! It might even work. But maybe not
> on Windows (or have the "tee and "kill" commands been added since I
> left?).
Yeah, I haven't mastered the one and only editor on Windows yet.
regards,
Christian
在 2011-6-10 上午2:57,"Tony Mechelynck" <antoine.m...@gmail.com>写道:
>
> On 09/06/11 09:07, Christian Brabandt wrote:
> [...]
>
>> to save and quit, we use:
>>
>> :exe 'w !tee %' | exe '!kill -9' getpid()
>
> [...]
>
> Wow! Christian, you're a genius! It might even work. But maybe not on Windows (or have the "tee and "kill" commands been added since I left?).
>
And windows doesn't have sudo yet :)
> Best regards,
> Tony.
> --
> Man is the only animal that blushes -- or needs to.
> -- Mark Twain
>
>
> --
> 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