Want more features on Pastebin? Sign Up, it's FREE!
Guest

(attempt to) add leo-editor syntax highlighting to vim

By: a guest on Dec 7th, 2010  |  syntax: VIM  |  size: 1.81 KB  |  views: 47  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. " Leo editor additions
  2. " to activate change save this file as ~/.vim/after/filetype.vim
  3.  
  4. " --- Leo directive ---
  5. " We assume anything with one of @@, @+, @- near line start is a leo headline/directive.
  6. " Examples:
  7. "               #@+leo-ver=5-thin
  8. "               #@+node:johndoe.20100928224755.1557: * @file foobar.py
  9. "               #@@first
  10. "               #@+<<docstring> >
  11. "
  12. " Search pattern break down:
  13. "
  14. "       ^               beginning of line
  15. "       .               any single character
  16. "       \{,4}   0 to 4 of preceeding pattern (any single character in this case)
  17. "       \zs             Set start of match here (http://vimhelp.appspot.com/pattern.txt.html#%2F\zs)
  18. "       @[@\-+] match any of: @@, @+, @-
  19. "       .*              include everything after, to end of line
  20. "
  21. "       (better but too hard(?): match only if preceding character is a known comment delimeter)
  22.  
  23. syn match   leoSentinel  "^.\{,4}\zs@[@\-+].*"   containedin=Comment,pythonComment,vimComment,vimMtchComment,vimLineComment,perlComment,perlDATA,perlPOD,vimScriptDelim,rubyRegexpComment,rubyComment,rubyDocumentation,rubyData,htmlCommentPart,htmlComment,javaScriptLineComment,javaScriptComment,htmlCssStyleComment,vbComment,vbLineNumber,cssComment
  24.         " why can't we use plain ol 'Comment' group instead of 'pythonComment' etc. ?
  25.         " why did this stop this working with html files?
  26.  
  27. " Resume normal emphasis within leoHeadline after last asterisk (*)
  28. " Idea is to keep the node's name (headline contents) prominent
  29. syn match   Comment         "\* .*$"hs=s+1  containedin=leoSentinel
  30.  
  31. highlight leoSentinel guifg=grey
  32.  
  33.  
  34. " Wishlist:
  35. "       - background highlight entire node line. Idea is to still communicate or delineate the Leo node boundaries, but hide the noisy stuff. As is now the headline text kind of floats in the middle of nowhere.
  36. "       - would rather the headline colour say 'x% lighter than comment colour, in same hue'. This would be more adaptable to different colour schemes.
  37. "
clone this paste RAW Paste Data