Closed richyliu closed 2 years ago
Prefixing the command with !silent
does not supress the error message:
let g:markdown_fenced_languages = ['python', 'notafiletype']
But I'm reverting the commit, as you suggested. Thanks!
Thanks for reverting.
With your example, I was able to suppress the error message with this silent!
(not `!silent):
diff --git a/syntax/rmd.vim b/syntax/rmd.vim
index 7755019..ab86289 100644
--- a/syntax/rmd.vim
+++ b/syntax/rmd.vim
@@ -79,7 +79,7 @@ for s:type in g:rmd_fenced_languages
let s:nm = s:type
endif
unlet! b:current_syntax
- exe 'syn include @Rmd'.s:nm.' syntax/'.s:ft.'.vim'
+ silent! exe 'syn include @Rmd'.s:nm.' syntax/'.s:ft.'.vim'
if g:rmd_syn_hl_chunk
exe 'syn region rmd'.s:nm.'ChunkDelim matchgroup=rmdCodeDelim start="^\s*```\s*{\s*=\?'.s:nm.'\>" matchgroup=rmdCodeDelim end="}$" keepend containedin=rmd'.s:nm.'Chunk contains=@Rmdr'
exe 'syn region rmd'.s:nm.'Chunk start="^\s*```\s*{\s*=\?'.s:nm.'\>.*$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend contains=rmd'.s:nm.'ChunkDelim,@Rmd'.s:nm
The vim manual for :sil[ent][!] {command}
says:
When [!] is added, error messages will also be skipped
The latest commit (8d15716386010ea3d4be5d6870ce9d35ededc6fa) broke my Rmarkdown/vimtex setup because it no longer searches the
runtimepath
for the correct syntax files for highlighting.I propose we revert the commit. There shouldn't be any issues with the syntax file not found, since the user can always configure which files are highlighted with
g:rmd_fenced_languages
.Also, vim-markdown (https://github.com/tpope/vim-markdown/blob/891dff54a92b04cda36da7fbc6634831c3389d29/syntax/markdown.vim#L36) has the same behavior.
Alternatively we could prefix the
exe
call withsilent!
to suppress errors, like so: