当前位置: 首页>>代码示例>>Python>>正文


Python mappings.Mappings类代码示例

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


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

示例1: Test_Mapping_Expanding

class Test_Mapping_Expanding(BufferTest):
    def setUp(self):
        super().setUp()
        self.state = state.State(self.view)
        self.mappings = Mappings(self.state)
        self.mappings.clear()

    def testCanExpand(self):
        for (i, data) in enumerate(expanding_tests):
            setup_data, test_data = data

            mode, keys, new_mapping = setup_data
            self.mappings.add(mode, keys, new_mapping)

            self.state.mode = modes.NORMAL

            seq, expected_head, expected_mapping, expected_tail, expected_full, expected_status = test_data
            result = self.mappings.expand_first(seq)

            self.assertEqual(result.head, expected_head, '[{0}] head failed'.format(i))
            self.assertEqual(result.tail, expected_tail, '[{0}] tail failed'.format(i))
            self.assertEqual(result.mapping, expected_mapping, '[{0}] mapping failed'.format(i))
            self.assertEqual(result.sequence, expected_full, '[{0}] sequence failed'.format(i))
            self.assertEqual(result.status, expected_status, '[{0}] status failed'.format(i))

            self.mappings.clear()
开发者ID:glebkuznetsov,项目名称:Vintageous,代码行数:26,代码来源:test_mappings.py

示例2: run

 def run(self, edit, mode=None, count=None, cmd=''):
     mappings = Mappings(State(self.view))
     try:
         mappings.remove(modes.VISUAL, cmd)
         mappings.remove(modes.VISUAL_LINE, cmd)
         mappings.remove(modes.VISUAL_BLOCK, cmd)
     except KeyError:
         sublime.status_message('Vintageous: Mapping  not found.')
开发者ID:glebkuznetsov,项目名称:Vintageous,代码行数:8,代码来源:ex_commands.py

示例3: Test_Mappings_AddingAndRemoving

class Test_Mappings_AddingAndRemoving(ViewTest):
    def setUp(self):
        super().setUp()
        self.mappings = Mappings(self.state)
        self.mappings.clear()

    def testCanAdd(self):
        for (i, data) in enumerate(adding_tests):
            mode, keys, target, msg = data
            self.mappings.add(mode, keys, target)
            self.assertEqual(_mappings[mode][keys], {'name': target, 'type': cmd_types.USER}, '{0} [{1}] failed'.format(msg, i))
            self.mappings.clear()

    def testCanRemove(self):
        for (i, data) in enumerate(adding_tests):
            mode, keys, target, msg = data
            self.mappings.add(mode, keys, target)
            self.mappings.remove(mode, keys)

        self.assertFalse(_mappings[modes.NORMAL])
        self.assertFalse(_mappings[modes.VISUAL])
        self.assertFalse(_mappings[modes.VISUAL_LINE])
        self.assertFalse(_mappings[modes.VISUAL_BLOCK])
开发者ID:amclain,项目名称:Vintageous,代码行数:23,代码来源:test_mappings.py

示例4: run

 def run(self, edit, mode=None, count=None, cmd=''):
     try:
         # TODO(guillermooo): Instead of parsing this here, add parsers
         # to ex command defs and reuse them here.
         keys, command = cmd.lstrip().split(' ', 1)
     except ValueError:
         sublime.status_message('Vintageous: Bad mapping format')
         return
     else:
         mappings = Mappings(State(self.view))
         mappings.add(modes.NORMAL, keys, command)
         mappings.add(modes.OPERATOR_PENDING, keys, command)
         mappings.add(modes.VISUAL, keys, command)
开发者ID:TetragrammatonHermit,项目名称:Vintageous,代码行数:13,代码来源:ex_commands.py

示例5: Test_Mappings_AddingAndRemoving

class Test_Mappings_AddingAndRemoving(BufferTest):
    def setUp(self):
        super().setUp()
        self.state = state.State(self.view)
        self.mappings = Mappings(self.state)
        self.mappings.clear()

    def testCanAdd(self):
        for (i, data) in enumerate(adding_tests):
            mode, keys, target, msg = data
            self.mappings.add(mode, keys, target)
            self.assertEqual(_mappings[mode][keys], {'name': target, 'type': cmd_types.USER}, '{0} [{1}] failed'.format(msg, i))
            self.mappings.clear()
开发者ID:fenduru,项目名称:Vintageous,代码行数:13,代码来源:test_mappings.py

示例6: Test_Mappings_AddingAndRemoving

class Test_Mappings_AddingAndRemoving(BufferTest):
    def setUp(self):
        super().setUp()
        self.state = state.State(self.view)
        self.mappings = Mappings(self.state)
        self.mappings.clear()

    def testCanAdd(self):
        for (i, data) in enumerate(adding_tests):
            mode, keys, target = data
            self.mappings.add(mode, keys, target)
            self.assertEqual(_mappings[mode][keys], target, '[{0}] failed')
            self.mappings.clear()
开发者ID:scoates,项目名称:Vintageous,代码行数:13,代码来源:test_mappings.py

示例7: setUp

 def setUp(self):
     super().setUp()
     self.state = state.State(self.view)
     self.mappings = Mappings(self.state)
     self.mappings.clear()
开发者ID:glebkuznetsov,项目名称:Vintageous,代码行数:5,代码来源:test_mappings.py

示例8: setUp

 def setUp(self):
     super().setUp()
     self.mappings = Mappings(self.state)
     self.mappings.clear()
开发者ID:amclain,项目名称:Vintageous,代码行数:4,代码来源:test_mappings.py


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