view runtime/syntax/xdefaults.vim @ 34485:157cf882799f v9.1.0150

patch 9.1.0150: Several minor 'winfixbuf' issues Commit: https://github.com/vim/vim/commit/4bb505e28cac0389561fff78d8bbe0319c2bcf2f Author: Sean Dewar <6256228+seandewar@users.noreply.github.com> Date: Tue Mar 5 20:39:07 2024 +0100 patch 9.1.0150: Several minor 'winfixbuf' issues Problem: several minor 'winfixbuf' issues exist, mostly relating to the quickfix list Solution: address them and adjust tests. Retab and reflow a few things too. (Sean Dewar) Things touched include: - Replace the semsgs with gettext'd emsgs. - Handle window switching in ex_listdo properly, so curbuf and curwin are kept in-sync and trigger autocommands; handle those properly. - Don't change the list entry index in qf_jump_edit_buffer if we fail due to 'wfb' (achieved by returning FAIL; QF_ABORT should only be used if the list was changed). - Make qf_jump_edit_buffer actually switch to prevwin when using `:cXX` commands **outside** of the list window if 'wfb' is set in curwin. Handle autocommands properly in case they mess with the list. NOTE: previously, it seemed to split if 'wfb' was set, but do nothing and fail if prevwin is *valid*. This behaviour seemed strange, and maybe unintentional? Now it aligns more with what's described for the `:cXX` commands in the original PR description when used outside a list window, I think. - In both functions, only consider prevwin if 'wfb' isn't set for it; fallback to splitting otherwise. - Use win_split to split. Not sure if there was a specific reason for using ex_splitview. win_split is simpler and respects modifiers like :vertical that may have been used. Plus, its return value can be checked for setting opened_window in qf code (technically win_split_ins autocmds could immediately close it or change windows, in which the qf code might close some other window on failure; it's already the case elsewhere, though). closes: #14142 Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Tue, 05 Mar 2024 20:45:04 +0100
parents 46763b01cd9a
children
line wrap: on
line source

" Vim syntax file
" Language:	X resources files like ~/.Xdefaults (xrdb)
" Maintainer:	Johannes Zellner <johannes@zellner.org>
"		Author and previous maintainer:
"		Gautam H. Mudunuri <gmudunur@informatica.com>
" Last Change:	Di, 09 Mai 2006 23:10:23 CEST
" $Id: xdefaults.vim,v 1.2 2007/05/05 17:19:40 vimboss Exp $
"
" REFERENCES:
"   xrdb manual page
"   xrdb source: ftp://ftp.x.org/pub/R6.4/xc/programs/xrdb/xrdb.c

" quit when a syntax file was already loaded
if exists("b:current_syntax")
  finish
endif

" turn case on
syn case match


if !exists("xdefaults_no_colon_errors")
    " mark lines which do not contain a colon as errors.
    " This does not really catch all errors but only lines
    " which contain at least two WORDS and no colon. This
    " was done this way so that a line is not marked as
    " error while typing (which would be annoying).
    syntax match xdefaultsErrorLine "^\s*[a-zA-Z.*]\+\s\+[^: 	]\+"
endif


" syn region  xdefaultsLabel   start=+^[^:]\{-}:+he=e-1 skip=+\\+ end="$"
syn match   xdefaultsLabel   +^[^:]\{-}:+he=e-1                       contains=xdefaultsPunct,xdefaultsSpecial,xdefaultsLineEnd
syn region  xdefaultsValue   keepend start=+:+lc=1 skip=+\\+ end=+$+ contains=xdefaultsSpecial,xdefaultsLabel,xdefaultsLineEnd

syn match   xdefaultsSpecial	contained +#override+
syn match   xdefaultsSpecial	contained +#augment+
syn match   xdefaultsPunct	contained +[.*:]+
syn match   xdefaultsLineEnd	contained +\\$+
syn match   xdefaultsLineEnd	contained +\\n\\$+
syn match   xdefaultsLineEnd	contained +\\n$+



" COMMENTS

" note, that the '!' must be at the very first position of the line
syn match   xdefaultsComment "^!.*$"                     contains=xdefaultsTodo,@Spell

" lines starting with a '#' mark and which are not preprocessor
" lines are skipped.  This is not part of the xrdb documentation.
" It was reported by Bram Moolenaar and could be confirmed by
" having a look at xrdb.c:GetEntries()
syn match   xdefaultsCommentH		"^#.*$"
"syn region  xdefaultsComment start="^#"  end="$" keepend contains=ALL
syn region  xdefaultsComment start="/\*" end="\*/"       contains=xdefaultsTodo,@Spell

syntax match xdefaultsCommentError	"\*/"

syn keyword xdefaultsTodo contained TODO FIXME XXX display



" PREPROCESSOR STUFF

