• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python vim.command函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中test_common.vim.command函数的典型用法代码示例。如果您正苦于以下问题:Python command函数的具体用法?Python command怎么用?Python command使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了command函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_valid

def test_valid():
    vim.command('split')
    window = vim.windows[1]
    vim.current.window = window
    ok(window.valid)
    vim.command('q')
    ok(not window.valid)
开发者ID:AitorATuin,项目名称:python-client,代码行数:7,代码来源:test_window.py


示例2: test_buffers

def test_buffers():
    eq(len(vim.buffers), 1)
    eq(vim.buffers[0], vim.current.buffer)
    vim.command('new')
    eq(len(vim.buffers), 2)
    eq(vim.buffers[1], vim.current.buffer)
    vim.current.buffer = vim.buffers[0]
    eq(vim.buffers[0], vim.current.buffer)
开发者ID:AitorATuin,项目名称:python-client,代码行数:8,代码来源:test_vim.py


示例3: test_cursor

def test_cursor():
    eq(vim.current.window.cursor, [1, 0])
    vim.command('normal ityping\033o  some text')
    eq(vim.current.buffer[:], ['typing', '  some text'])
    eq(vim.current.window.cursor, [2, 10])
    vim.current.window.cursor = [2, 6]
    vim.command('normal i dumb')
    eq(vim.current.buffer[:], ['typing', '  some dumb text'])
开发者ID:AitorATuin,项目名称:python-client,代码行数:8,代码来源:test_window.py


示例4: test_height

