From 287fe4e29a5e67d02633fdc704d1197abd80eda8 Mon Sep 17 00:00:00 2001 From: Martin Bielik Date: Fri, 7 Apr 2023 20:41:49 +0200 Subject: enabled code highlighting in scratch window --- ftplugin/aichat.vim | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ftplugin/aichat.vim b/ftplugin/aichat.vim index f49aad3..33b8141 100644 --- a/ftplugin/aichat.vim +++ b/ftplugin/aichat.vim @@ -99,7 +99,7 @@ function! s:IsHighlightSourcesEnabledForBuffer() endfunction function! s:MarkdownRefreshSyntax(force) - if g:vim_ai_chat_default['ui']['code_syntax_enabled'] + if g:vim_ai_chat_default['ui']['code_syntax_enabled'] && &filetype =~# 'aichat' call s:MarkdownHighlightSources(a:force) endif endfunction @@ -111,9 +111,10 @@ function! s:MarkdownClearSyntaxVariables() endfunction augroup Aichat - autocmd BufWinEnter *.aichat call s:MarkdownRefreshSyntax(1) - autocmd BufUnload *.aichat call s:MarkdownClearSyntaxVariables() - autocmd BufWritePost *.aichat call s:MarkdownRefreshSyntax(0) - autocmd InsertEnter,InsertLeave *.aichat call s:MarkdownRefreshSyntax(0) - autocmd CursorHold,CursorHoldI *.aichat call s:MarkdownRefreshSyntax(0) + autocmd! * + autocmd BufWinEnter call s:MarkdownRefreshSyntax(1) + autocmd BufUnload call s:MarkdownClearSyntaxVariables() + autocmd BufWritePost call s:MarkdownRefreshSyntax(0) + autocmd InsertEnter,InsertLeave call s:MarkdownRefreshSyntax(0) + autocmd CursorHold,CursorHoldI call s:MarkdownRefreshSyntax(0) augroup END -- cgit v1.2.3