├── README.md
└── syntax
└── cruby.vim
/README.md:
--------------------------------------------------------------------------------
1 | # vim-cruby
2 |
3 | ## Configuration
4 |
5 | This is an example configuration:
6 |
7 | ```
8 | NeoBundle 'mrkn/vim-cruby'
9 | augroup cruby
10 | autocmd!
11 | autocmd BufWinEnter,BufNewFile ~/rubies/trunk/**/*.[chy] setlocal filetype=cruby
12 | augroup END
13 | ```
14 |
15 | ## Screenshot
16 |
17 | On `ft=c`:
18 | 
19 |
20 | On `ft=cruby`:
21 | 
22 |
23 | ## Copyright
24 |
25 | Copyright © 2013 Kenta Murata.
26 | Please see http://mrkn.mit-license.org/ for the License of this software.
27 |
--------------------------------------------------------------------------------
/syntax/cruby.vim:
--------------------------------------------------------------------------------
1 | " Vim syntax file
2 | " Language: CRuby
3 | " Maintainer: Kenta Murata
4 |
5 | if exists("b:current_syntax")
6 | finish
7 | endif
8 |
9 | runtime! syntax/c.vim
10 | unlet b:current_syntax
11 |
12 | if has("folding") && exists("cruby_fold")
13 | set foldmethod=syntax
14 | endif
15 |
16 | setlocal tabstop=8 softtabstop=4 shiftwidth=4 expandtab
17 | setlocal cinoptions=:2=2L2g2h2
18 |
19 | syn keyword crubyType VALUE ID RUBY_DATA_FUNC NODE BDIGIT BDIGIT_DBL BDIGIT_DBL_SIGNED
20 | syn keyword crubyType LONG_LONG SIGNED_VALUE
21 | syn keyword crubyType rb_global_variable rb_io_t rb_data_type_struct
22 | syn keyword crubyType rb_classext_struct rb_classext_t rb_data_type_t rb_subclass_entry_t
23 | syn keyword crubyType rb_gvar_getter_t rb_gvar_setter_t rb_gvar_marker_t
24 | syn keyword crubyType rb_method_entry_t rb_const_entry_t rb_iseq_t
25 | syn keyword crubyType rb_encoding rb_transcoding rb_econv_t rb_econv_elem_t rb_econv_result_t
26 | syn keyword crubyType ruby_glob_func
27 | syn keyword crubyType RBasic RObject RClass RFloat RString RArray RRegexp RHash RFile RRational RComplex RData RTypedData RStruct RBignum
28 | syn keyword crubyType st_table st_data st_data_t st_index_t st_hash_type
29 | syn match crubyType display "\<\(RUBY_\)\?T_\(NONE\|OBJECT\|CLASS\|MODULE\|FLOAT\|STRING\|REGEXP\|ARRAY\|HASH\|STRUCT\|BIGNUM\|FILE\|DATA\|MATCH\|COMPLEX\|RATIONAL\|NIL\|TRUE\|FALSE\|SYMBOL\|FIXNUM\|UNDEF\|NODE\|ICLASS\|ZOMBIE\|MASK\)\>"
30 |
31 | syn keyword crubyStatement ANYARGS NORETURN PRINTF_ARGS UNREACHABLE
32 | syn keyword crubyStorageClass RUBY_EXTERN
33 |
34 | syn keyword crubyOperator IMMEDIATE_P SPECIAL_CONST_P BUILTIN_TYPE SYMBOL_P FIXNUM_P NIL_P RTEST CLASS_OF METACLASS_OF
35 | syn match crubyOperator "\<\(INT\|LONG\)2\(FIX\|NUM\)\>"
36 | syn keyword crubyOperator UINT2NUM ULONG2NUM LL2NUM ULL2NUM OFFT2NUM SIZET2NUM SSIZET2NUM MODET2NUM DBL2NUM
37 | syn keyword crubyOperator NUM2LONG NUM2ULONG FIX2INT NUM2INT NUM2UINT FIX2UINT
38 | syn keyword crubyOperator NUM2LL NUM2ULL NUM2OFFT NUM2SIZET NUM2SSIZET NUM2MODET NUM2DBL NUM2CHR CHR2FIX
39 | syn keyword crubyOperator NEWOBJ NEWOBJ_OF OBJSETUP CLONESETUP DUPSETUP CONST_ID
40 | syn match crubyOperator "\"
41 | syn keyword crubyOperator PIDT2NUM NUM2PIDT
42 | syn keyword crubyOperator UIDT2NUM NUM2UIDT
43 | syn keyword crubyOperator GIDT2NUM NUM2GIDT
44 | syn keyword crubyOperator FIX2LONG FIX2ULONG
45 | syn match crubyOperator "\<\(POS\|NEG\)\?FIXABLE\>"
46 | syn keyword crubyOperator ID2SYM SYM2ID
47 | syn keyword crubyOperator RSHIFT BUILTIN_TYPE TYPE
48 | syn keyword crubyOperator RB_GC_GUARD_PTR RB_GC_GUARD
49 | syn keyword crubyOperator DATA_PTR RTYPEDDATA_P RTYPEDDATA_TYPE RTYPEDDATA_DATA
50 | syn keyword crubyOperator Check_Type Check_TypedStruct
51 | syn keyword crubyOperator StringValue StringValuePtr StringValueCPtr
52 | syn keyword crubyOperator SafeStringValue Check_SafeStr
53 | syn keyword crubyOperator ExportStringValue
54 | syn keyword crubyOperator FilePathValue
55 | syn keyword crubyOperator FilePathStringValue
56 | syn keyword crubyOperator ALLOC ALLOC_N REALLOC_N ALLOCA_N ALLOCV ALLOCV_N ALLOCV_END MEMZERO MEMCPY MEMMOVE MEMCMP
57 | syn match crubyOperator "\"
58 | syn match crubyOperator "\"
59 | syn match crubyOperator "\"
60 | syn match crubyOperator "\"
61 | syn match crubyOperator "\"
62 | syn match crubyOperator "\"
63 | syn match crubyOperator "\"
64 | syn match crubyOperator "\"
65 | syn match crubyOperator "\"
66 | syn match crubyOperator "\"
67 | syn match crubyOperator "\"
68 | syn match crubyOperator "\"
69 | syn match crubyOperator "\"
70 | syn keyword crubyOperator RBASIC FLONUM_P
71 | syn keyword crubyOperator ROBJECT RCLASS RMODULE RFLOAT RSTRING RARRAY RREGEXP RHASH RSTRUCT RBIGNUM R_CAST RDATA RTYPEDDATA RFILE RRATIONAL RCOMPLEX
72 | syn keyword crubyOperator Data_Wrap_Struct Data_Make_Struct Data_Get_Struct
73 | syn keyword crubyOperator TypedData_Wrap_Struct TypedData_Make_Struct TypedData_Get_Struct
74 | syn keyword crubyOperator CONST_ID_CACHE
75 | syn keyword crubyOperator ISPRINT ISASCII ISSPACE ISUPPER ISLOWER ISALNUM ISALPHA ISDIGIT ISXDIGIT TOUPPER TOLOWER
76 | syn keyword crubyOperator MEMO_NEW
77 | syn keyword crubyOperator RETURN_SIZED_ENUMERATOR RB_BLOCK_CALL_FUNC_ARGLIST
78 | syn keyword crubyOperator STRCASECMP STRNCASECMP STRTOUL
79 |
80 | syn match crubyConstant "\"
81 | syn match crubyConstant "\"
82 | syn match crubyConstant "\"
83 | syn match crubyConstant "\<\(FIXNUM\|LONG_LONG\)_\(MAX\|MIN\)\>"
84 | syn keyword crubyConstant Qtrue Qfalse Qnil Qundef TRUE FALSE
85 | syn keyword crubyConstant IMMEDIATE_MASK FIXNUM_FLAG SYMBOL_FLAG FLONUM_MASK FLONUM_FLAG ELTS_SHARED
86 | syn match crubyConstant "\"
87 | syn match crubyConstant "\"
88 | syn match crubyConstant "\"
89 | syn match crubyConstant "\"
90 | syn match crubyConstant "\"
91 | syn match crubyConstant "\"
92 |
93 | syn match crubyConstant "\"
94 |
95 | syn match crubyConstant "\"
96 | syn match crubyConstant "\"
97 | syn match crubyConstant "\"
98 | syn match crubyConstant "\"
99 | syn match crubyConstant "\"
100 | syn match crubyConstant "\"
101 | syn match crubyConstant "\"
102 |
103 | syn match crubyConstant "\"
104 |
105 | syn match crubyConstant "\"
106 |
107 | " for bignum.c
108 | syn keyword crubyOperator BDIGITS BIGUP BIGDN BIGLO BIGZEROP
109 | syn keyword crubyConstant BITSPERDIG BIGRAD DIGSPERLONG DIGSPERLL BDIGMAX
110 |
111 | hi def link crubyConstant Constant
112 | hi def link crubyOperator Operator
113 | hi def link crubyStatement Statement
114 | hi def link crubyStorageClass StorageClass
115 | hi def link crubyType Type
116 |
117 | let b:current_syntax = "c"
118 |
--------------------------------------------------------------------------------