> Chaps,
>
> Check this out - going from emacs to vim, (again) as emacs' keybindings
> are a pain on a mac book pro.
>
> There must be a way to have vim create a scratch buffer on start up.
>
It depends what you call a scratch buffer.
If not given a file name, Vim will start with one unnamed buffer,
displaying [No Name] on its statusline and/or tab label (if displayed).
If you modify that buffer, don't give it a name, and try to exit Vim by
e.g. ":q" without an exclamation mark, Vim will give an error. You then
have several choices:
:saveas /some/path/to/foobar.txt
giving the buffer a name and saving it
or
:setlocal buftype=nofile
telling Vim that there is no file for this buffer, which
shall not be written
(Note: :setlocal is important, otherwise every buffer newly
created thereafter will IIUC also have 'nofile' set)
or
:q!
quitting the buffer (and Vim if the only non-help
buffer) without saving
or
:enew!
clearing the buffer without saving, replacing it by
a new empty [NoName] buffer; Vim is not quit
If you want to start Vim with one buffer which shall never be written,
you can use
vim -c 'setl bt=nofile'
with or without a buffer name on the command-line. If you give a buffer
name and the file exists, it will be read in, but any changes you make
won't be recorded on disk (they won't set 'modified' and Vim will
|abandon| the file with no second thoughts if you :quit).
Best regards,
Tony.
--
Vail's Second Axiom:
The amount of work to be done increases in proportion to the
amount of work already completed.
--
You received this message from the "vim_use" 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
No comments:
Post a Comment