As title, how to get syntax highlighting for the embeded python within vimscript? Is there a plugin that does syntax highlighting for embeded script?
1 Answer
So the enabled embedded syntaxes in VimScript are ruled by :h g:vimsyn_embed
variable. However, Vim and Neovim has different default settings in this regard.
In Vim's syntax/vim.vim
:
" Allows users to specify the type of embedded script highlighting
" they want: (perl/python/ruby/tcl support)
" g:vimsyn_embed == 0 : don't embed any scripts
" g:vimsyn_embed =~# 'l' : embed lua (but only if vim supports it)
" g:vimsyn_embed =~# 'm' : embed mzscheme (but only if vim supports it)
" g:vimsyn_embed =~# 'p' : embed perl (but only if vim supports it)
" g:vimsyn_embed =~# 'P' : embed python (but only if vim supports it)
" g:vimsyn_embed =~# 'r' : embed ruby (but only if vim supports it)
" g:vimsyn_embed =~# 't' : embed tcl (but only if vim supports it)
if !exists("g:vimsyn_embed")
let g:vimsyn_embed = "lmpPr"
endif
However, in Neovim the last but one line is changed to let g:vimsyn_embed = 0
Hence, let g:vimsyn_embed = 'P'
must be added to init.vim to enable this feature in Neovim. While in Vim it should work by default.
:h g:vimsyn_embed