Lines Matching refs:vim
3 source check.vim
17 tcldo ::vim::command %d_
24 tcldo ::vim::command new
46 " Test ::vim::beep
48 call assert_beeps('tcl ::vim::beep')
49 call assert_fails('tcl ::vim::beep x', 'wrong # args: should be "::vim::beep"')
52 " Test ::vim::buffer
54 " Test ::vim::buffer {nr}
58 let b1 = TclEval('::vim::buffer ' . bn1)
59 call assert_equal(b1, TclEval('set ::vim::current(buffer)'))
64 let b2 = TclEval('::vim::buffer ' . bn2)
65 call assert_equal(b2, TclEval('set ::vim::current(buffer)'))
70 " Test ::vim::buffer exists {nr}
71 call assert_match('^[1-9]\d*$', TclEval('::vim::buffer exists ' . bn1))
72 call assert_match('^[1-9]\d*$', TclEval('::vim::buffer exists ' . bn2))
73 call assert_equal('0', TclEval('::vim::buffer exists 54321'))
75 " Test ::vim::buffer list
76 call assert_equal('2', TclEval('llength [::vim::buffer list]'))
77 call assert_equal(b1.' '.b2, TclEval('::vim::buffer list'))
80 foreach b [::vim::buffer list] { $b command $cmd }
89 call assert_fails('tcl ::vim::buffer',
90 \ 'wrong # args: should be "::vim::buffer option"')
91 call assert_fails('tcl ::vim::buffer ' . bn1 . ' x',
92 \ 'wrong # args: should be "::vim::buffer bufNumber"')
93 call assert_fails('tcl ::vim::buffer 4321', 'invalid buffer number')
94 call assert_fails('tcl ::vim::buffer x',
96 call assert_fails('tcl ::vim::buffer exists',
97 \ 'wrong # args: should be "::vim::buffer exists bufNumber"')
98 call assert_fails('tcl ::vim::buffer exists x',
100 call assert_fails('tcl ::vim::buffer list x',
101 \ 'wrong # args: should be "::vim::buffer list "')
103 call assert_fails('tcl $::vim::current(buffer) abcd',
110 " Test ::vim::option
115 call assert_equal('3,5', TclEval('::vim::option cc'))
119 call assert_equal('3,5', TclEval('::vim::option cc +4'))
121 call assert_equal('+4', TclEval('::vim::option cc'))
124 call assert_equal('0', TclEval('::vim::option nu toggle'))
126 call assert_equal('1', TclEval('::vim::option nu toggle'))
128 call assert_equal('0', TclEval('::vim::option nu on'))
130 call assert_equal('1', TclEval('::vim::option nu off'))
133 call assert_fails('tcl ::vim::option nu x', 'expected integer but got "x"')
134 call assert_fails('tcl ::vim::option xxx', 'unknown vimOption')
135 call assert_fails('tcl ::vim::option',
136 \ 'wrong # args: should be "::vim::option vimOption ?value?"')
141 " Test ::vim::expr
144 \ TclEval('::vim::expr char2nr("X")'))
146 call assert_fails('tcl ::vim::expr x y',
147 \ 'wrong # args: should be "::vim::expr vimExpr"')
148 call assert_fails('tcl ::vim::expr 1-', 'E15: Invalid expression: "1-"')
151 " Test ::vim::command
154 \ TclEval('::vim::command {echo "hello world"}'))
156 " Check that if ::vim::command created a new Tcl interpreter, it is removed.
158 call assert_equal('321', TclEval('::vim::command "tcl set foo 321"'))
162 call assert_equal('', TclEval('::vim::command -quiet xyz'))
164 call assert_fails('tcl ::vim::command',
165 \ 'wrong # args: should be "::vim::command ?-quiet? exCommand"')
166 call assert_fails('tcl ::vim::command -foo xyz', 'unknown flag: -foo')
167 call assert_fails('tcl ::vim::command xyz',
171 call assert_equal('', TclEval('::vim::command -quiet xyz'))
176 " Test ::vim::window list
180 let w2 = TclEval('set ::vim::current(window)')
182 let w1 = TclEval('set ::vim::current(window)')
184 call assert_equal('2', TclEval('llength [::vim::window list]'))
185 call assert_equal(w2.' '.w1, TclEval('::vim::window list'))
187 call assert_fails('tcl ::vim::window x', 'unknown option')
188 call assert_fails('tcl ::vim::window list x',
189 \ 'wrong # args: should be "::vim::window option"')
190 call assert_fails('tcl $::vim::current(window) abcd',
217 tcl $::vim::current(window) height 2
221 call assert_equal('2', TclEval('$::vim::current(window) height'))
223 call assert_fails('tcl $::vim::current(window) height 2 2', 'wrong # args:')
224 call assert_fails('tcl $::vim::current(window) height x',
233 tcl set win $::vim::current(window)
239 " When setting ::vim::lbase to 0, line/col are counted from 0
241 tcl set ::vim::lbase 0
247 tcl set ::vim::lbase 1
287 tcl set b2 $::vim::current(buffer)
288 tcl set w2 $::vim::current(window)
290 tcl set b1 $::vim::current(buffer)
291 tcl set w1 $::vim::current(window)
310 tcl set w2 $::vim::current(window)
312 tcl set w1 $::vim::current(window)
333 tcl set w2 $::vim::current(window)
335 tcl set w1 $::vim::current(window)
351 tcl set w2 $::vim::current(window)
353 tcl set w1 $::vim::current(window)
374 tcl $::vim::current(window) delcmd [list set msg "window deleted"]
379 call assert_fails('tcl $::vim::current(window) delcmd', 'wrong # args')
380 call assert_fails('tcl $::vim::current(window) delcmd x x', 'wrong # args')
390 call assert_equal(expand('%:p'), TclEval('$::vim::current(buffer) name'))
395 call assert_equal('', TclEval('$::vim::current(buffer) name'))
397 call assert_fails('tcl $::vim::current(buffer) name x', 'wrong # args:')
405 call assert_equal(string(bufnr('%')), TclEval('$::vim::current(buffer) number'))
407 call assert_equal(string(bufnr('%')), TclEval('$::vim::current(buffer) number'))
409 call assert_fails('tcl $::vim::current(buffer) number x', 'wrong # args:')
418 call assert_equal('3', TclEval('$::vim::current(buffer) count'))
419 call assert_equal('3', TclEval('$::vim::current(buffer) last'))
421 " Check that $buf count and $buf last differ when ::vim::lbase is 0.
422 tcl set ::vim::lbase 0
423 call assert_equal('3', TclEval('$::vim::current(buffer) count'))
424 call assert_equal('2', TclEval('$::vim::current(buffer) last'))
426 call assert_fails('tcl $::vim::current(buffer) count x', 'wrong # args:')
427 call assert_fails('tcl $::vim::current(buffer) last x', 'wrong # args:')
429 tcl set ::vim::lbase 1
437 tcl $::vim::current(buffer) delete 4 6
438 tcl $::vim::current(buffer) delete 2
441 call assert_fails('tcl $::vim::current(buffer) delete -1', 'line number out of range')
442 call assert_fails('tcl $::vim::current(buffer) delete 0', 'line number out of range')
443 call assert_fails('tcl $::vim::current(buffer) delete 5', 'line number out of range')
445 call assert_fails('tcl $::vim::current(buffer) delete', 'wrong # args:')
446 call assert_fails('tcl $::vim::current(buffer) delete 1 2 3', 'wrong # args:')
447 call assert_fails('tcl $::vim::current(buffer) delete 1 abc',
452 call assert_fails('tcl $::vim::current(buffer) delete 2 1',
462 tcl set buf $::vim::current(buffer)
481 tcl set buf $::vim::current(buffer)
510 tcl $::vim::current(buffer) set 2 a
514 tcl $::vim::current(buffer) set 3 4 b
516 tcl $::vim::current(buffer) set 4 3 c
520 tcl $::vim::current(buffer) set 2 3 {x y z}
522 tcl $::vim::current(buffer) set 3 2 {X Y Z}
525 call assert_fails('tcl $::vim::current(buffer) set 0 "x"', 'line number out of range')
526 call assert_fails('tcl $::vim::current(buffer) set 6 "x"', 'line number out of range')
528 call assert_fails('tcl $::vim::current(buffer) set', 'wrong # args:')
529 call assert_fails('tcl $::vim::current(buffer) set 1 2 {[list "a" "b"]}',
534 call assert_fails('tcl $::vim::current(buffer) set 1 "x"',
536 call assert_fails('tcl $::vim::current(buffer) set 1 {a b}',
538 call assert_fails('tcl $::vim::current(buffer) set 1 2 {a b}',
548 tcl set buf $::vim::current(buffer)
569 call assert_fails('tcl $::vim::current(buffer) get x', 'expected integer but got "x"')
570 call assert_fails('tcl $::vim::current(buffer) get 1 x', 'expected integer but got "x"')
571 call assert_fails('tcl $::vim::current(buffer) get 1 1 1', 'wrong # args:')
585 call assert_equal('row 3 column 1', TclEval('$::vim::current(buffer) mark a'))
586 call assert_equal('row 4 column 3', TclEval('$::vim::current(buffer) mark B'))
588 call assert_fails('tcl $::vim::current(buffer) mark /', 'invalid mark name')
589 call assert_fails('tcl $::vim::current(buffer) mark z', 'mark not set')
590 call assert_fails('tcl $::vim::current(buffer) mark', 'wrong # args:')
599 tcl set b1 $::vim::current(buffer)
601 tcl set b2 $::vim::current(buffer)
613 call assert_fails('tcl $::vim::current(buffer) option', 'wrong # args:')
620 " Test $buf expr (evaluate vim expression)
624 tcl set b1 $::vim::current(buffer)
628 tcl set b2 $::vim::current(buffer)
643 tcl $::vim::current(buffer) delcmd [list set msg "buffer deleted"]
649 call assert_fails('tcl $::vim::current(buffer) delcmd', 'wrong # args')
650 call assert_fails('tcl $::vim::current(buffer) delcmd x x', 'wrong # args')
657 " Only test errors as ::vim::current(...) is already indirectly
659 call assert_fails('tcl $::vim::current(buffer)', 'wrong # args:')
660 call assert_fails('tcl $::vim::current(window)', 'wrong # args:')
671 tcl set bar_wl [$::vim::current(buffer) windows]
673 tcl set foo_wl [$::vim::current(buffer) windows]
678 call assert_fails('tcl $::vim::current(buffer) windows x', 'wrong # args:')
730 tcldo $::vim::current(window) cursor 1 5
741 ::vim::command {let s = "A"}
744 ::vim::command {let s ..= "B"}
747 ::vim::command {let s ..= "C"}
750 ::vim::command {let s ..= "D"}
755 " vim: shiftwidth=2 sts=2 expandtab