From ca2ab5e446bcf40e18de4390ee1b47c8295b5728 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 11 Jul 2015 09:18:20 +0000 Subject: 35775: New zsh-specific yodl vim syntax highlighting. To try this, see the instructions at the top of Util/zyodl.vim (in the comment). * Util/zyodl.vim: New syntax highlighting file. * Doc/Zsh/.vimrc: New file, hooks up zyodl.vim for automatic loading. * Etc/zsh-development-guide: Namedrop zyodl.vim for discoverability. --- ChangeLog | 5 ++++ Doc/Zsh/.vimrc | 4 +++ Etc/zsh-development-guide | 3 ++ Util/zyodl.vim | 74 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 Doc/Zsh/.vimrc create mode 100644 Util/zyodl.vim diff --git a/ChangeLog b/ChangeLog index 38d64d458..4eefc62a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-07-13 Daniel Shahaf + + * 35775: Doc/Zsh/.vimrc Etc/zsh-development-guide Util/zyodl.vim: + New zsh-specific yodl vim syntax highlighting. + 2015-07-13 Daniel Shahaf * 35769: Functions/Zle/edit-command-line: edit-command-line: diff --git a/Doc/Zsh/.vimrc b/Doc/Zsh/.vimrc new file mode 100644 index 000000000..6544cd450 --- /dev/null +++ b/Doc/Zsh/.vimrc @@ -0,0 +1,4 @@ +augroup filetypedetect + autocmd BufRead,BufNewFile **/Doc/Zsh/*.yo set ft=zyodl | source :h:h:h/Util/zyodl.vim + "autocmd BufRead,BufNewFile **/Etc/FAQ.yo set ft=zyodl | source :h:h:h/Util/zyodl.vim +augroup END diff --git a/Etc/zsh-development-guide b/Etc/zsh-development-guide index d92b72456..4d6cefd1e 100644 --- a/Etc/zsh-development-guide +++ b/Etc/zsh-development-guide @@ -920,6 +920,9 @@ Documentation surrounding text. No extra newlines after the opening or before the closing parenthesis are required. +A syntax highlighting file for Vim is included, just source tt(Doc/Zsh/.vimrc) +before editing one of the Doc/Zsh/*.yo files. + Module names ------------ diff --git a/Util/zyodl.vim b/Util/zyodl.vim new file mode 100644 index 000000000..db2a599ca --- /dev/null +++ b/Util/zyodl.vim @@ -0,0 +1,74 @@ + +"" A Vim syntax highlighting file for Doc/Zsh/*.yo + +" To try this, run: +" cd Doc/Zsh && vim --cmd "source ./.vimrc" zle.yo +" (This sources the file .) +" +" To install this permanently: +" 1. Copy this file to ~/.vim/syntax/zyodl.vim +" 2. Create ~/.vim/filetype.vim as explained in ":help new-filetype" case C. +" 3. Add the following command to ~/.vim/filetype.vim: +" autocmd BufRead,BufNewFile **/Doc/Zsh/*.yo setfiletype zyodl + +"" Test case: +" texinode()()()() +" chapter(foo) +" vindex(foo) +" foo tt(foo) var(foo) bf(foo) em(foo) foo +" xitem(foo) +" item(foo)(foo) +" sitem(foo)(foo foo) +" example(print *.c+LPAR()#q:s/#%+LPAR()#b+RPAR()s+LPAR()*+RPAR().c/'S${match[1]}.C'/+RPAR()) +" ifzman(zmanref(zshmisc))ifnzman(noderef(Redirection)) +" LPAR()foo 42 foo+RPAR() +" +" chapter(foo (foo) foo) # nested parentheses +" sitem(foo)(foo tt(foo) foo) # nested underline + +if exists("b:current_syntax") + finish +endif + +"" Syntax groups: +syn clear +syn cluster zyodlInline contains=zyodlTt,zyodlVar,zyodlBold,zyodlEmph,zyodlCond +syn region zyodlTt start="\