My dotfiles. Period.

test-command.vim 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. " $Id: test-command.vim 156 2010-05-07 00:54:36Z luc.hermitte $
  2. " Tests for lh-vim-lib . lh#command
  3. " FindFilter(filter): Helper {{{3
  4. function! s:FindFilter(filter)
  5. let filter = a:filter . '.vim'
  6. let result =globpath(&rtp, "compiler/BTW-".filter) . "\n" .
  7. \ globpath(&rtp, "compiler/BTW_".filter). "\n" .
  8. \ globpath(&rtp, "compiler/BTW/".filter)
  9. let result = substitute(result, '\n\n', '\n', 'g')
  10. let result = substitute(result, '^\n', '', 'g')
  11. return result
  12. endfunction
  13. function! s:ComplFilter(filter)
  14. let files = s:FindFilter('*')
  15. let files = substitute(files,
  16. \ '\(^\|\n\).\{-}compiler[\\/]BTW[-_\\/]\(.\{-}\)\.vim\>\ze\%(\n\|$\)',
  17. \ '\1\2', 'g')
  18. return files
  19. endfunction
  20. function! s:Add()
  21. endfunction
  22. let s:v1 = 'v1'
  23. let s:v2 = 2
  24. function! s:Foo(i)
  25. return a:i*a:i
  26. endfunction
  27. function! s:echo(params)
  28. echo s:{join(a:params, '')}
  29. endfunction
  30. function! Echo(params)
  31. " echo "Echo(".string(a:params).')'
  32. let expr = 's:'.join(a:params, '')
  33. " echo expr
  34. exe 'echo '.expr
  35. endfunction
  36. let TBTWcommand = {
  37. \ "name" : "TBT",
  38. \ "arg_type" : "sub_commands",
  39. \ "arguments" :
  40. \ [
  41. \ { "name" : "echo",
  42. \ "arg_type" : "function",
  43. \ "arguments" : "v1,v2",
  44. \ "action": function("\<sid>echo") },
  45. \ { "name" : "Echo",
  46. \ "arg_type" : "function",
  47. \ "arguments" : "v1,v2",
  48. \ "action": function("Echo") },
  49. \ { "name" : "help" },
  50. \ { "name" : "add",
  51. \ "arguments": function("s:ComplFilter"),
  52. \ "action" : function("s:Add") }
  53. \ ]
  54. \ }
  55. call lh#command#new(TBTWcommand)
  56. nnoremap µ :call lh#command#new(TBTWcommand)<cr>
  57. "=============================================================================
  58. " vim600: set fdm=marker: