├── README.md ├── ftdetect └── sproto.vim ├── ftplugin └── sproto.vim ├── syntax └── sproto.vim └── vim_sproto_screenshot.png /README.md: -------------------------------------------------------------------------------- 1 | # vim-sproto 2 | 3 | Vim syntax highlighting for Sproto 4 | 5 | ## Installation 6 | 1. cp sproto.vim ~/.vim/syntax/ 7 | 2. Add the following to ~/.vimrc: 8 | 9 | ```vim 10 | augroup filetype 11 | au! BufRead,BufNewFile *.sproto setfiletype sproto 12 | augroup end 13 | ``` 14 | Or just create a new file called ~/.vim/ftdetect/sproto.vim with the previous lines on it. 15 | 16 | ### Install with bundle 17 | 1. git clone https://github.com/spin6lock/vim_sproto ~/.vim/bundle/sproto 18 | 19 | ![Alt text](vim_sproto_screenshot.png?raw=true "screenshot") 20 | -------------------------------------------------------------------------------- /ftdetect/sproto.vim: -------------------------------------------------------------------------------- 1 | augroup filetype 2 | au! BufRead,BufNewFile *.sproto setfiletype sproto 3 | augroup end 4 | -------------------------------------------------------------------------------- /ftplugin/sproto.vim: -------------------------------------------------------------------------------- 1 | if exists("b:did_ftplugin") 2 | finish 3 | endif 4 | let b:did_ftplugin = 1 5 | 6 | let b:undo_ftplugin = "setl fo< com< cms<" 7 | 8 | setlocal commentstring=#\ %s 9 | 10 | -------------------------------------------------------------------------------- /syntax/sproto.vim: -------------------------------------------------------------------------------- 1 | " Usage: 2 | " 3 | " 1. cp sproto.vim ~/.vim/syntax/ 4 | " 2. Add the following to ~/.vimrc: 5 | " 6 | " augroup filetype 7 | " au! BufRead,BufNewFile *.sproto setfiletype sproto 8 | " augroup end 9 | " 10 | " Or just create a new file called ~/.vim/ftdetect/sproto.vim with the 11 | " previous lines on it. 12 | 13 | if exists("b:current_syntax") 14 | finish 15 | endif 16 | 17 | syntax case match 18 | syntax keyword spType integer string binary boolean 19 | syntax keyword spKeyword contained request response 20 | syntax keyword spTodo contained TODO FIXME XXX 21 | syntax cluster spCommentGrp contains=spTodo 22 | syntax match spOperator /:/ transparent 23 | syntax match spId /-\?\<\d\+\>/ 24 | syntax match spComment /#.*$/ contains=@spCommentGrp 25 | syntax match spStruct /\.[a-zA-Z_]\+\s/ contains=spType 26 | syntax match spStruct /*[a-zA-Z_.]\+/ contains=spType 27 | syntax match spStruct /:\s\+[a-zA-Z_.]\+/ contains=spType,spOperator,spComment 28 | syntax match spField /\s[A-Za-z][A-Za-z0-9_]*\s\+/ contains=spType,spKeyword nextgroup=spStruct 29 | 30 | hi def link spType Keyword 31 | hi def link spKeyword Keyword 32 | hi def link spTodo Todo 33 | hi def link spId Number 34 | hi def link spComment Comment 35 | hi def link spField Identifier 36 | hi def link spStruct Structure 37 | 38 | let b:current_syntax = "sproto" 39 | -------------------------------------------------------------------------------- /vim_sproto_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spin6lock/vim_sproto/713cbb824ef791f6dbbed3b22f38df032c838ca4/vim_sproto_screenshot.png --------------------------------------------------------------------------------