syn region	xdefaultsPreProc	start="^\s*#\s*\(if\|ifdef\|ifndef\|elif\|else\|endif\)\>" skip="\\$" end="$" contains=xdefaultsSymbol
if !exists("xdefaults_no_if0")
  syn region	xdefaultsCppOut		start="^\s*#\s*if\s\+0\>" end=".\|$" contains=xdefaultsCppOut2
  syn region	xdefaultsCppOut2	contained start="0" end="^\s*#\s*\(endif\>\|else\>\|elif\>\)" contains=xdefaultsCppSkip
  syn region	xdefaultsCppSkip	contained start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*#\s*endif\>" contains=xdefaultsCppSkip
endif
syn region	xdefaultsIncluded	contained start=+"+ skip=+\\\\\|\\"+ end=+"+
syn match	xdefaultsIncluded	contained "<[^>]*>"
syn match	xdefaultsInclude	"^\s*#\s*include\>\s*["<]" contains=xdefaultsIncluded
syn cluster	xdefaultsPreProcGroup	contains=xdefaultsPreProc,xdefaultsIncluded,xdefaultsInclude,xdefaultsDefine,xdefaultsCppOut,xdefaultsCppOut2,xdefaultsCppSkip
syn region	xdefaultsDefine		start="^\s*#\s*\(define\|undef\)\>" skip="\\$" end="$" contains=ALLBUT,@xdefaultsPreProcGroup,xdefaultsCommentH,xdefaultsErrorLine,xdefaultsLabel,xdefaultsValue
syn region	xdefaultsPreProc	start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@xdefaultsPreProcGroup,xdefaultsCommentH,xdefaultsErrorLine,xdefaultsLabel,xdefaultsValue



" symbols as defined by xrdb
syn keyword xdefaultsSymbol contained SERVERHOST
syn match   xdefaultsSymbol contained "SRVR_[a-zA-Z0-9_]\+"
syn keyword xdefaultsSymbol contained HOST
syn keyword xdefaultsSymbol contained DISPLAY_NUM
syn keyword xdefaultsSymbol contained CLIENTHOST
syn match   xdefaultsSymbol contained "CLNT_[a-zA-Z0-9_]\+"
syn keyword xdefaultsSymbol contained RELEASE
syn keyword xdefaultsSymbol contained REVISION
syn keyword xdefaultsSymbol contained VERSION
syn keyword xdefaultsSymbol contained VENDOR
syn match   xdefaultsSymbol contained "VNDR_[a-zA-Z0-9_]\+"
syn match   xdefaultsSymbol contained "EXT_[a-zA-Z0-9_]\+"
syn keyword xdefaultsSymbol contained NUM_SCREENS
syn keyword xdefaultsSymbol contained SCREEN_NUM
syn keyword xdefaultsSymbol contained BITS_PER_RGB
syn keyword xdefaultsSymbol contained CLASS
syn keyword xdefaultsSymbol contained StaticGray GrayScale StaticColor PseudoColor TrueColor DirectColor
syn match   xdefaultsSymbol contained "CLASS_\(StaticGray\|GrayScale\|StaticColor\|PseudoColor\|TrueColor\|DirectColor\)"
syn keyword xdefaultsSymbol contained COLOR
syn match   xdefaultsSymbol contained "CLASS_\(StaticGray\|GrayScale\|StaticColor\|PseudoColor\|TrueColor\|DirectColor\)_[0-9]\+"
syn keyword xdefaultsSymbol contained HEIGHT
syn keyword xdefaultsSymbol contained WIDTH
syn keyword xdefaultsSymbol contained PLANES
syn keyword xdefaultsSymbol contained X_RESOLUTION
syn keyword xdefaultsSymbol contained Y_RESOLUTION

" Define the default highlighting.
" Only when an item doesn't have highlighting yet
hi def link xdefaultsLabel		Type
hi def link xdefaultsValue		Constant
hi def link xdefaultsComment	Comment
hi def link xdefaultsCommentH	xdefaultsComment
hi def link xdefaultsPreProc	PreProc
hi def link xdefaultsInclude	xdefaultsPreProc
hi def link xdefaultsCppSkip	xdefaultsCppOut
hi def link xdefaultsCppOut2	xdefaultsCppOut
hi def link xdefaultsCppOut	Comment
hi def link xdefaultsIncluded	String
hi def link xdefaultsDefine	Macro
hi def link xdefaultsSymbol	Statement
hi def link xdefaultsSpecial	Statement
hi def link xdefaultsErrorLine	Error
hi def link xdefaultsCommentError	Error
hi def link xdefaultsPunct		Normal
hi def link xdefaultsLineEnd	Special
hi def link xdefaultsTodo		Todo


let b:current_syntax = "xdefaults"

" vim:ts=8