From 14350dbb0d265ef87d1c7d420d89fb4165a2b131 Mon Sep 17 00:00:00 2001 From: w0rp Date: Wed, 6 Sep 2023 00:21:58 +0100 Subject: Close #3368 - Supercharge :ALEInfo Make a series of sweeping changes to make :ALEInfo more useful. 1. Deprecate :ALEInfoToClipboard and support :ALEInfo -clipboard 2. Permit :ALEInfo -clip as a shorthand for :ALEInfo -clipboard 3. Support :ALEInfo -preview to render in the preview window 4. Support :ALEInfo -echo for the classic :ALEInfo mode 5. Change the default mode to 'preview', and make it configurable 6. Add syntax highlighting for ALEInfo in preview mode 7. Add a convenience to look up documentatation that explains itself 8. Don't show an empty 'Linter Variables' section --- syntax/ale-fix-suggest.vim | 2 +- syntax/ale-info.vim | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 syntax/ale-info.vim (limited to 'syntax') diff --git a/syntax/ale-fix-suggest.vim b/syntax/ale-fix-suggest.vim index b112f5b5..19734f4c 100644 --- a/syntax/ale-fix-suggest.vim +++ b/syntax/ale-fix-suggest.vim @@ -3,7 +3,7 @@ if exists('b:current_syntax') endif syn match aleFixerComment /^.*$/ -syn match aleFixerName /\(^\|, \)'[^']*'/ +syn match aleFixerName /\(^ *\|, \)'[^']*'/ syn match aleFixerHelp /^See :help ale-fix-configuration/ hi def link aleFixerComment Comment diff --git a/syntax/ale-info.vim b/syntax/ale-info.vim new file mode 100644 index 00000000..d47b58b8 --- /dev/null +++ b/syntax/ale-info.vim @@ -0,0 +1,30 @@ +if exists('b:current_syntax') + finish +endif + +" Exhaustively list different ALE Info directives to match here. +" This should hopefully avoid matching too eagerly. +syn match aleInfoDirective /^ *Current Filetype:/ +syn match aleInfoDirective /^ *Available Linters:/ +syn match aleInfoDirective /^ *Enabled Linters:/ +syn match aleInfoDirective /^ *Ignored Linters:/ +syn match aleInfoDirective /^ *Suggested Fixers:/ +syn match aleInfoDirective /^ *Command History:/ + +syn match aleCommandNoOutput /^<<>>$/ + +hi def link aleInfoDirective Title +hi def link aleInfoDirective Title +hi def link aleCommandNoOutput Comment + +" Use Vim syntax highlighting for Vim options. +unlet! b:current_syntax +syntax include @srcVim syntax/vim.vim +syntax region aleInfoVimRegionLinter matchgroup=aleInfoDirective start="^ *Linter Variables:$" end="^ $" contains=@srcVim +syntax region aleInfoVimRegionGlobal matchgroup=aleInfoDirective start="^ *Global Variables:$" end="^ $" contains=@srcVim + +unlet! b:current_syntax +syntax include @srcAleFixSuggest syntax/ale-fix-suggest.vim +syntax region aleInfoFixSuggestRegion matchgroup=aleInfoDirective start="^ *Suggested Fixers:$" end="^ $" contains=@srcAleFixSuggest + +let b:current_syntax = 'ale-info' -- cgit v1.2.3