From 37605b8c9500ede867014459eef1ee42a2bb2ad1 Mon Sep 17 00:00:00 2001 From: katherine Date: Tue, 27 Nov 2018 03:34:28 -0700 Subject: vim linting --- .vim/colors/shmibs.vim | 12 ++--- .vim/spell/en.utf-8.add | 8 +++ .vim/syntax/z80.vim | 129 ++++++++++++++++++++++++++++++++++++++++++++++++ .vimrc | 22 ++++++--- 4 files changed, 158 insertions(+), 13 deletions(-) create mode 100644 .vim/spell/en.utf-8.add create mode 100644 .vim/syntax/z80.vim diff --git a/.vim/colors/shmibs.vim b/.vim/colors/shmibs.vim index 3b0043e..2dc4d20 100644 --- a/.vim/colors/shmibs.vim +++ b/.vim/colors/shmibs.vim @@ -1,20 +1,17 @@ -"Vim color file -"intended for 256 colour term +"simple 16-colour scheme hi! clear let g:colors_name="shmibs" -hi! Comment ctermfg=12 +hi! Comment ctermfg=blue hi! Constant ctermfg=red -hi! CursorLine ctermfg=NONE ctermbg=8 cterm=NONE -hi! CursorLineNr ctermfg=white ctermbg=8 cterm=bold hi! Directory ctermfg=cyan hi! DiffAdd ctermfg=green ctermbg=NONE cterm=bold hi! DiffDelete ctermfg=red ctermbg=NONE cterm=bold hi! DiffChange ctermfg=blue ctermbg=NONE cterm=bold hi! DiffText ctermfg=black ctermbg=yellow cterm=NONE -hi! Folded ctermfg=8 ctermbg=NONE +hi! Folded ctermfg=8 ctermbg=NONE cterm=bold hi! Identifier cterm=bold ctermfg=cyan hi! NonText ctermfg=yellow ctermbg=black cterm=bold hi! PreProc ctermfg=magenta @@ -49,3 +46,6 @@ hi! link SpellLocal SpellBad hi! link String Constant hi! link StorageClass Type hi! link Tag Special +hi! link Search Visual +hi! link CursorLine Visual +hi! link CursorLineNr Visual diff --git a/.vim/spell/en.utf-8.add b/.vim/spell/en.utf-8.add new file mode 100644 index 0000000..a7b8ed6 --- /dev/null +++ b/.vim/spell/en.utf-8.add @@ -0,0 +1,8 @@ +i've +i +i'd +i'm +i've +highlit +sensical +variance diff --git a/.vim/syntax/z80.vim b/.vim/syntax/z80.vim new file mode 100644 index 0000000..e00db87 --- /dev/null +++ b/.vim/syntax/z80.vim @@ -0,0 +1,129 @@ +syn case ignore + +set isk=a-z,A-Z,48-57,',.,_ + +syn sync fromstart + +"Common Z80 Assembly instructions +syn keyword z80Inst adc add and bit call ccf cp cpd cpdr cpi cpir cpl +syn keyword z80Inst daa dec di djnz ei ex exx halt im in +syn keyword z80Inst inc ind ini indr inir jp jr ld ldd lddr ldi ldir +syn keyword z80Inst neg nop or otdr otir out outd outi push pop +syn keyword z80Inst res ret reti retn rl rla rlc rlca rld +syn keyword z80Inst rr rra rrc rrca rrd rst sbc scf set sl1 sla slia sll sra +syn keyword z80Inst srl sub xor +" +" Directives +syn match z80PreProc "#\(define\|if\|ifdef\|ifdefm\|ifeq\|ifexists\|ifgr\|ifgreq\)" +syn match z80PreProc "#\(ifle\|ifleeq\|ifndef\|ifdefm\|ifneq\|include\|redefine\)" +syn match z80PreProc "#\(undefine\|undef\)" + +syn keyword z80PreProc .emptyfill .export .outname .asc .background .bank +syn keyword z80PreProc .byt .rombanksize .db .dbcos .dbrnd .dbsin .def +syn keyword z80PreProc .ds .dsb .dstruct .dsw .dw .dwcos .dwrnd .dwsin .else +syn keyword z80PreProc .ende .endif .endm .endme .endr .endro .ends .endst +syn keyword z80PreProc .enum .equ .fail .fclose .fopen .fread .fsize .incbin +syn keyword z80PreProc .ramsection .incdir .input .macro .memorymap .org .orga +syn keyword z80PreProc .printt .printv .redef .repeat .rept .rombankmap .rombanks +syn keyword z80PreProc .seed .section .slot .struct .unbackground .word .shift +syn keyword z80PreProc .sym .symbol + +syn keyword z80PreProc align data db ds dsb dsw dw fsize instanceof read skip slot swap +syn keyword z80PreProc defaultslot slotsize bankstotal banksize banks free force +syn keyword z80PreProc semifree size superfree + +"Grab the condition too +syn match z80Inst "\s\+jp\s\+n\=[covz]\>" "Match Z C O V NZ NC NO NV +syn match z80Inst "\s\+jp\s\+p[elo]\=\>" "Match P PE PO PL +syn match z80Inst "\s\+jp\s\+mi\=\>" "Match M MI +syn match z80Inst "\s\+jp\s\+eq\>" "Match EQ +syn match z80Inst "\s\+jp\s\+[gn]e\>" "Match NE GE +syn match z80Inst "\s\+jp\s\+lt\>" "Match LT +syn match z80Inst "\s\+jp\s\+sn\=f\>" "Match SF SNF + +syn match z80Inst "\s\+jr\s\+n\=[zc]\>" "Match Z C NZ NC +syn match z80Inst "\s\+jr\s\+eq\>" "Match EQ +syn match z80Inst "\s\+jr\s\+[gn]e\>" "Match NE GE +syn match z80Inst "\s\+jr\s\+lt\>" "Match LT + +syn match z80Inst "\s\+call\s\+n\=[covz]\>" "Match Z C O V NZ NC NO NV +syn match z80Inst "\s\+call\s\+p[elo]\=\>" "Match P PE PO PL +syn match z80Inst "\s\+call\s\+mi\=\>" "Match M MI +syn match z80Inst "\s\+call\s\+eq\>" "Match EQ +syn match z80Inst "\s\+call\s\+[gn]e\>" "Match NE GE +syn match z80Inst "\s\+call\s\+lt\>" "Match LT +syn match z80Inst "\s\+call\s\+sn\=f\>" "Match SF SNF + +syn match z80Inst "\s\+ret\s\+n\=[covz]\>" "Match Z C O V NZ NC NO NV +syn match z80Inst "\s\+ret\s\+p[elo]\=\>" "Match P PE PO PL +syn match z80Inst "\s\+ret\s\+mi\=\>" "Match M MI +syn match z80Inst "\s\+ret\s\+eq\>" "Match EQ +syn match z80Inst "\s\+ret\s\+[gn]e\>" "Match NE GE +syn match z80Inst "\s\+ret\s\+lt\>" "Match LT +syn match z80Inst "\s\+ret\s\+sn\=f\>" "Match SF SNF + +" Registers +syn keyword z80Reg af af' bc de hl ix ixh ixl iy iyh iyl +syn keyword z80Reg sp a b c d e f h i l r + +" Strings +syn region z80String start=/"/ skip=/\\"/ end=/"/ oneline +syn region z80String start=/'/ end=/'/ oneline + +" Labels +syn match z80Lbl "[A-Z_.?][A-Z_.?0-9]*:\=" +syn region z80Lbl2 start="(" end=")" oneline contains=z80Number,z80Lbl,z80Lbl2,z80Other + +" Operators +syn match z80Other "[~+\-*/%^&=!<>]" + +" Numbers +syn match z80Number "\<\$\>" +syn match z80Number "\<[01]\+b\>" +syn match z80Number "\<\d\x*h\>" +syn match z80Number "\<\d\+\>" +syn match z80Number "\<%[01]\+\>" +syn match z80Number "\$[0-9a-fA-F]\+" + +" Indirect register access +syn region z80Reg start=/(ix/ end=/)/ keepend oneline contains=z80Lbl,z80Number,z80Reg,z80Other +syn region z80Reg start=/(iy/ end=/)/ keepend oneline contains=z80Lbl,z80Number,z80Reg,z80Other +syn match z80Reg "(b\=c)" +syn match z80Reg "(de)" +syn match z80Reg "(hl)" +syn match z80Reg "(sp)" + +" Comments +syn match z80Comment ";.*$" +syn match z80Comment "^\*$" +syn region z80Comment2 start="\<\.endasm\>" skip="\n" end="\<\.asm\>" keepend contains=z80Comment,z80Comment2 +syn region z80Comment start="\/\*" end="\*\/" + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_z80_syntax_inits") +if version < 508 +let did_z80_syntax_inits = 1 +command -nargs=+ HiLink hi link +else +command -nargs=+ HiLink hi def link +endif + +HiLink z80Reg Constant +HiLink z80Lbl Identifier +HiLink z80Lbl2 Identifier +HiLink z80Comment Comment +HiLink z80Comment2 Comment +HiLink z80Inst Statement +HiLink z80Include Include +HiLink z80PreProc PreProc +HiLink z80Number Number +HiLink z80String String +HiLink z80Other Normal + +delcommand HiLink +endif + +let b:current_syntax = "z80" +" vim: ts=8 diff --git a/.vimrc b/.vimrc index 382f661..cc1089d 100644 --- a/.vimrc +++ b/.vimrc @@ -3,7 +3,6 @@ if !has('gui_running') endif set nocompatible -filetype off @@ -52,6 +51,8 @@ Plugin 'tomtom/tcomment_vim' Plugin 'SirVer/ultisnips' Plugin 'honza/vim-snippets' +Plugin 'junegunn/vader.vim' + call vundle#end() @@ -205,8 +206,7 @@ call matchadd('Overwide', '\%81v', 100) highlight SpaceBeforeTab ctermbg=red call matchadd('SpaceBeforeTab', '\ \t') -"get rid of that annoying yellow explosion everywhere -"that neovim sets as default +"don't search highlighting set nohlsearch set encoding=utf-8 @@ -267,6 +267,10 @@ if &term != "linux" && has('clipboard') xnoremap P (v:register ==# '"' ? '"+' : '') . 'P' end +"use pgup/pgdwn for command history completion (matches zsh conf) +cnoremap +cnoremap + """"""""""""""""""""""" @@ -349,15 +353,19 @@ function! Settings_skel_read() endfunction "a 'writing mode' for prose-y formats +function! s:goyo_enter() + setlocal formatoptions+=a +endfunction + +function! s:goyo_leave() + setlocal formatoptions+=a +endfunction + function! Settings_sub_wmodetoggle() if &fo =~ 'a' - setlocal formatoptions-=a Goyo! - echo 'wmode off' else - setlocal formatoptions+=a Goyo - echo 'wmode on' end endfunction -- cgit v1.2.3