Discussion:
how do I insert a new line in command mode?
d***@s4c.co.uk
2002-10-09 13:03:00 UTC
Permalink
I have a file of fields (below) and I want to parse this into a command
which spans multiple lines. Could anyone please tell me how I insert a new
line in command mode?

series_year
clock_number
...
...

The command I am using is:

::%s/^\(.*\)$/if not isnull(frm!\1) then<CR>sql=sql & " lower(\1) like
'%\1)'"/g

where I wish to insert a new line where the <CR> is.

Many thanks,

David Morgan.


Mae’r neges e-bost hon ac unrhyw ffeiliau sydd ynghlwm wrthi yn gwbl gyfrinachol ac wedi’u bwriadu at sylw yr unigolyn neu’r endid y maent wedi eu cyfeirio ato yn unig. Gallant gynnwys gwybodaeth sy’n freintiedig yn gyfreithiol a/neu’n gyfrinachol ac os nad chi yw’r sawl y cyfeiriwyd y neges ato, yna peidiwch â chopio, dosbarthu na chymryd unrhyw gamau o ganlyniad a gan ddibynnu arni. Os ydych wedi derbyn y neges e-bost hon ar gam, a wnewch chi ein hysbysu o hyn cyn gynted â phosib a’i dileu os gwelwch yn dda. Barn neu safbwyntiau’r awdur yw’r rhai a fynegir yn y neges e-bost hon ac/neu’n unrhyw atodiadau ac nid ydynt yn adlewyrchu o anghenraid barn neu safbwyntiau S4C.

This e-mail message and any files attached are strictly confidential and intended solely for the attention of the person or entity to whom they are addressed. They may contain legally privileged and/or confidential information and if you are not the addressee, you should not copy, distribute nor take any action in reliance on them. If you have received this e-mail message in error, please notify us as soon as possible and delete it. The views and opinions expressed in this e-mail message and any attachments are the author’s own and they do not reflect necessarily the views and opinions of S4C.
Bernard El-Hagin
2002-10-09 13:09:06 UTC
Permalink
Post by d***@s4c.co.uk
I have a file of fields (below) and I want to parse this into a command
which spans multiple lines. Could anyone please tell me how I insert a new
line in command mode?
series_year
clock_number
...
...
::%s/^\(.*\)$/if not isnull(frm!\1) then<CR>sql=sql & " lower(\1) like
'%\1)'"/g
where I wish to insert a new line where the <CR> is.
Try typing <Ctrl-v><Enter> (that's 2 keystrokes, "v" with Control pressed
and then the Enter key).


Cheers,
Bernard
Brett Pershing Stahlman
2002-10-09 13:40:34 UTC
Permalink
David,
Try this:

%s/^\(.*\)$/if not isnull(frm!\1) then^M sql=sql \& " lower(\1)
like'%\1)'"/g

*NOTE* that ^M is obtained by typing <Ctrl-V> followed by <Enter> key.

Also, I wasn't sure whether you meant for the lower() function call to be
interpreted by Vim or your target programming language - if the latter, then
you probably need a set of quotes around \1?...

Hope this helps...
Brett S.

----- Original Message -----
From: <***@s4c.co.uk>
To: <***@vim.org>
Sent: Wednesday, October 09, 2002 8:03 AM
Subject: how do I insert a new line in command mode?



I have a file of fields (below) and I want to parse this into a command
which spans multiple lines. Could anyone please tell me how I insert a new
line in command mode?

series_year
clock_number
...
...

The command I am using is:

::%s/^\(.*\)$/if not isnull(frm!\1) then<CR>sql=sql & " lower(\1) like
'%\1)'"/g

Many thanks,

David Morgan.


Mae'r neges e-bost hon ac unrhyw ffeiliau sydd ynghlwm wrthi yn gwbl
gyfrinachol ac wedi'u bwriadu at sylw yr unigolyn neu'r endid y maent wedi
eu cyfeirio ato yn unig. Gallant gynnwys gwybodaeth sy'n freintiedig yn
gyfreithiol a/neu'n gyfrinachol ac os nad chi yw'r sawl y cyfeiriwyd y neges
ato, yna peidiwch â chopio, dosbarthu na chymryd unrhyw gamau o ganlyniad a
gan ddibynnu arni. Os ydych wedi derbyn y neges e-bost hon ar gam, a wnewch
chi ein hysbysu o hyn cyn gynted â phosib a'i dileu os gwelwch yn dda. Barn
neu safbwyntiau'r awdur yw'r rhai a fynegir yn y neges e-bost hon ac/neu'n
unrhyw atodiadau ac nid ydynt yn adlewyrchu o anghenraid barn neu
safbwyntiau S4C.

This e-mail message and any files attached are strictly confidential and
intended solely for the attention of the person or entity to whom they are
addressed. They may contain legally privileged and/or confidential
information and if you are not the addressee, you should not copy,
distribute nor take any action in reliance on them. If you have received
this e-mail message in error, please notify us as soon as possible and
delete it. The views and opinions expressed in this e-mail message and any
attachments are the author's own and they do not reflect necessarily the
views and opinions of S4C.

Loading...