0

This would be great to have support for any language, but the thing I want now is just bash.

I have a shell script which has all of its code inside a multiline heredoc string which is sent to gnome-terminal. Vim shows the entire code as a string (naturally).

I'd like to be able to, say, add begin and end comments that can make Vim syntax-highlight this string as bash code instead of a string.

Obviously I can easily factor it out into two scripts, but it would be nice and neat to be able to do this.

Steven Lu
  • 2,251
  • 15
  • 26
  • 1
    :help sh-embed – D. Ben Knoble Jan 18 '22 at 21:58
  • Thanks @D.BenKnoble. I've followed up on this and unfortunately it is not a "Batteries included" solution. First, you have to define one of these for each combo of nested language and outer language. Second, I have tried many examples (https://vim.fandom.com/wiki/Different_syntax_highlighting_within_regions_of_a_file, https://vi.stackexchange.com/a/19411/390) and nothing works at all yet. Thirdly, everything I've read about this approach hints at subtle bugs and problems when the outer source ft is itself syntax highlighted. I need a production ready plugin to do this... – Steven Lu Jan 19 '22 at 04:32
  • I have high hopes for https://www.vim.org/scripts/script.php?script_id=4168 (Update: Not clear how to use) – Steven Lu Jan 19 '22 at 04:35

0 Answers0