Thursday, December 10, 2020

Re: Vim-script question

On Thu, Dec 10, 2020 at 6:01 PM 'Klaus Jantzen' via vim_use
<vim_use@googlegroups.com> wrote:
>
> Hi,
>
> I want to include in my .vimrc an autocommand that writes some new lines
> into an empty file e.g. an zsh script.
>
> So I wrote
>
> au BufNewFile *.zsh :a "#! /usr/bin/zsh"
>
> but that does not do what I want (it does not do anything).
>
> So my question: How can I write with the autocommand one or more lines
> into an empty buffer?
>
> Thanks for your help.

:append is for several lines of text and (IIUC) needs an end-of-text
line. What you want here is :put

For instance:

:au BufNewFile *.zsh 0put ="#! /usr/bin/zsh"

See
:help :put
:help "=

Best regards,
Tony.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXsHRAcCjYXN30YCjD_-80MOqkV2xhQPpk4gapaXvHg3wQ%40mail.gmail.com.

No comments:

Post a Comment