limelight.vader 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. Execute (Setup):
  2. Save g:colors_name, &background
  3. colo seoul256
  4. function! s:assert_on()
  5. Assert exists('#limelight'), 'limelight should be on'
  6. endfunction
  7. function! s:assert_off()
  8. Assert !exists('#limelight'), 'limelight should be off'
  9. endfunction
  10. command! AssertOn call s:assert_on()
  11. command! AssertOff call s:assert_off()
  12. Before:
  13. unlet! g:limelight_default_coefficient
  14. \ g:limelight_conceal_guifg g:limelight_conceal_ctermfg
  15. Execute (Invalid argument type):
  16. Limelight 'hello'
  17. AssertOff
  18. Limelight {}
  19. AssertOff
  20. Limelight []
  21. AssertOff
  22. Execute (Invalid argument range):
  23. Limelight 1.2
  24. AssertOff
  25. Limelight 2
  26. AssertOff
  27. Limelight -0.2
  28. AssertOff
  29. Limelight -1
  30. AssertOff
  31. Execute (Limelight / Limelight!):
  32. Limelight
  33. AssertOn
  34. Limelight
  35. AssertOn
  36. Limelight!
  37. AssertOff
  38. Limelight!
  39. AssertOff
  40. Limelight 0.5
  41. AssertOn
  42. Limelight!
  43. AssertOff
  44. Execute (Limelight!!):
  45. Limelight!!
  46. AssertOn
  47. Limelight!!
  48. AssertOff
  49. Limelight!! 2.0
  50. AssertOff
  51. Limelight!! 0.9
  52. AssertOn
  53. Limelight!! 0.9
  54. AssertOff
  55. Execute (g:limelight_default_coefficient):
  56. let g:limelight_default_coefficient = 2.0
  57. Limelight
  58. AssertOff
  59. let g:limelight_default_coefficient = -1.0
  60. Limelight
  61. AssertOff
  62. Execute (Unsupported terminal):
  63. colo default
  64. let &t_Co = 16
  65. Limelight
  66. AssertOff
  67. Execute (Unsupported. but g:limelight_conceal_???fg defined):
  68. if has('gui_running')
  69. colo default
  70. let g:limelight_conceal_guifg = '#cccccc'
  71. Limelight
  72. AssertOn
  73. Limelight!
  74. AssertOff
  75. else
  76. if exists('&termguicolors')
  77. set notermguicolors
  78. endif
  79. colo default
  80. let &t_Co = 256
  81. " Cannot enable it without g:limelight_conceal_ctermfg
  82. Limelight
  83. AssertOff
  84. let g:limelight_conceal_ctermfg = 240
  85. Limelight
  86. AssertOn
  87. Limelight!
  88. AssertOff
  89. let g:limelight_conceal_ctermfg = 'red'
  90. Limelight
  91. AssertOn
  92. Limelight!
  93. AssertOff
  94. endif
  95. " However, you're still not allowed to pass argument to Limelight command
  96. redir => msg
  97. Limelight 0.5
  98. redir END
  99. AssertOff
  100. Assert msg !~ 'g:limelight_conceal_', 'Invalid message: '.msg
  101. Execute (TODO: Color interpolation):
  102. Assert 0, 'TODO'
  103. Execute (Cleanup):
  104. delc AssertOn
  105. delc AssertOff
  106. unlet! msg
  107. Restore
  108. silent! execute 'colo '.g:colors_name