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]
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)))
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)
def value(self, node): extras = extract_values(node, (TrueVimNormalRule), recurse=True) return sum_actions(extras)
def value(self, node): return join_actions(' ', [Text('ssh')] + extract_values( node, (SshOptions, SshServer, Command), recurse=True))
def value(self, node): return extract_values(node, (SimpleCommand), recurse=True)[0]
def value(self, node): return sum_actions(extract_values(node, AnyCharacter, recurse=True))
def value(self, node): return Key('s-{}'.format( str( extract_values(node, LowercaseCharacter, recurse=True)[0]._action)))