1

here is my vimscript function, the first line of code is fine. Add a " at begin of line.

But the second line of code is not work. The third line is shorter than the second line and it worked. Why this happens?

function! NormalTest()
    silent execute("normal! vip:normal! I\"\<ESC>")
    silent execute("normal! vip:normal! A;") " not work ; is not appended
    "silent execute("normal! vip") " this is work, vip select is done.
endfunction;

5
  • 2
    Your second command starts an Ex command (:) but doesn’t finish it with (e.g.) \<enter>. Does that make a difference? (PS The semi-colon on endfunction will cause you problems.)
    – D. Ben Knoble
    Commented Oct 22, 2022 at 19:06
  • Hi do you know how to "@" a name? I try to @ your name with plain text but seems not work
    – lizhe
    Commented Oct 23, 2022 at 3:15
  • 1
    If I type @D it completes to @D.BenKnoble for me, but it only works for one @-mention in a comment. You can't use @-mentions in post text, only comments such as these. Commented Oct 23, 2022 at 4:06
  • At any rate, I’m removed the (wrongly-formatted) answer from the post. Answers don’t belong in Questions.
    – D. Ben Knoble
    Commented Oct 23, 2022 at 13:25
  • Also, you can only @-mention people that have already interacted with a post in some way, and the completion doesn't work if the person you're @-ing wrote the question or answer you're commenting on, because they will be notified automatically anyway.
    – Rich
    Commented Oct 25, 2022 at 8:15

1 Answer 1

1

Your second command starts an Ex command (:) but doesn’t finish it with (e.g.) \<enter>. As I’ve said before, though, the odd proliferation of execute/normal where they aren’t needed baffles me:

'{,'}substitute/^/"
'{,'}substitute/$/;

(PS The semi-colon on endfunction will cause you problems.)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.