0

I am a beginner in vim.

The following code is just a piece of code that i have. How to add line break between "just" and "an".

call append(line('.') - 1, 'This' .'is' .'just' . "\r" . 'an' . selected_content . 'example')

This code is not working. and got junk like (^M)

1 Answer 1

2

Split your string into a |List|, and then, it'll work.

call append('.', ['This' .'is' .'just',  'an' . selected_content . 'example'])

If as I suspect the string is built, then is won't be difficult to use a list instead of a string in your code. Otherwise, you'll need to use split(line, "\n")

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.