예제 #1
0
 def value(self, node):
     # try if uppercase first, because uppercase
     # contains lowercase
     uppercase = extract_values(node, UppercaseCharacter, recurse=True)
     if len(uppercase) > 0:
         return uppercase[0]
     return extract_values(node, (LowercaseCharacter, Symbol, Number),
                           recurse=True)[0]
예제 #2
0
 def value(self, node):
     char = extract_values(node, AnyCharacter, recurse=True)[0]
     mods = [mod.value() for mod in \
             node.get_children_by_name('modifier')]
     if len(mods) == 0:
         return char
     return Key("{}-{}".format("".join(mods), str(char._action)))
예제 #3
0
    def value(self, node):
        cmd_elements = []

        ######################################
        #  buffer to place affected text in  #
        ######################################
        if node.has_child_with_name('buffer'):
            cmd_elements.append("dquote")
            cmd_elements.append(node.get_child_by_name('buffer').value())

        #####################
        #  motion operator  #
        #####################
        cmd_elements.append(node.get_child_by_name('operator').value())

        #########################
        #  operator repetition  #
        #########################
        # e.g: delete line : dd
        if node.has_child_with_name('line'):
            cmd_elements.append(cmd_elements[-1])

        ##########
        #  mode  #
        ##########
        # overwrites operator's default mode
        # think blockwise, linewise, charwise
        if node.has_child_with_name('mode'):
            cmd_elements.append(node.get_child_by_name('mode').value())

        ##########################
        #  numerator for motion  #
        ##########################
        # is multiplied with any numbers preceding
        # this command by vim
        cmd_elements.extend(extract_values(node, Number, recurse=True))

        ###################
        #  actual motion  #
        ###################
        # think w
        if node.has_child_with_name('motion'):
            cmd_elements.append(node.get_child_by_name('motion').value())
        if node.has_child_with_name('operatormotion'):
            cmd_elements.append(
                node.get_child_by_name('operatormotion').value())

        return sum_actions(cmd_elements)
예제 #4
0
 def value(self, node):
     extras = extract_values(node, (TrueVimNormalRule), recurse=True)
     return sum_actions(extras)
예제 #5
0
 def value(self, node):
     return join_actions(' ', [Text('ssh')] + extract_values(
         node, (SshOptions, SshServer, Command), recurse=True))
예제 #6
0
 def value(self, node):
     return extract_values(node, (SimpleCommand), recurse=True)[0]
예제 #7
0
 def value(self, node):
     return sum_actions(extract_values(node, AnyCharacter, recurse=True))
예제 #8
0
 def value(self, node):
     return Key('s-{}'.format(
         str(
             extract_values(node, LowercaseCharacter,
                            recurse=True)[0]._action)))