0

I'm trying to search through a page for the word CREATE. I would then like to put DELIMITER $$ above that line.

Here is my attempt. Can someone point me in the right direction?

:execute "%normal! /CREATE\<cr>"."O DELIMITER $$"."<esc>"

Am I on the right track?

1 Answer 1

2

Yes, you're close. To combine an action with a matching pattern, use the :global command. For prepending text in a new line, there are actually multiple approaches: The normal-mode O command can be used with :normal, or you can :put an expression = (instead of register contents) containing the text.

:g/CREATE/normal! O$$

or

:g/CREATE/put! ='$$'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.