Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

You have a massage (from the Swedish prime minister).


devel / comp.unix.shell / Re: VIM question - string concatenation

SubjectAuthor
* VIM question - string concatenationKenny McCormack
+* Re: VIM question - string concatenationTom Furie
|+* Re: VIM question - string concatenationKenny McCormack
||`- Re: VIM question - string concatenationTom Furie
|`* Re: VIM question - string concatenationKaz Kylheku
| `* Re: VIM question - string concatenationKenny McCormack
|  `- Re: VIM question - string concatenationKaz Kylheku
+- Re: VIM question - string concatenationTom Furie
+- Re: VIM question - string concatenationmarrgol
+- Re: VIM question - string concatenationmarrgol
+- Re: VIM question - string concatenationOnorio Catenacci
`- Re: VIM question - string concatenationStan Brown

1
VIM question - string concatenation

<uk79sl$47tk$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6792&group=comp.unix.shell#6792

  copy link   Newsgroups: comp.unix.shell comp.editors
Path: i2pn2.org!i2pn.org!news.bbs.nz!csiph.com!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell,comp.editors
Subject: VIM question - string concatenation
Date: Wed, 29 Nov 2023 12:13:09 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <uk79sl$47tk$1@news.xmission.com>
Injection-Date: Wed, 29 Nov 2023 12:13:09 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="139188"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Wed, 29 Nov 2023 12:13 UTC

Note: Normally, I would post this (only) to comp.editors, but (at least on
my server) comp.editors is destroyed by the Google spam and is unusable.
So, if you respond (post) to comp.editors (only), I won't see it. I am
reading/posting only via the "shell" group.

In VIM, if you do: :echo 'this is a test' strftime('%c')
you get: this is a test Wed ...

I.e., it concats the strings together, but with a space between. Removing
the space from the command line: :echo 'this is a test'strftime('%c')
does not help. It still concats with a space.

Is there a way to concat without the space?

Note: I would normally try to look this up in the VIM help, but it is hard
to search for stuff related to the basic syntax of the language. What
would you search on?

--
The key difference between faith and science is that in science, evidence that
doesn't fit the theory tends to weaken the theory (that is, make it less likely to
be believed), whereas in faith, contrary evidence just makes faith stronger (on
the assumption that Satan is testing you - trying to make you abandon your faith).

Re: VIM question - string concatenation

<uk7aq9$i4p$1@freeq.furie.org.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6793&group=comp.unix.shell#6793

  copy link   Newsgroups: comp.unix.shell comp.editors
Path: i2pn2.org!i2pn.org!news.furie.org.uk!.POSTED.2001:470:1ae8:50:6efa:a7ff:fe34:284e!not-for-mail
From: tom...@furie.org.uk (Tom Furie)
Newsgroups: comp.unix.shell,comp.editors
Subject: Re: VIM question - string concatenation
Date: Wed, 29 Nov 2023 12:29:02 +0000
Organization: Little to None
Message-ID: <uk7aq9$i4p$1@freeq.furie.org.uk>
References: <uk79sl$47tk$1@news.xmission.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: freeq.furie.org.uk; posting-host="2001:470:1ae8:50:6efa:a7ff:fe34:284e";
logging-data="18585"; mail-complaints-to="usenet@furie.org.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
 by: Tom Furie - Wed, 29 Nov 2023 12:29 UTC

gazelle@shell.xmission.com (Kenny McCormack) writes:

> In VIM, if you do: :echo 'this is a test' strftime('%c')
> you get: this is a test Wed ...
>
> Is there a way to concat without the space?

According to ':h echo' in vim, each expression is printed with a space
between, so it doesn't look like it.

Re: VIM question - string concatenation

<uk7avd$i4p$2@freeq.furie.org.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6794&group=comp.unix.shell#6794

  copy link   Newsgroups: comp.unix.shell comp.editors
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!usenet.goja.nl.eu.org!news.furie.org.uk!.POSTED.2001:470:1ae8:50:6efa:a7ff:fe34:284e!not-for-mail
From: tom...@furie.org.uk (Tom Furie)
Newsgroups: comp.unix.shell,comp.editors
Subject: Re: VIM question - string concatenation
Date: Wed, 29 Nov 2023 12:31:54 +0000
Organization: Little to None
Message-ID: <uk7avd$i4p$2@freeq.furie.org.uk>
References: <uk79sl$47tk$1@news.xmission.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: freeq.furie.org.uk; posting-host="2001:470:1ae8:50:6efa:a7ff:fe34:284e";
logging-data="18585"; mail-complaints-to="usenet@furie.org.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
 by: Tom Furie - Wed, 29 Nov 2023 12:31 UTC

gazelle@shell.xmission.com (Kenny McCormack) writes:

> In VIM, if you do: :echo 'this is a test' strftime('%c')
> you get: this is a test Wed ...
>
> Is there a way to concat without the space?

You could try ':echon', though...

Re: VIM question - string concatenation

<uk7bgg$rb16$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6795&group=comp.unix.shell#6795

  copy link   Newsgroups: comp.unix.shell comp.editors
Path: i2pn2.org!i2pn.org!news.niel.me!news.gegeweb.eu!gegeweb.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: marr...@address.invalid (marrgol)
Newsgroups: comp.unix.shell,comp.editors
Subject: Re: VIM question - string concatenation
Date: Wed, 29 Nov 2023 13:40:48 +0100
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <uk7bgg$rb16$1@dont-email.me>
References: <uk79sl$47tk$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 29 Nov 2023 12:40:48 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="cf0b0a85d3999bac8bdc74bdd495f165";
logging-data="896038"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+p6MvYhXIYcQq18uao+QzM"
User-Agent: Mozilla/5.0 (rv:102.0) Gecko/20100101, Betterbird/102
Cancel-Lock: sha1:xP0Gdmpdg/QYdsCTZNaCkERP2EQ=
Content-Language: en-GB, pl
In-Reply-To: <uk79sl$47tk$1@news.xmission.com>
 by: marrgol - Wed, 29 Nov 2023 12:40 UTC

On 2023-11-29 at 13:13 Kenny McCormack wrote:
> In VIM, if you do: :echo 'this is a test' strftime('%c')
> you get: this is a test Wed ...
>
> I.e., it concats the strings together, but with a space between. Removing
> the space from the command line: :echo 'this is a test'strftime('%c')
> does not help. It still concats with a space.
>
> Is there a way to concat without the space?

:echon 'this is a test'strftime('%c')

> Note: I would normally try to look this up in the VIM help, but it is hard
> to search for stuff related to the basic syntax of the language. What
> would you search on?

I did :h echo and found echon right below.

Re: VIM question - string concatenation

<uk7bi5$r4qs$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6796&group=comp.unix.shell#6796

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: marr...@address.invalid (marrgol)
Newsgroups: comp.unix.shell
Subject: Re: VIM question - string concatenation
Date: Wed, 29 Nov 2023 13:41:41 +0100
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <uk7bi5$r4qs$1@dont-email.me>
References: <uk79sl$47tk$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 29 Nov 2023 12:41:41 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="cf0b0a85d3999bac8bdc74bdd495f165";
logging-data="889692"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1920rcaQFuMepmbSvCtP2M9"
User-Agent: Mozilla/5.0 (rv:102.0) Gecko/20100101, Betterbird/102
Cancel-Lock: sha1:wuK03c80SFrz+Ns7EbTdPF2qcpM=
In-Reply-To: <uk79sl$47tk$1@news.xmission.com>
Content-Language: en-GB, pl
 by: marrgol - Wed, 29 Nov 2023 12:41 UTC

On 2023-11-29 at 13:13 Kenny McCormack wrote:
> In VIM, if you do: :echo 'this is a test' strftime('%c')
> you get: this is a test Wed ...
>
> I.e., it concats the strings together, but with a space between. Removing
> the space from the command line: :echo 'this is a test'strftime('%c')
> does not help. It still concats with a space.
>
> Is there a way to concat without the space?

:echon 'this is a test'strftime('%c')

> Note: I would normally try to look this up in the VIM help, but it is hard
> to search for stuff related to the basic syntax of the language. What
> would you search on?

I did :h echo and found echon right below.

Re: VIM question - string concatenation

<uk7ict$4afe$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6797&group=comp.unix.shell#6797

  copy link   Newsgroups: comp.unix.shell comp.editors
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell,comp.editors
Subject: Re: VIM question - string concatenation
Date: Wed, 29 Nov 2023 14:38:21 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <uk7ict$4afe$1@news.xmission.com>
References: <uk79sl$47tk$1@news.xmission.com> <uk7aq9$i4p$1@freeq.furie.org.uk>
Injection-Date: Wed, 29 Nov 2023 14:38:21 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="141806"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Wed, 29 Nov 2023 14:38 UTC

In article <uk7aq9$i4p$1@freeq.furie.org.uk>,
Tom Furie <tom@furie.org.uk> wrote:
>gazelle@shell.xmission.com (Kenny McCormack) writes:
>
>> In VIM, if you do: :echo 'this is a test' strftime('%c')
>> you get: this is a test Wed ...
>>
>> Is there a way to concat without the space?
>
>According to ':h echo' in vim, each expression is printed with a space
>between, so it doesn't look like it.

According to other posters downthread, 'echon' solves the problem, for
echo. But (and this is critical), 'echo' is not the point. I was only
using echo for demonstration purposes.

I actually came across this problem in another context, that did not
involve echo. I found that I always got the extra space in there.

So, there needs to be a way to do string concatenation that does not insert
the space.

--
The single most important statistic in the US today - the one that explains all the
others - is this: 63 million people thought it was a good idea to vote for this clown
(and will probably do so again). Everything else is secondary to that. Everything else
could be fixed if we can revert this one statistic. Nothing can be fixed until we do.

Re: VIM question - string concatenation

<uk7l4b$m96$1@freeq.furie.org.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6799&group=comp.unix.shell#6799

  copy link   Newsgroups: comp.unix.shell comp.editors
Path: i2pn2.org!i2pn.org!news.furie.org.uk!.POSTED.2001:470:1ae8:50:6efa:a7ff:fe34:284e!not-for-mail
From: tom...@furie.org.uk (Tom Furie)
Newsgroups: comp.unix.shell,comp.editors
Subject: Re: VIM question - string concatenation
Date: Wed, 29 Nov 2023 15:25:10 +0000
Organization: Little to None
Message-ID: <uk7l4b$m96$1@freeq.furie.org.uk>
References: <uk79sl$47tk$1@news.xmission.com>
<uk7aq9$i4p$1@freeq.furie.org.uk> <uk7ict$4afe$1@news.xmission.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: freeq.furie.org.uk; posting-host="2001:470:1ae8:50:6efa:a7ff:fe34:284e";
logging-data="22822"; mail-complaints-to="usenet@furie.org.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
 by: Tom Furie - Wed, 29 Nov 2023 15:25 UTC

gazelle@shell.xmission.com (Kenny McCormack) writes:

> According to other posters downthread, 'echon' solves the problem, for
> echo. But (and this is critical), 'echo' is not the point. I was only
> using echo for demonstration purposes.
>
> I actually came across this problem in another context, that did not
> involve echo. I found that I always got the extra space in there.
>
> So, there needs to be a way to do string concatenation that does not insert
> the space.

The only example you gave was with echo, so you were given an
echo-oriented solution. Perhaps if you provide the context in which
you're *actually* encountering the problem that can be addressed.

Re: VIM question - string concatenation

<20231129082426.511@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6801&group=comp.unix.shell#6801

  copy link   Newsgroups: comp.unix.shell comp.editors
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.shell,comp.editors
Subject: Re: VIM question - string concatenation
Date: Wed, 29 Nov 2023 16:26:37 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <20231129082426.511@kylheku.com>
References: <uk79sl$47tk$1@news.xmission.com>
<uk7aq9$i4p$1@freeq.furie.org.uk>
Injection-Date: Wed, 29 Nov 2023 16:26:37 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="bf6c6ef65d4019fef6a50c1370993a1e";
logging-data="964356"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+mQGjVblzEpx72Rnl8rDub+jxoGpjGscU="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:us9VpIj3Jj8saBV2EEqzfO+smGM=
 by: Kaz Kylheku - Wed, 29 Nov 2023 16:26 UTC

On 2023-11-29, Tom Furie <tom@furie.org.uk> wrote:
> gazelle@shell.xmission.com (Kenny McCormack) writes:
>
>> In VIM, if you do: :echo 'this is a test' strftime('%c')
>> you get: this is a test Wed ...
>>
>> Is there a way to concat without the space?
>
> According to ':h echo' in vim, each expression is printed with a space
> between, so it doesn't look like it.

Expressions in Vim can be catenated with the dot operator.

For instance :echo "a" . "b" prints ab for me.

Likewise, :echo "a" . strftime('%s') prints aWed...

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: VIM question - string concatenation

<uk7utm$4hc6$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6802&group=comp.unix.shell#6802

  copy link   Newsgroups: comp.unix.shell comp.editors
Path: i2pn2.org!i2pn.org!news.niel.me!tncsrv06.tnetconsulting.net!csiph.com!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell,comp.editors
Subject: Re: VIM question - string concatenation
Date: Wed, 29 Nov 2023 18:12:06 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <uk7utm$4hc6$1@news.xmission.com>
References: <uk79sl$47tk$1@news.xmission.com> <uk7aq9$i4p$1@freeq.furie.org.uk> <20231129082426.511@kylheku.com>
Injection-Date: Wed, 29 Nov 2023 18:12:06 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="148870"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Wed, 29 Nov 2023 18:12 UTC

In article <20231129082426.511@kylheku.com>,
Kaz Kylheku <433-929-6894@kylheku.com> wrote:
>On 2023-11-29, Tom Furie <tom@furie.org.uk> wrote:
>> gazelle@shell.xmission.com (Kenny McCormack) writes:
>>
>>> In VIM, if you do: :echo 'this is a test' strftime('%c')
>>> you get: this is a test Wed ...
>>>
>>> Is there a way to concat without the space?
>>
>> According to ':h echo' in vim, each expression is printed with a space
>> between, so it doesn't look like it.
>
>Expressions in Vim can be catenated with the dot operator.
>
>For instance :echo "a" . "b" prints ab for me.

Thank you!

Yes, that jogs my memory. I had used . previously, but it has been a long
time.

Usenet at its finest. The system works!

--
Joni Ernst (2014): Obama should be impeached because 2 people have died of Ebola.
Joni Ernst (2020): Trump is doing great things, because only 65,000 times as many people have died of COVID-19.

Josef Stalin (1947): When one person dies, it is a tragedy; when a million die, it is merely statistics.

Re: VIM question - string concatenation

<20231129111142.277@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6806&group=comp.unix.shell#6806

  copy link   Newsgroups: comp.unix.shell comp.editors
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.shell,comp.editors
Subject: Re: VIM question - string concatenation
Date: Wed, 29 Nov 2023 19:16:40 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 43
Message-ID: <20231129111142.277@kylheku.com>
References: <uk79sl$47tk$1@news.xmission.com>
<uk7aq9$i4p$1@freeq.furie.org.uk> <20231129082426.511@kylheku.com>
<uk7utm$4hc6$1@news.xmission.com>
Injection-Date: Wed, 29 Nov 2023 19:16:40 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="bf6c6ef65d4019fef6a50c1370993a1e";
logging-data="1020107"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Ufj+P1qOteYd9HoTqpPM8LFIiecIjp+s="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:Voh/rL//qAPFday1WBopg2ZLkeo=
 by: Kaz Kylheku - Wed, 29 Nov 2023 19:16 UTC

On 2023-11-29, Kenny McCormack <gazelle@shell.xmission.com> wrote:
> In article <20231129082426.511@kylheku.com>,
> Kaz Kylheku <433-929-6894@kylheku.com> wrote:
>>On 2023-11-29, Tom Furie <tom@furie.org.uk> wrote:
>>> gazelle@shell.xmission.com (Kenny McCormack) writes:
>>>
>>>> In VIM, if you do: :echo 'this is a test' strftime('%c')
>>>> you get: this is a test Wed ...
>>>>
>>>> Is there a way to concat without the space?
>>>
>>> According to ':h echo' in vim, each expression is printed with a space
>>> between, so it doesn't look like it.
>>
>>Expressions in Vim can be catenated with the dot operator.
>>
>>For instance :echo "a" . "b" prints ab for me.
>
> Thank you!
>
> Yes, that jogs my memory. I had used . previously, but it has been a long
> time.

I also used it; and by golly there are multiple examples in my now
ancient .vimrc.

Here is one. Well, two:

:nmap K "_y:execute count ? ( ":!man " . count . " " . expand("<cword>") ) : ( ":grep \\<" . expand("<cword>") . "\\>")<CR>
:vmap K "zy:execute ":grep " . getreg("z")<CR>

The built-in K command does man page lookup normally for the word under
the cursor. If you give it a numeric prefix, it will look in that
section of the man system; 2K will do a "man 2 <word>".

I wanted K to do a :grep through the code I'm working on,
but retain the prefixed K functionality for man page lookups.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: VIM question - string concatenation

<uk86kp$vo75$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6807&group=comp.unix.shell#6807

  copy link   Newsgroups: comp.unix.shell comp.editors
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: onorio.c...@gmail.com.invalid (Onorio Catenacci)
Newsgroups: comp.unix.shell,comp.editors
Subject: Re: VIM question - string concatenation
Date: Wed, 29 Nov 2023 15:23:53 -0500
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <uk86kp$vo75$1@dont-email.me>
References: <uk79sl$47tk$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 29 Nov 2023 20:23:54 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ac77bbfe58349fcc20d6441ce8a0e5e9";
logging-data="1040613"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+z6XsTUYD1mo4x6ctHVn7ImfThq96xVcM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Wo+zqNvHgP2sv7MnBMZLtFlTZG0=
In-Reply-To: <uk79sl$47tk$1@news.xmission.com>
Content-Language: en-US
 by: Onorio Catenacci - Wed, 29 Nov 2023 20:23 UTC

On 11/29/23 7:13 AM, Kenny McCormack wrote:
> Note: Normally, I would post this (only) to comp.editors, but (at least on
> my server) comp.editors is destroyed by the Google spam and is unusable.
> So, if you respond (post) to comp.editors (only), I won't see it. I am
> reading/posting only via the "shell" group.
>
> In VIM, if you do: :echo 'this is a test' strftime('%c')
> you get: this is a test Wed ...
>
> I.e., it concats the strings together, but with a space between. Removing
> the space from the command line: :echo 'this is a test'strftime('%c')
> does not help. It still concats with a space.
>
> Is there a way to concat without the space?
>
> Note: I would normally try to look this up in the VIM help, but it is hard
> to search for stuff related to the basic syntax of the language. What
> would you search on?
>

May not be totally appropriate to mention this here (if not apologies in
advance) but this is another resource for Vi/Vim questions:
https://vi.stackexchange.com

Since this is the only thread I've seen recently in comp.editors that
isn't spam (or trash) I wanted to try to contribute something worthwhile
to the conversation.

--
oc

Re: VIM question - string concatenation

<MPG.3fd19b31facd2ac8990233@news.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6808&group=comp.unix.shell#6808

  copy link   Newsgroups: comp.unix.shell comp.editors
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: the_stan...@fastmail.fm (Stan Brown)
Newsgroups: comp.unix.shell,comp.editors
Subject: Re: VIM question - string concatenation
Date: Wed, 29 Nov 2023 19:02:49 -0800
Organization: Oak Road Systems
Lines: 39
Message-ID: <MPG.3fd19b31facd2ac8990233@news.individual.net>
References: <uk79sl$47tk$1@news.xmission.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: individual.net 2frPd+Ng6CUTTb8O5ikoeAj1HH/ezoc4HGDYm/NENv/7hjwb6P
Cancel-Lock: sha1:ri/t34v2I1JEVCQ6l1RjESojiM8= sha256:SPnRE7N/7pl9M8TwyDHEzyo2CIQRIkmCdYPvNjMsM3I=
User-Agent: MicroPlanet-Gravity/3.0.11 (GRC)
 by: Stan Brown - Thu, 30 Nov 2023 03:02 UTC

On Wed, 29 Nov 2023 12:13:09 -0000 (UTC), Kenny McCormack wrote:
>
> Note: Normally, I would post this (only) to comp.editors, but (at least on
> my server) comp.editors is destroyed by the Google spam and is unusable.
> So, if you respond (post) to comp.editors (only), I won't see it. I am
> reading/posting only via the "shell" group.
>
> In VIM, if you do: :echo 'this is a test' strftime('%c')
> you get: this is a test Wed ...
>
> I.e., it concats the strings together, but with a space between.

I don't think it does. You have two expressions there, a string
constant and a string function. :echo shows however many expressions
you have on the command line, separated by a space.

> Is there a way to concat without the space?

Use a dot ("period" in the US):

:echo 'this is a test' . strftime('%c')

That is the concatenation operator. If you use my :echo command, it
is now one expression, and therefore no space is inserted as it was
when you had two expressions.

> Note: I would normally try to look this up in the VIM help, but it is hard
> to search for stuff related to the basic syntax of the language. What
> would you search on?

:h expression-syntax

N.B. I'm still running Vim 7.4, so it's conceivable that "." works
differently in Vim 9, but I think it's pretty unlikely. Anyway, it's
easy to check.

--
Stan Brown, Tehachapi, California, USA https://BrownMath.com/
Shikata ga nai...

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor