Mercurial > vim
annotate runtime/syntax/lhaskell.vim @ 30807:442a574ffae3 v9.0.0738
patch 9.0.0738: cannot suppress completion "scanning" messages
Commit: https://github.com/vim/vim/commit/91ccbad5ded8bcf2cc93a873ff2c3179b0c548c7
Author: =?UTF-8?q?Bj=C3=B6rn=20Linse?= <bjorn.linse@gmail.com>
Date: Thu Oct 13 12:51:13 2022 +0100
patch 9.0.0738: cannot suppress completion "scanning" messages
Problem: Cannot suppress completion "scanning" messages.
Solution: Add the "C" flag in 'shortmess'. (Bjorn Linse, closes https://github.com/vim/vim/issues/11354)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 13 Oct 2022 14:00:05 +0200 |
parents | ef454a7f485d |
children |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: Haskell with literate comments, Bird style, | |
24024 | 3 " Markdown style, TeX style and plain text surrounding |
7 | 4 " \begin{code} \end{code} blocks |
5 " Maintainer: Haskell Cafe mailinglist <haskell-cafe@haskell.org> | |
6 " Original Author: Arthur van Leeuwen <arthurvl@cs.uu.nl> | |
24024 | 7 " Last Change: 2020 Feb 25 |
8 " Version: 1.05 | |
7 | 9 " |
10 " Thanks to Ian Lynagh for thoughtful comments on initial versions and | |
11 " for the inspiration for writing this in the first place. | |
12 " | |
13 " This style guesses as to the type of markup used in a literate haskell | |
14 " file and will highlight (La)TeX markup if it finds any | |
15 " This behaviour can be overridden, both glabally and locally using | |
16 " the lhs_markup variable or b:lhs_markup variable respectively. | |
17 " | |
18 " lhs_markup must be set to either tex or none to indicate that | |
19 " you always want (La)TeX highlighting or no highlighting | |
20 " must not be set to let the highlighting be guessed | |
21 " b:lhs_markup must be set to eiterh tex or none to indicate that | |
22 " you want (La)TeX highlighting or no highlighting for | |
23 " this particular buffer | |
24 " must not be set to let the highlighting be guessed | |
25 " | |
26 " | |
27 " 2004 February 18: New version, based on Ian Lynagh's TeX guessing | |
28 " lhaskell.vim, cweb.vim, tex.vim, sh.vim and fortran.vim | |
29 " 2004 February 20: Cleaned up the guessing and overriding a bit | |
30 " 2004 February 23: Cleaned up syntax highlighting for \begin{code} and | |
31 " \end{code}, added some clarification to the attributions | |
2034 | 32 " 2008 July 1: Removed % from guess list, as it totally breaks plain |
33 " text markup guessing | |
34 " 2009 April 29: Fixed highlighting breakage in TeX mode, | |
35 " thanks to Kalman Noel | |
7 | 36 " |
37 | |
38 | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2152
diff
changeset
|
39 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2152
diff
changeset
|
40 if exists("b:current_syntax") |
7 | 41 finish |
42 endif | |
43 | |
44 " First off, see if we can inherit a user preference for lhs_markup | |
45 if !exists("b:lhs_markup") | |
46 if exists("lhs_markup") | |
24024 | 47 if lhs_markup =~ '\<\%(tex\|md\|none\)\>' |
48 let b:lhs_markup = matchstr(lhs_markup,'\<\%(tex\|md\|none\)\>') | |
7 | 49 else |
50 echohl WarningMsg | echo "Unknown value of lhs_markup" | echohl None | |
51 let b:lhs_markup = "unknown" | |
52 endif | |
53 else | |
54 let b:lhs_markup = "unknown" | |
55 endif | |
56 else | |
24024 | 57 if b:lhs_markup !~ '\<\%(tex\|md\|none\)\>' |
7 | 58 let b:lhs_markup = "unknown" |
59 endif | |
60 endif | |
61 | |
62 " Remember where the cursor is, and go to upperleft | |
63 let s:oldline=line(".") | |
64 let s:oldcolumn=col(".") | |
65 call cursor(1,1) | |
66 | |
67 " If no user preference, scan buffer for our guess of the markup to | |
68 " highlight. We only differentiate between TeX and plain markup, where | |
69 " plain is not highlighted. The heuristic for finding TeX markup is if | |
70 " one of the following occurs anywhere in the file: | |
71 " - \documentclass | |
72 " - \begin{env} (for env != code) | |
73 " - \part, \chapter, \section, \subsection, \subsubsection, etc | |
74 if b:lhs_markup == "unknown" | |
2034 | 75 if search('\\documentclass\|\\begin{\(code}\)\@!\|\\\(sub\)*section\|\\chapter|\\part','W') != 0 |
7 | 76 let b:lhs_markup = "tex" |
24024 | 77 elseif search('```haskell','W') != 0 |
78 let b:lhs_markup = "md" | |
7 | 79 else |
80 let b:lhs_markup = "plain" | |
81 endif | |
82 endif | |
83 | |
2034 | 84 " If user wants us to highlight TeX syntax or guess thinks it's TeX, read it. |
7 | 85 if b:lhs_markup == "tex" |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2152
diff
changeset
|
86 runtime! syntax/tex.vim |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2152
diff
changeset
|
87 unlet b:current_syntax |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2152
diff
changeset
|
88 " Tex.vim removes "_" from 'iskeyword', but we need it for Haskell. |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2152
diff
changeset
|
89 setlocal isk+=_ |
2034 | 90 syntax cluster lhsTeXContainer contains=tex.*Zone,texAbstract |
24024 | 91 elseif b:lhs_markup == "md" |
92 runtime! syntax/markdown.vim | |
93 unlet b:current_syntax | |
94 syntax cluster lhsTeXContainer contains=markdown.* | |
2034 | 95 else |
96 syntax cluster lhsTeXContainer contains=.* | |
7 | 97 endif |
98 | |
99 " Literate Haskell is Haskell in between text, so at least read Haskell | |
100 " highlighting | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2152
diff
changeset
|
101 syntax include @haskellTop syntax/haskell.vim |
7 | 102 |
2034 | 103 syntax region lhsHaskellBirdTrack start="^>" end="\%(^[^>]\)\@=" contains=@haskellTop,lhsBirdTrack containedin=@lhsTeXContainer |
2152 | 104 syntax region lhsHaskellBeginEndBlock start="^\\begin{code}\s*$" matchgroup=NONE end="\%(^\\end{code}.*$\)\@=" contains=@haskellTop,beginCodeBegin containedin=@lhsTeXContainer |
24024 | 105 syntax region lhsHaskellMDBlock start="^```haskell$" matchgroup=NONE end="^```$" keepend contains=@haskellTop,lhsMarkdownCode containedin=@lhsTeXContainer |
7 | 106 |
107 syntax match lhsBirdTrack "^>" contained | |
108 | |
24024 | 109 syntax match lhsMarkdownCode "^\(```haskell\|^```\)$" contained |
110 | |
7 | 111 syntax match beginCodeBegin "^\\begin" nextgroup=beginCodeCode contained |
112 syntax region beginCodeCode matchgroup=texDelimiter start="{" end="}" | |
113 | |
114 " Define the default highlighting. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2152
diff
changeset
|
115 " Only when an item doesn't have highlighting yet |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2152
diff
changeset
|
116 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
117 hi def link lhsBirdTrack Comment |
7 | 118 |
24024 | 119 hi def link lhsMarkdownCode Comment |
120 | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
121 hi def link beginCodeBegin texCmdName |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
122 hi def link beginCodeCode texSection |
7 | 123 |
124 | |
125 " Restore cursor to original position, as it may have been disturbed | |
126 " by the searches in our guessing code | |
127 call cursor (s:oldline, s:oldcolumn) | |
128 | |
129 unlet s:oldline | |
130 unlet s:oldcolumn | |
131 | |
132 let b:current_syntax = "lhaskell" | |
133 | |
134 " vim: ts=8 |