Custom syntax highlighting
For c and quickfix Function to format the quickfix and location jump lists Fixed issue with "help" window layouts accessing incorrect variable
This commit is contained in:
32
config/nvim/after/syntax/c.vim
Normal file
32
config/nvim/after/syntax/c.vim
Normal file
@@ -0,0 +1,32 @@
|
||||
syn clear cTodo
|
||||
syn clear cType
|
||||
|
||||
" Custom keywords
|
||||
"
|
||||
syn keyword cStorageClass function export internal global_var thread_var local_persist
|
||||
syn keyword cOperator cast
|
||||
|
||||
" Type highlighting
|
||||
"
|
||||
" There are inconsistencies around this due to the horrific declaration syntax of C/C++ and
|
||||
" trying to capture that inside a regexp statement is near impossible. These are made to mostly
|
||||
" match the way I format my code.
|
||||
"
|
||||
syn match cType "\I\i*\ze\s\+\**\I\i*\s*[=;,\)\[]" " Regular declarations
|
||||
syn match cType "\I\i*\ze\s\+\**\I\i*(" " Function return types
|
||||
|
||||
" Todo notes
|
||||
"
|
||||
syn match cTodo "@\I\i*\((\I\i*)\)\=:\?" contained
|
||||
syn match cNote "\s:\I\i*" contained
|
||||
|
||||
" Functions
|
||||
"
|
||||
syn match cFunction "\I\i*\ze("
|
||||
|
||||
" Contain clusters
|
||||
"
|
||||
syn cluster cCommentGroup add=cNote
|
||||
syn cluster cPreProcGroup add=cFunc,cType
|
||||
|
||||
hi def link cFunction Function
|
||||
28
config/nvim/after/syntax/qf.vim
Normal file
28
config/nvim/after/syntax/qf.vim
Normal file
@@ -0,0 +1,28 @@
|
||||
syn clear
|
||||
|
||||
" I have completely overriden the formatting for the quickfix and location list buffers so this
|
||||
" has to be changed to give proper highlighting of the new format
|
||||
"
|
||||
syn match qfSignError "\[!\]" contained
|
||||
syn match qfSignWarn "\[#\]" contained
|
||||
syn match qfSignSearch "\[\~\]" contained
|
||||
syn match qfFileName "^[^:]*" contains=@qfSign nextgroup=qfSeparator1
|
||||
syn match qfSeparator1 ":" contained nextgroup=qfLineNr
|
||||
syn match qfLineNr "[^:|]*" contained nextgroup=qfSeparator2,qfSeparator3
|
||||
syn match qfSeparator2 ":" contained nextgroup=qfColumnNr
|
||||
syn match qfColumnNr "[^|]*" contained
|
||||
syn match qfSeparator3 "|" contained
|
||||
|
||||
syn cluster qfSign contains=qfSignError,qfSignWarn,qfSignSearch
|
||||
|
||||
hi clear qfFileName
|
||||
hi clear qfLineNr
|
||||
|
||||
hi def link qfSignError DiagnosticSignError
|
||||
hi def link qfSignWarn DiagnosticSignWarn
|
||||
hi def link qfSignSearch LineNr
|
||||
hi def link qfFileName Function
|
||||
hi def link qfLineNr Number
|
||||
hi def link qfColumnNr Number
|
||||
|
||||
let b:current_syntax = "qf"
|
||||
Reference in New Issue
Block a user