def test_height():
    vim.command('vsplit')
    eq(vim.windows[1].height, vim.windows[0].height)
    vim.current.window = vim.windows[1]
    vim.command('split')
    eq(vim.windows[1].height, vim.windows[0].height // 2)
    vim.windows[1].height = 2
    eq(vim.windows[1].height, 2)
开发者ID:AitorATuin,项目名称:python-client,代码行数:8,代码来源:test_window.py


示例5: test_width

def test_width():
    vim.command('split')
    eq(vim.windows[1].width, vim.windows[0].width)
    vim.current.window = vim.windows[1]
    vim.command('vsplit')
    eq(vim.windows[1].width, vim.windows[0].width // 2)
    vim.windows[1].width = 2
    eq(vim.windows[1].width, 2)
开发者ID:AitorATuin,项目名称:python-client,代码行数:8,代码来源:test_window.py


示例6: test_windows

def test_windows():
    vim.command('tabnew')
    vim.command('vsplit')
    eq(list(vim.tabpages[0].windows), [vim.windows[0]])
    eq(list(vim.tabpages[1].windows), [vim.windows[1], vim.windows[2]])
    eq(vim.tabpages[1].window, vim.windows[1])
    vim.current.window = vim.windows[2]
    eq(vim.tabpages[1].window, vim.windows[2])
开发者ID:AitorATuin,项目名称:python-client,代码行数:8,代码来源:test_tabpage.py


示例7: test_windows

def test_windows():
    eq(len(vim.windows), 1)
    eq(vim.windows[0], vim.current.window)
    vim.command('vsplit')
    vim.command('split')
    eq(len(vim.windows), 3)
    eq(vim.windows[0], vim.current.window)
    vim.current.window = vim.windows[1]
    eq(vim.windows[1], vim.current.window)
开发者ID:AitorATuin,项目名称:python-client,代码行数:9,代码来源:test_vim.py


示例8: setup_cb

 def setup_cb():
     vim.vars['result1'] = 0
     vim.vars['result2'] = 0
     vim.vars['result3'] = 0
     vim.vars['result4'] = 0
     cmd = 'let g:result1 = rpcrequest(%d, "call", %d)' % (cid, 2,)
     vim.command(cmd)
     eq(vim.vars['result1'], 4)
     eq(vim.vars['result2'], 8)
     eq(vim.vars['result3'], 16)
     eq(vim.vars['result4'], 32)
     vim.session.stop()
开发者ID:bfredl,项目名称:python-client,代码行数:12,代码来源:test_client_rpc.py


示例9: test_position

def test_position():
    height = vim.windows[0].height
    width = vim.windows[0].width
    vim.command('split')
    vim.command('vsplit')
    eq((vim.windows[0].row, vim.windows[0].col), (0, 0))
    vsplit_pos = width / 2
    split_pos = height / 2
    eq(vim.windows[1].row, 0)
    ok(vsplit_pos - 1 <= vim.windows[1].col <= vsplit_pos + 1)
    ok(split_pos - 1 <= vim.windows[2].row <= split_pos + 1)
    eq(vim.windows[2].col, 0)
开发者ID:AitorATuin,项目名称:python-client,代码行数:12,代码来源:test_window.py


示例10: setup_cb

 def setup_cb():
     vim.vars["result1"] = 0
     vim.vars["result2"] = 0
     vim.vars["result3"] = 0
     vim.vars["result4"] = 0
     cmd = 'let g:result1 = rpcrequest(%d, "call", %d)' % (cid, 2)
     vim.command(cmd)
     eq(vim.vars["result1"], 4)
     eq(vim.vars["result2"], 8)
     eq(vim.vars["result3"], 16)
     eq(vim.vars["result4"], 32)
     vim.stop_loop()
开发者ID:timeyyy,项目名称:python-client,代码行数:12,代码来源:test_client_rpc.py


示例11: request_cb

 def request_cb(name, args):
     n = args[0]
     n *= 2
     if n <= 16:
         if n == 4:
             cmd = 'let g:result2 = rpcrequest(%d, "call", %d)' % (cid, n,)
         elif n == 8:
             cmd = 'let g:result3 = rpcrequest(%d, "call", %d)' % (cid, n,)
         elif n == 16:
             cmd = 'let g:result4 = rpcrequest(%d, "call", %d)' % (cid, n,)
         vim.command(cmd)
     return n
开发者ID:bfredl,项目名称:python-client,代码行数:12,代码来源:test_client_rpc.py


示例12: test_tabpages

def test_tabpages():
    eq(len(vim.tabpages), 1)
    eq(vim.tabpages[0], vim.current.tabpage)
    vim.command('tabnew')
    eq(len(vim.tabpages), 2)
    eq(len(vim.windows), 2)
    eq(vim.windows[1], vim.current.window)
    eq(vim.tabpages[1], vim.current.tabpage)
    vim.current.window = vim.windows[0]
    # Switching window also switches tabpages if necessary(this probably
    # isn't the current behavior, but compatibility will be handled in the
    # python client with an optional parameter)
    eq(vim.tabpages[0], vim.current.tabpage)
    eq(vim.windows[0], vim.current.window)
    vim.current.tabpage = vim.tabpages[1]
    eq(vim.tabpages[1], vim.current.tabpage)
    eq(vim.windows[1], vim.current.window)
开发者ID:AitorATuin,项目名称:python-client,代码行数:17,代码来源:test_vim.py


示例13: test_broadcast

def test_broadcast():
    vim.subscribe('event2')
    vim.command('call rpcnotify(0, "event1", 1, 2, 3)')
    vim.command('call rpcnotify(0, "event2", 4, 5, 6)')
    vim.command('call rpcnotify(0, "event2", 7, 8, 9)')
    event = vim.next_message()
    eq(event[1], 'event2')
    eq(event[2], [4, 5, 6])
    event = vim.next_message()
    eq(event[1], 'event2')
    eq(event[2], [7, 8, 9])
    vim.unsubscribe('event2')
    vim.subscribe('event1')
    vim.command('call rpcnotify(0, "event2", 10, 11, 12)')
    vim.command('call rpcnotify(0, "event1", 13, 14, 15)')
    msg = vim.next_message()
    eq(msg[1], 'event1')
    eq(msg[2], [13, 14, 15])
开发者ID:AitorATuin,项目名称:python-client,代码行数:18,代码来源:test_events.py


示例14: test_command

def test_command():
    fname = tempfile.mkstemp()[1]
    vim.command('new')
    vim.command('edit %s' % fname)
    # skip the "press return" state, which does not handle deferred calls
    vim.input('\r')
    vim.command('normal itesting\npython\napi')
    vim.command('w')
    ok(os.path.isfile(fname))
    eq(open(fname).read(), 'testing\npython\napi\n')
    os.unlink(fname)
开发者ID:AitorATuin,项目名称:python-client,代码行数:11,代码来源:test_vim.py


示例15: test_buffers

def test_buffers():
    buffers = []

    # Number of elements
    eq(len(vim.buffers), 1)

    # Indexing (by buffer number)
    eq(vim.buffers[vim.current.buffer.number], vim.current.buffer)

    buffers.append(vim.current.buffer)
    vim.command('new')
    eq(len(vim.buffers), 2)
    buffers.append(vim.current.buffer)
    eq(vim.buffers[vim.current.buffer.number], vim.current.buffer)
    vim.current.buffer = buffers[0]
    eq(vim.buffers[vim.current.buffer.number], buffers[0])

    # Membership test
    ok(buffers[0] in vim.buffers)
    ok(buffers[1] in vim.buffers)
    ok({} not in vim.buffers)

    # Iteration
    eq(buffers, list(vim.buffers))
开发者ID:asankah,项目名称:python-client,代码行数:24,代码来源:test_vim.py


示例16: test_handle

def test_handle():
    hnd1 = vim.current.window.handle
    vim.command('bot split')
    hnd2 = vim.current.window.handle
    ok(hnd2 != hnd1)
    vim.command('bot split')
    hnd3 = vim.current.window.handle
    ok(hnd3 != hnd1)
    ok(hnd3 != hnd2)
    vim.command('wincmd w')
    eq(vim.current.window.handle,hnd1)
开发者ID:Floobits,项目名称:python-client,代码行数:11,代码来源:test_window.py


示例17: test_hash

def test_hash():
    d = {}
    d[vim.current.buffer] = "alpha"
    eq(d[vim.current.buffer], "alpha")
    vim.command('new')
    d[vim.current.buffer] = "beta"
    eq(d[vim.current.buffer], "beta")
    vim.command('winc w')
    eq(d[vim.current.buffer], "alpha")
    vim.command('winc w')
    eq(d[vim.current.buffer], "beta")
开发者ID:AitorATuin,项目名称:python-client,代码行数:11,代码来源:test_vim.py


示例18: test_receiving_events

def test_receiving_events():
    vim.command('call rpcnotify(%d, "test-event", 1, 2, 3)' % vim.channel_id)
    event = vim.next_message()
    eq(event[1], 'test-event')
    eq(event[2], [1, 2, 3])
    vim.command('au FileType python call rpcnotify(%d, "py!", bufnr("$"))' %
                vim.channel_id)
    vim.command('set filetype=python')
    event = vim.next_message()
    eq(event[1], 'py!')
    eq(event[2], [vim.current.buffer.number])
开发者ID:AitorATuin,项目名称:python-client,代码行数:11,代码来源:test_events.py


示例19: test_sending_notify

def test_sending_notify():
    # notify after notify
    vim.command("let g:test = 3", async=True)
    cmd = 'call rpcnotify(%d, "test-event", g:test)' % vim.channel_id
    vim.command(cmd, async=True)
    event = vim.next_message()
    eq(event[1], 'test-event')
    eq(event[2], [3])

    # request after notify
    vim.command("let g:data = 'xyz'", async=True)
    eq(vim.eval('g:data'), 'xyz')
开发者ID:AitorATuin,项目名称:python-client,代码行数:12,代码来源:test_events.py


示例20: source

def source(code):
    fd, fname = tempfile.mkstemp()
    with os.fdopen(fd,'w') as f:
        f.write(code)
    vim.command('source '+fname)
    os.unlink(fname)
开发者ID:AitorATuin,项目名称:python-client,代码行数:6,代码来源:test_vim.py



注:本文中的test_common.vim.command函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python test_common_utils.create_test_si函数代码示例发布时间:2022-05-27
下一篇:
Python test_common.setup_flexmock函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap