diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-03-02 23:03:44 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-03-02 23:03:44 -0500 |
| commit | eb9f1e2d532aa88199fb6afb3e2cfcef43c2ed14 (patch) | |
| tree | 82ed5f75b06a6e21cb7d03f5e9e3f9735872ee2a /doc | |
| parent | b78752e2d23846763b77a21f183184668762f6d0 (diff) | |
| download | zig-eb9f1e2d532aa88199fb6afb3e2cfcef43c2ed14.tar.gz zig-eb9f1e2d532aa88199fb6afb3e2cfcef43c2ed14.zip | |
add basic emacs syntax file
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/emacs/README.md | 7 | ||||
| -rw-r--r-- | doc/emacs/zig-mode.el | 18 |
2 files changed, 25 insertions, 0 deletions
diff --git a/doc/emacs/README.md b/doc/emacs/README.md new file mode 100644 index 0000000000..39bc1112ca --- /dev/null +++ b/doc/emacs/README.md @@ -0,0 +1,7 @@ +To use this emacs syntax file, add this to your emacs configuration file: + +```emacs +(add-to-list 'load-path "/path/to/zig/doc/emacs/") +(autoload 'zig-mode "zig-mode" nil t) +(add-to-list 'auto-mode-alist '("\\.zig\\'" . zig-mode)) +``` diff --git a/doc/emacs/zig-mode.el b/doc/emacs/zig-mode.el new file mode 100644 index 0000000000..6a695546b0 --- /dev/null +++ b/doc/emacs/zig-mode.el @@ -0,0 +1,18 @@ +(setq zig + '(("\\b\\(@sizeOf\\|@alignOf\\|@maxValue\\|@minValue\\|@memberCount\\|@typeOf\\|@addWithOverflow\\|@subWithOverflow\\|@mulWithOverflow\\|@shlWithOverflow\\|@cInclude\\|@cDefine\\|@cUndef\\|@compileVar\\|@generatedCode\\|@ctz\\|@clz\\|@import\\|@cImport\\|@errorName\\|@typeName\\|@isInteger\\|@isFloat\\|@canImplicitCast\\|@embedFile\\|@cmpxchg\\|@fence\\|@divExact\\|@truncate\\|@compileError\\|@compileLog\\|@intType\\|@unreachable\\|@setFnTest\\|@setFnVisible\\|@setDebugSafety\\|@alloca\\|@setGlobalAlign\\|@setGlobalSection\\)" . font-lock-builtin-face) + +("\\b\\(fn\\|use\\|while\\|for\\|break\\|continue\\|goto\\|if\\|else\\|switch\\|try\\|return\\|defer\\|asm\\|unreachable\\|const\\|var\\|extern\\|packed\\|export\\|pub\\|noalias\\|inline\\|comptime\\|nakedcc\\|coldcc\\|volatile\\|struct\\|enum\\|union\\)\\b" . font-lock-keyword-face) + + ("\\b\\(null\\|undefined\\|this\\)\\b" . font-lock-constant-face) + +("\\b\\(bool\\|f32\\|f64\\|void\\|Unreachable\\|type\\|error\\|i8\\|\\|u8\\|\\|i16\\|\\|u16\\|\\|i32\\|\\|u32\\|\\|64\\|u64\\|isize\\|usize\\|c_short\\|c_ushort\\|c_int\\|c_uint\\|c_long\\|c_ulong\\|c_longlong\\|c_ulonglong\\|c_long_double\\)\\b" . font-lock-type-face) + + )) + + + +(define-derived-mode zig-mode c-mode "zig mode" + "Major mode for editing Zig language" + (setq font-lock-defaults '(zig))) + +(provide 'zig-mode) |
