diff options
-rwxr-xr-x | mnpgr.tl | 18 | ||||
-rw-r--r-- | mnpgr.vim | 16 |
2 files changed, 27 insertions, 7 deletions
@@ -5,7 +5,8 @@ (defvarl mnpgr-dir (path-cat home-dir ".mnpgr-dir")) (defvarl vim-commands - (join-with "|" '("set syntax=help" + (join-with "|" '("set syntax=mnpgr" + "set conceallevel=2 concealcursor=nc" "map q :q!\r"))) (defun make-overstrike-filter (put-string-fn) @@ -15,19 +16,22 @@ (when (neq mode cur-mode) [put-string-fn closer] (caseq (set cur-mode mode) - (:bold [put-string-fn "*"] - (set closer "*")) - (:ital [put-string-fn "|"] - (set closer "|")) + (:bold [put-string-fn "{B{"] + (set closer "}B}")) + (:ital [put-string-fn "{I{"] + (set closer "}I}")) + (:bital [put-string-fn "{C{"] + (set closer "}C}")) (:norm (set closer "")))) [put-string-fn str])) (lambda (line) - (each ((tok (tok #/.\b./ t line))) + (each ((tok (tok #/.\b.(\b.)?/ t line))) (match-case tok ("") (`@{x #/ +/}` (output-text x :norm)) - (`@x\b@x` (output-text x :bold)) + (`_\b@x\b@x` (output-text x :bital)) (`_\b@x` (output-text x :ital)) + (`@x\b@x` (output-text x :bold)) (@else (output-text else :norm)))) (output-text "\n" :norm))))) diff --git a/mnpgr.vim b/mnpgr.vim new file mode 100644 index 0000000..f024cea --- /dev/null +++ b/mnpgr.vim @@ -0,0 +1,16 @@ +" Syntax file for mnpgr +" Kaz Kylheku <kaz@kylheku.com> + +" INSTALL-HOWTO: +" +" 1. Create the directory .vim/syntax in your home directory and +" put the files mnpgr.vim into this directory. + +syn region mnpgr_bold start="{B{" end="}B}" contains=mnpgr_hidden keepend +syn region mnpgr_ital start="{I{" end="}I}" contains=mnpgr_hidden keepend +syn region mnpgr_bital start="{C{" end="}C}" contains=mnpgr_hidden keepend +syntax match mnpgr_hidden /{[BIC]{/ contained conceal +syntax match mnpgr_hidden /}[BIC]}/ contained conceal +hi def link mnpgr_bold Number +hi def link mnpgr_ital Identifier +hi def link mnpgr_bital Type |