Sunday, January 31, 2010

Re: concatenate with '.' or without

On 2010-01-30, Bee wrote:
> On Jan 29, 10:52 am, "Benjamin R. Haskell" <v...@benizi.com> wrote:
> > On Fri, 29 Jan 2010, Bee wrote:
> > > On Jan 29, 7:43 am, "Benjamin R. Haskell" <v...@benizi.com> wrote:
> > > > ...
> > > > :redir @a
> > > > ...
> > > How to save directly to a filename?
> > > [...]
> > > But this creates a file named savevimrc in $HOME
> > > redir > savevimrc
> > > How to expand savevimrc to the file name?
> > :exe "redir > " . savevimrc
>
> Will this always do the same?
> :exe "redir >" savevimrc

Yes.

> From what I have read '.' concatenates without adding spaces,
> whereas without using '.' a space will be added.

'.' is an expression operator and will concatenate two strings in a
context where an expression is allowed. Not having to use a '.'
between arguments of an exe command is a property of the exe
command, which concatenates all of its arguments with intervening
spaces.

> Is it just better to get the habit of using '.' ?

No, not if you're paying attention to the context in which you're
concatenating strings. I prefer not to use the '.' in exe arguments
if I can avoid it because it looks less cluttered.

Now that I look at them, the examples under ":help :exe" are
confusing. The first two examples include spaces after the executed
command names even though none are needed there.

Regards,
Gary


--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment