mirror of
https://github.com/notwa/rc
synced 2024-11-05 04:39:03 -08:00
syntax highlighting stuff
This commit is contained in:
parent
0aaf8ead84
commit
e3568cb593
3 changed files with 466 additions and 0 deletions
65
vim/autoload/SyntaxAttr.vim
Normal file
65
vim/autoload/SyntaxAttr.vim
Normal file
|
@ -0,0 +1,65 @@
|
|||
" EXAMPLE SETUP
|
||||
"
|
||||
" Show the syntax group name of the item under cursor.
|
||||
" map -a :call SyntaxAttr()<CR>
|
||||
|
||||
function! SyntaxAttr()
|
||||
let synid = ""
|
||||
let guifg = ""
|
||||
let guibg = ""
|
||||
let gui = ""
|
||||
|
||||
let id1 = synID(line("."), col("."), 1)
|
||||
let tid1 = synIDtrans(id1)
|
||||
|
||||
if synIDattr(id1, "name") != ""
|
||||
let synid = "group: " . synIDattr(id1, "name")
|
||||
if (tid1 != id1)
|
||||
let synid = synid . '->' . synIDattr(tid1, "name")
|
||||
endif
|
||||
let id0 = synID(line("."), col("."), 0)
|
||||
if (synIDattr(id1, "name") != synIDattr(id0, "name"))
|
||||
let synid = synid . " (" . synIDattr(id0, "name")
|
||||
let tid0 = synIDtrans(id0)
|
||||
if (tid0 != id0)
|
||||
let synid = synid . '->' . synIDattr(tid0, "name")
|
||||
endif
|
||||
let synid = synid . ")"
|
||||
endif
|
||||
endif
|
||||
|
||||
" Use the translated id for all the color & attribute lookups; the linked id yields blank values.
|
||||
if (synIDattr(tid1, "fg") != "" )
|
||||
let guifg = " guifg=" . synIDattr(tid1, "fg") . "(" . synIDattr(tid1, "fg#") . ")"
|
||||
endif
|
||||
if (synIDattr(tid1, "bg") != "" )
|
||||
let guibg = " guibg=" . synIDattr(tid1, "bg") . "(" . synIDattr(tid1, "bg#") . ")"
|
||||
endif
|
||||
if (synIDattr(tid1, "bold" ))
|
||||
let gui = gui . ",bold"
|
||||
endif
|
||||
if (synIDattr(tid1, "italic" ))
|
||||
let gui = gui . ",italic"
|
||||
endif
|
||||
if (synIDattr(tid1, "reverse" ))
|
||||
let gui = gui . ",reverse"
|
||||
endif
|
||||
if (synIDattr(tid1, "inverse" ))
|
||||
let gui = gui . ",inverse"
|
||||
endif
|
||||
if (synIDattr(tid1, "underline"))
|
||||
let gui = gui . ",underline"
|
||||
endif
|
||||
if (gui != "" )
|
||||
let gui = substitute(gui, "^,", " gui=", "")
|
||||
endif
|
||||
|
||||
echohl MoreMsg
|
||||
let message = synid . guifg . guibg . gui
|
||||
if message == ""
|
||||
echohl WarningMsg
|
||||
let message = "<no syntax group here>"
|
||||
endif
|
||||
echo message
|
||||
echohl None
|
||||
endfunction
|
162
vim/colors/property2.vim
Normal file
162
vim/colors/property2.vim
Normal file
|
@ -0,0 +1,162 @@
|
|||
" Property
|
||||
" a vim color scheme by @notwa
|
||||
" loosely based on Clearance by Chris Seelus (@ceelus)
|
||||
" built upon the Tomorrow scheme's functionality <http://chriskempson.com>
|
||||
|
||||
" other sources of inspiration:
|
||||
" colorful
|
||||
" redblack
|
||||
|
||||
" basically i split styling into:
|
||||
" built-in things you'd pass arguments to
|
||||
" built-in things you wouldn't that moreso construct the language (if, else)
|
||||
" built-in things you shouldn't use as variable names
|
||||
|
||||
" hi \([A-Za-z]\+\) \+guifg=\([^ ]\+\) \+guibg=\([^ ]\+\) \+gui=\(\w\+\)
|
||||
|
||||
let s:foreground = "D6DBD5"
|
||||
let s:background = "202121"
|
||||
|
||||
let s:white = "F9FAF7"
|
||||
|
||||
let s:backgrounder = "292B2C"
|
||||
let s:line_number = "484E52"
|
||||
let s:comment = "80908C"
|
||||
|
||||
let s:selection = "393C41"
|
||||
|
||||
" not including C chars ('x' syntax)
|
||||
let s:string = "BEE563"
|
||||
let s:stringer = "2A3026"
|
||||
|
||||
" sometimes true and false too, depending on the language
|
||||
let s:number = "FA7A76"
|
||||
|
||||
" a language constructor
|
||||
" maybe not true-blue enough?
|
||||
" maybe use pure (bold) white instead, and use this elsewhere
|
||||
let s:language = "7DB8E8"
|
||||
|
||||
" don't overwrite me!
|
||||
let s:function = "64CCC5" " old seaweed color
|
||||
" needs a tad more saturation and brightness?
|
||||
let s:function = "5A7FD6"
|
||||
|
||||
" TODO: () colors, [] colors, {} colors (background for braces?)
|
||||
|
||||
hi clear
|
||||
if exists("syntax_on") | syntax reset | endif
|
||||
set background=dark
|
||||
|
||||
let g:colors_name = "property2"
|
||||
|
||||
" Sets the highlighting for the given group
|
||||
fu! <SID>X(group, fg, bg, attr)
|
||||
let l:fg=a:fg
|
||||
let l:bg=a:bg
|
||||
if a:fg != "" && a:fg != "NONE" | let l:fg="#".l:fg | endif
|
||||
if a:bg != "" && a:bg != "NONE" | let l:bg="#".l:bg | endif
|
||||
if a:fg != "" | exec "hi! ".a:group." guifg=".l:fg | endif
|
||||
if a:bg != "" | exec "hi! ".a:group." guibg=".l:bg | endif
|
||||
if a:attr != "" | exec "hi! ".a:group." gui=".a:attr | endif
|
||||
endfun
|
||||
|
||||
" Interface
|
||||
|
||||
call <SID>X("Normal", s:foreground, s:background, "")
|
||||
call <SID>X("LineNr", s:line_number, "", "")
|
||||
call <SID>X("NonText", s:foreground, "", "")
|
||||
call <SID>X("SpecialKey", s:line_number, "", "")
|
||||
call <SID>X("Search", "NONE", s:backgrounder, "underline")
|
||||
call <SID>X("TabLine", s:foreground, "", "")
|
||||
call <SID>X("TabLineFill", s:foreground, "", "")
|
||||
"call <SID>X("StatusLine", s:foreground, "", "")
|
||||
"call <SID>X("StatusLineNC", s:foreground, "", "")
|
||||
call <SID>X("VertSplit", s:foreground, "", "")
|
||||
call <SID>X("Visual", s:foreground, s:selection, "")
|
||||
call <SID>X("Directory", s:foreground, "", "")
|
||||
call <SID>X("ModeMsg", s:foreground, "", "")
|
||||
call <SID>X("MoreMsg", s:foreground, "", "")
|
||||
call <SID>X("Question", s:foreground, "", "")
|
||||
call <SID>X("WarningMsg", s:foreground, "", "")
|
||||
call <SID>X("MatchParen", s:foreground, "", "")
|
||||
call <SID>X("Folded", s:foreground, "", "")
|
||||
call <SID>X("FoldColumn", s:foreground, "", "")
|
||||
call <SID>X("CursorLine", s:foreground, "", "")
|
||||
call <SID>X("CursorColumn", s:foreground, "", "")
|
||||
call <SID>X("PMenu", s:foreground, "", "")
|
||||
call <SID>X("PMenuSel", s:foreground, "", "")
|
||||
call <SID>X("SignColumn", s:foreground, "", "")
|
||||
call <SID>X("ColorColumn", "", s:backgrounder, "")
|
||||
|
||||
" Syntax highlighting
|
||||
|
||||
call <SID>X("Todo", s:white, s:background, "bold,italic")
|
||||
call <SID>X("Title", s:foreground, "", "")
|
||||
call <SID>X("Identifier", s:language, "", "")
|
||||
call <SID>X("Structure", s:language, "", "")
|
||||
call <SID>X("Constant", s:number, "", "")
|
||||
call <SID>X("Special", s:white, "", "bold")
|
||||
call <SID>X("Operator", s:foreground, "", "")
|
||||
call <SID>X("Delimiter", s:foreground, "", "")
|
||||
|
||||
call <SID>X("Comment", s:comment, "", "italic")
|
||||
call <SID>X("Function", s:function, "", "NONE")
|
||||
call <SID>X("Statement", s:white, "", "bold")
|
||||
call <SID>X("Repeat", s:language, "", "bold")
|
||||
call <SID>X("Keyword", s:language, "", "NONE")
|
||||
call <SID>X("Conditional", s:language, "", "NONE")
|
||||
call <SID>X("String", s:string, s:stringer, "")
|
||||
call <SID>X("Type", s:function, "", "NONE") " not too bad as s:number
|
||||
call <SID>X("PreProc", s:foreground, "", "NONE")
|
||||
call <SID>X("Define", s:function, "", "NONE")
|
||||
call <SID>X("Include", s:foreground, "", "NONE")
|
||||
call <SID>X("Number", s:number, "", "")
|
||||
|
||||
hi link vimCommand Keyword
|
||||
hi link vimCommentString Comment
|
||||
hi link vimFuncVar Normal
|
||||
hi link vimVar Normal
|
||||
|
||||
hi link pythonBoolean Constant
|
||||
hi link pythonBuiltin Function
|
||||
hi link pythonBuiltinFunc Function
|
||||
hi link pythonConditional Structure
|
||||
hi link pythonException Structure
|
||||
hi link pythonImport Function
|
||||
hi link pythonInclude Function
|
||||
hi link pythonOperator Structure
|
||||
hi link pythonRepeat Structure
|
||||
hi link pythonRun Comment
|
||||
hi link pythonStatement Structure
|
||||
|
||||
" FIXME: escapes shouldn't override string background
|
||||
hi link luaCond Structure
|
||||
hi link luaCondElseif Structure
|
||||
hi link luaCondEnd Structure
|
||||
hi link luaCondStart Structure
|
||||
hi link luaFunc Function
|
||||
hi link luaFunction Function
|
||||
hi link luaRepeat Structure
|
||||
hi link luaStatement Structure
|
||||
|
||||
"hi link Operator Normal
|
||||
"hi link Character Constant
|
||||
"hi link Boolean Constant
|
||||
"hi link Float Number
|
||||
"hi link Repeat Statement
|
||||
"hi link Label Statement
|
||||
"hi link Exception Statement
|
||||
"hi link Include PreProc
|
||||
"hi link Define PreProc
|
||||
"hi link Macro PreProc
|
||||
"hi link PreCondit PreProc
|
||||
"hi link StorageClass Type
|
||||
"hi link Structure Type
|
||||
"hi link Typedef Type
|
||||
"hi link Tag Special
|
||||
"hi link SpecialChar Special
|
||||
"hi link SpecialComment Special
|
||||
"hi link Debug Special
|
||||
|
||||
delf <SID>X
|
239
vim/syntax/lips.vim
Normal file
239
vim/syntax/lips.vim
Normal file
|
@ -0,0 +1,239 @@
|
|||
" Vim syn file
|
||||
" Language: lips assembly
|
||||
" Maintainer: notwa
|
||||
" Last Change: 2016-01-05
|
||||
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn case ignore
|
||||
|
||||
syn region lipsString start=/"/ skip=/\\"/ end=/"/
|
||||
syn region asmComment start="/\*" end="\*/"
|
||||
syn match lipsComment /\(\/\/\|;\).*/
|
||||
|
||||
syn match lipsNumber /\<[+-]\?\d\+\>/ " Decimal numbers
|
||||
syn match lipsNumber /\<[+-]\?0x[0-9a-f]\+\>/ " Hex numbers
|
||||
syn match lipsNumber /\<[+-]\?0[0-7]\+\>/ " Octal numbers
|
||||
|
||||
syn match lipsColon /:/ contained
|
||||
syn match lipsLabel /[a-z_][a-z0-9_]*:/ contains=lipsColon
|
||||
syn match lipsLabel /[+-]:/ contains=lipsColon
|
||||
syn match lipsDefine /\[[a-z0-9_]\+\]:/ contains=lipsColon
|
||||
syn match lipsDefine /@[a-z0-9_]\+/
|
||||
|
||||
" Registers
|
||||
syn keyword lipsRegister r0
|
||||
syn keyword lipsRegister v0 v1
|
||||
syn keyword lipsRegister a0 a1 a2 a3
|
||||
syn keyword lipsRegister t0 t1 t2 t3 t4 t5 t6 t7 t8 t9
|
||||
syn keyword lipsRegister s0 s1 s2 s3 s4 s5 s6 s7
|
||||
syn keyword lipsRegister k0 k1
|
||||
syn keyword lipsRegister gp sp fp
|
||||
syn keyword lipsRegister ra
|
||||
|
||||
" Register aliases
|
||||
syn keyword lipsRegister zero
|
||||
syn keyword lipsRegister s8
|
||||
|
||||
" Coprocessor 0 registers
|
||||
syn keyword lipsRegister index random entrylo0 entrylo1
|
||||
syn keyword lipsRegister context pagemask wired reserved0
|
||||
syn keyword lipsRegister badvaddr count entryhi compare
|
||||
syn keyword lipsRegister status cause epc previd
|
||||
syn keyword lipsRegister config lladdr watchlo watchhi
|
||||
syn keyword lipsRegister xcontext reserved1 reserved2 reserved3
|
||||
syn keyword lipsRegister reserved4 reserved5 perr cacheerr
|
||||
syn keyword lipsRegister taglo taghi errorepc reserved6
|
||||
|
||||
" Register numeric aliases and FPU registers
|
||||
let i = 0
|
||||
while i < 32
|
||||
execute 'syn keyword lipsRegister r'.i
|
||||
execute 'syn keyword lipsRegister f'.i
|
||||
let i = i + 1
|
||||
endwhile
|
||||
|
||||
" Directives
|
||||
syn match lipsDirective "\.align\>"
|
||||
syn match lipsDirective "\.skip\>"
|
||||
syn match lipsDirective "\.ascii\>"
|
||||
syn match lipsDirective "\.asciiz\>"
|
||||
syn match lipsDirective "\.byte\>"
|
||||
syn match lipsDirective "\.halfword\>"
|
||||
syn match lipsDirective "\.word\>"
|
||||
syn match lipsDirective "\.float\>"
|
||||
syn match lipsDirective "\.hex\>"
|
||||
syn match lipsDirective "\.inc\>"
|
||||
syn match lipsDirective "\.incasm\>"
|
||||
syn match lipsDirective "\.include\>"
|
||||
syn match lipsDirective "\.incbin\>"
|
||||
syn match lipsDirective "\.org\>"
|
||||
|
||||
" Instructions
|
||||
|
||||
syn keyword lipsInstruction LB LBU
|
||||
syn keyword lipsInstruction LD
|
||||
syn keyword lipsInstruction LDL LDR
|
||||
syn keyword lipsInstruction LH LHU
|
||||
syn keyword lipsInstruction LL LLD
|
||||
syn keyword lipsInstruction LUI
|
||||
syn keyword lipsInstruction LW LWU
|
||||
syn keyword lipsInstruction LWL LWR
|
||||
|
||||
syn keyword lipsInstruction SB
|
||||
syn keyword lipsInstruction SC SCD
|
||||
syn keyword lipsInstruction SD
|
||||
syn keyword lipsInstruction SDL SDR
|
||||
syn keyword lipsInstruction SH
|
||||
syn keyword lipsInstruction SW
|
||||
syn keyword lipsInstruction SWL SWR
|
||||
|
||||
syn keyword lipsInstruction ADD ADDI ADDIU ADDU
|
||||
syn keyword lipsInstruction AND ANDI
|
||||
syn keyword lipsInstruction MULT MULTU
|
||||
syn keyword lipsInstruction NOR
|
||||
syn keyword lipsInstruction OR ORI
|
||||
syn keyword lipsInstruction SLL SLLV
|
||||
syn keyword lipsInstruction SRA SRAV
|
||||
syn keyword lipsInstruction SRL SRLV
|
||||
syn keyword lipsInstruction SUB SUBU
|
||||
syn keyword lipsInstruction XOR XORI
|
||||
|
||||
syn keyword lipsInstruction DADD DADDI DADDIU DADDU
|
||||
syn keyword lipsInstruction DDIV DDIVU
|
||||
syn keyword lipsInstruction DIV DIVU
|
||||
syn keyword lipsInstruction DMULT DMULTU
|
||||
syn keyword lipsInstruction DSLL DSLL32 DSLLV
|
||||
syn keyword lipsInstruction DSRA DSRA32 DSRAV
|
||||
syn keyword lipsInstruction DSRL DSRL32 DSRLV
|
||||
syn keyword lipsInstruction DSUB DSUBU
|
||||
|
||||
syn keyword lipsInstruction J JR
|
||||
syn keyword lipsInstruction JAL JALR
|
||||
|
||||
syn keyword lipsInstruction SLT SLTI SLTIU SLTU
|
||||
|
||||
syn keyword lipsInstruction BEQ BEQL
|
||||
syn keyword lipsInstruction BGEZ BGEZAL BGEZALL BGEZL
|
||||
syn keyword lipsInstruction BGTZ BGTZL
|
||||
syn keyword lipsInstruction BLEZ BLEZL
|
||||
syn keyword lipsInstruction BLTZ BLTZAL BLTZALL BLTZL
|
||||
syn keyword lipsInstruction BNE BNEL
|
||||
|
||||
" Coprocessor-related instructions, etc.
|
||||
|
||||
syn keyword lipsInstruction BC1F BC1FL
|
||||
syn keyword lipsInstruction BC1T BC1TL
|
||||
|
||||
syn keyword lipsInstruction CFC1 CTC1
|
||||
syn keyword lipsInstruction DMFC1 DMTC1
|
||||
syn keyword lipsInstruction LDC1 LWC1
|
||||
syn keyword lipsInstruction MFC0 MTC0
|
||||
syn keyword lipsInstruction MFC1 MTC1
|
||||
syn keyword lipsInstruction MFHI MFLO
|
||||
syn keyword lipsInstruction MTHI MTLO
|
||||
syn keyword lipsInstruction SDC1 SWC1
|
||||
|
||||
syn keyword lipsInstruction BREAK
|
||||
syn keyword lipsInstruction CACHE
|
||||
syn keyword lipsInstruction ERET
|
||||
syn keyword lipsInstruction SYNC
|
||||
syn keyword lipsInstruction SYSCALL
|
||||
|
||||
syn keyword lipsInstruction TEQ TEQI
|
||||
syn keyword lipsInstruction TGE TGEI TGEIU TGEU
|
||||
syn keyword lipsInstruction TLBP TLBR
|
||||
syn keyword lipsInstruction TLBWI TLBWR
|
||||
syn keyword lipsInstruction TLT TLTI TLTIU TLTU
|
||||
syn keyword lipsInstruction TNE TNEI
|
||||
|
||||
syn match lipsInstruction /\<ABS\.[DS]\>/
|
||||
syn match lipsInstruction /\<ADD\.[DS]\>/
|
||||
syn match lipsInstruction /\<DIV\.[DS]\>/
|
||||
syn match lipsInstruction /\<MOV\.[DS]\>/
|
||||
syn match lipsInstruction /\<MUL\.[DS]\>/
|
||||
syn match lipsInstruction /\<NEG\.[DS]\>/
|
||||
syn match lipsInstruction /\<SQRT\.[DS]\>/
|
||||
syn match lipsInstruction /\<SUB\.[DS]\>/
|
||||
|
||||
syn match lipsInstruction /\<CVT\.D\.[LSW]\>/
|
||||
syn match lipsInstruction /\<CVT\.L\.[DS]\>/
|
||||
syn match lipsInstruction /\<CVT\.S\.[DSW]\>/
|
||||
syn match lipsInstruction /\<CVT\.W\.[DS]\>/
|
||||
|
||||
syn match lipsInstruction /\<CEIL\.L\.[DS]\>/
|
||||
syn match lipsInstruction /\<CEIL\.W\.[DS]\>/
|
||||
syn match lipsInstruction /\<FLOOR\.L\.[DS]\>/
|
||||
syn match lipsInstruction /\<FLOOR\.W\.[DS]\>/
|
||||
syn match lipsInstruction /\<ROUND\.L\.[DS]\>/
|
||||
syn match lipsInstruction /\<ROUND\.W\.[DS]\>/
|
||||
syn match lipsInstruction /\<TRUNC\.L\.[DS]\>/
|
||||
syn match lipsInstruction /\<TRUNC\.W\.[DS]\>/
|
||||
|
||||
syn match lipsInstruction /\<C\.EQ\.[DS]\>/
|
||||
syn match lipsInstruction /\<C\.F\.[DS]\>/
|
||||
syn match lipsInstruction /\<C\.LE\.[DS]\>/
|
||||
syn match lipsInstruction /\<C\.LT\.[DS]\>/
|
||||
syn match lipsInstruction /\<C\.NGE\.[DS]\>/
|
||||
syn match lipsInstruction /\<C\.NGLE\.[DS]\>/
|
||||
syn match lipsInstruction /\<C\.NGL\.[DS]\>/
|
||||
syn match lipsInstruction /\<C\.NGT\.[DS]\>/
|
||||
syn match lipsInstruction /\<C\.OLE\.[DS]\>/
|
||||
syn match lipsInstruction /\<C\.OLT\.[DS]\>/
|
||||
syn match lipsInstruction /\<C\.SEQ\.[DS]\>/
|
||||
syn match lipsInstruction /\<C\.SF\.[DS]\>/
|
||||
syn match lipsInstruction /\<C\.UEQ\.[DS]\>/
|
||||
syn match lipsInstruction /\<C\.ULE\.[DS]\>/
|
||||
syn match lipsInstruction /\<C\.ULT\.[DS]\>/
|
||||
syn match lipsInstruction /\<C\.UN\.[DS]\>/
|
||||
|
||||
" Pseudo-instructions
|
||||
|
||||
syn keyword lipsInstruction B BAL
|
||||
syn keyword lipsInstruction BEQZ BNEZ
|
||||
syn keyword lipsInstruction CL
|
||||
syn keyword lipsInstruction MOV
|
||||
syn keyword lipsInstruction NEG
|
||||
syn keyword lipsInstruction NOP
|
||||
syn keyword lipsInstruction NOT
|
||||
syn keyword lipsInstruction SUBI SUBIU
|
||||
|
||||
syn keyword lipsInstruction LI LA
|
||||
|
||||
syn keyword lipsInstruction PUSH
|
||||
syn keyword lipsInstruction POP JPOP
|
||||
|
||||
syn keyword lipsInstruction ABS
|
||||
syn keyword lipsInstruction MUL
|
||||
syn keyword lipsInstruction REM
|
||||
syn keyword lipsInstruction NAND NANDI
|
||||
syn keyword lipsInstruction NORI
|
||||
syn keyword lipsInstruction ROL ROR
|
||||
|
||||
syn keyword lipsInstruction SEQ SEQI SEQIU SEQU
|
||||
syn keyword lipsInstruction SGE SGEI SGEIU SGEU
|
||||
syn keyword lipsInstruction SGT SGTI SGTIU SGTU
|
||||
syn keyword lipsInstruction SLE SLEI SLEIU SLEU
|
||||
syn keyword lipsInstruction SNE SNEI SNEIU SNEU
|
||||
|
||||
syn keyword lipsInstruction BEQI
|
||||
syn keyword lipsInstruction BNEI
|
||||
syn keyword lipsInstruction BGE BGEI
|
||||
syn keyword lipsInstruction BLE BLEI
|
||||
syn keyword lipsInstruction BLT BLTI
|
||||
syn keyword lipsInstruction BGT BGTI
|
||||
|
||||
hi def link lipsComment Comment
|
||||
hi def link lipsNumber Number
|
||||
hi def link lipsString String
|
||||
hi def link lipsLabel Type
|
||||
hi def link lipsRegister Identifier
|
||||
hi def link lipsDirective Special
|
||||
hi def link lipsInstruction Statement
|
||||
hi def link lipsDefine Define
|
||||
|
||||
let b:current_syntax = "lips"
|
Loading…
Reference in a new issue