[vim/vim] Using vim in scripts, but not ex mode, just sending keystrokes to vim. What is best (most reliable) approach? (Discussion #15315)

9 views
Skip to first unread message

Marek Langiewicz

unread,
Jul 21, 2024, 7:12:09 AM (yesterday) Jul 21
to vim/vim, Subscribed

I'm trying these two methods, both work for me, but I don't know which is better and what are the differences:
Using -s /dev/stdin:
printf 'isome repetitive line\eyy8p:wq\n' | vim -s /dev/stdin -n generatedfile.txt
Just piping keys to vim:
printf 'isome repetitive line\eyy8p:wq\n' | vim -n generatedfile.txt
I'd rather like to avoid creating temporary files with keystrokes.
Any opinions/details?


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/repo-discussions/15315@github.com>

Marek Langiewicz

unread,
Jul 21, 2024, 7:28:57 AM (yesterday) Jul 21
to vim/vim, Subscribed

Oh, and I'm aware I can use ex mode and :norm command, but it gets complicated when sending keys like C-A.
Because it looks like the only way is to wrap the :norm in another :exe and still escape some characters like <.
So generally it's confusing. BTW is there somewhere some nice guideline for such cases?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/repo-discussions/15315/comments/10106398@github.com>

Reply all
Reply to author
Forward
0 new messages