Friday, December 6, 2013

Re: :write with "&filetype" or other variables in ...

On 2013-12-06, dza wrote:
> On Friday, 6 December 2013 08:23:10 UTC+1, Gary Johnson wrote:
> > On 2013-12-05, dza wrote:
> >
> > > Hello guys.
> > >
> > > I need to assemble a :write line for a VimL/VimScript.
> > >
> > > I can use the expand modifiers yes %:t:r - but it doesn't give me
> > > a filetype in the case of ".vimrc" for example, so I need the
> > > variable to check whether it's set or not and put it at the end of
> > > the file.
> >
> > Something like this?
> > :exe 'w %:t:r'.&filetype
>
> Thank you so much :) I wonder where you found it, but it works
> flawlessly, and I can now upload snippets and get them in my
> clipboard by SHIFT-UU in visual block mode without any hassle :)

You're very welcome.

I learn a lot by reading this mailing list and by attempting to
answer some of the questions. Continual practice writing and
improving scripts helps, too. After a while, techniques like that
become something you just know.

Regards,
Gary

--
--
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.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment