awkembed.vim

51 views
Skip to first unread message

J S

unread,
Jul 13, 2019, 8:24:55 AM7/13/19
to v...@vim.org
(On the subject of syntax highlighting languages embedded in other languages)

I frequently write (bash) shell scripts with embedded AWK scripts, and I've found the awkembed.vim script quite useful. I have it installed at:

~/.vim/after/syntax/sh/awkembed.vim

And it works quite well. Now, I would like to extend the idea beyond the set of "shell" and "awk".

There are, obviously, two variables here: The enclosing language and the embedded language. As far as I can tell (based on a little Googoling) this has only been done for the one specific combination: shell & awk. Note: :help sh-embed

Specifically, I have an Expect script with embedded AWK. How hard is it going to be to get this to work?

I took a look at the awkembed.vim script - it's mostly greek to me, although I was able to modify it slightly because my awk has a different name than the one assumed by the script.

It'd be nice if someone could tell me either a quick way to make a script to do what I want - or to tell me it can't be done...

aro...@vex.net

unread,
Jul 13, 2019, 12:59:21 PM7/13/19
to vim...@googlegroups.com

> I frequently write (bash) shell scripts with embedded AWK scripts,

It sounds as though Perl might be good fit for whatever you are doing.
(Perl evolved because shell, sed and awk combinations were becoming
cumbersome.)

J S

unread,
Jul 13, 2019, 7:11:56 PM7/13/19
to v...@vim.org
Perl is off-topic in this thread.

Normally, I wouldn't say anything, but I've found that, on boards like this, the first response sets the tone for the thread. People end up reacting more to the first response than to the original post. I do not want any discussion of Perl in this thread.

Christian Brabandt

unread,
Jul 14, 2019, 9:21:12 AM7/14/19
to v...@vim.org
Have a look at :h sh-embed for the general principle.

Best,
Christian
--
Ist Windows 98 ein Spiel oder ein Betriebssystem?

Nein, ich finde ein Spiel sollte schon eine Lösung haben.
Ich stecke im 97. Level.

J S

unread,
Jul 14, 2019, 10:14:25 AM7/14/19
to v...@vim.org
> Have a look at :h sh-embed for the general principle.

I'm assuming that you either didn't read the OP or read it very quickly, since it (the OP) makes it very clear that I had already done that.

aro...@vex.net

unread,
Jul 14, 2019, 10:40:05 AM7/14/19
to vim...@googlegroups.com
> Perl is off-topic in this thread.
>
> I do not want any discussion of Perl in this thread.
>

OK, just trying to offer a solution.

Christian Brabandt

unread,
Jul 14, 2019, 10:47:44 AM7/14/19
to v...@vim.org
You are making it unnecessary hard to follow your messages, since
apparently you break the threads on answering.

I somehow missed, that you already tried that method, so what problem
are you trying to solve? (you cut the quotes quite strictly, so cannot
follow the thread)

Best,
Christian
--
Wie man sein Kind nicht nennen sollte:
Jack Ett
Reply all
Reply to author
Forward
0 new messages