本文整理汇总了Python中pynhost.api.send_string函数的典型用法代码示例。如果您正苦于以下问题:Python send_string函数的具体用法?Python send_string怎么用?Python send_string使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了send_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: index
def index(self, words):
api.send_string("[]{left}")
if len(words) > 1:
num = words[-1]
if words[-2] in ["minus", "negative"]:
num = str(-int(num))
api.send_string(num + "{right}")
示例2: new_class
def new_class(self, words):
if len(words) == 1:
api.send_string('class ')
return
class_name = ''.join([word.title() for word in words[1:]])
api.send_string('class {}:'.format(class_name))
vimextension.VimExtensionGrammar.definitions.append('{}_class'.format(class_name))
示例3: new_function
def new_function(self, words):
if len(words) == 1:
api.send_string('def ():{left}{left}{left}')
return
func_name = vimutils.guess_at_text(words[1:])
api.send_string('def {}():{{left}}{{left}}'.format(func_name))
vimextension.VimExtensionGrammar.definitions.append('{}_function'.format(func_name))
示例4: new_dictionary
def new_dictionary(self, words):
if len(words) == 1:
api.send_string(' = {{}}{left}{left}{left}{left}{left}')
return
dict_name = vimutils.create_variable_name(words[1:])
api.send_string(dict_name + ' = ' + '{{}}' + '{left}')
vimextension.VimExtensionGrammar.definitions.append('{}_dictionary'.format(dict_name))
示例5: new_list
def new_list(self, words):
if len(words) == 1:
api.send_string(' = []{left}{left}{left}{left}{left}')
return
list_name = vimutils.create_variable_name(words[1:])
api.send_string('{} = []{{left}}'.format(list_name))
vimextension.VimExtensionGrammar.definitions.append('{}_list'.format(list_name))
示例6: new_function
def new_function(self, words):
if len(words) == 1:
api.send_string("function () {{{left}{left}{left}{left}")
return
func_name = vimutils.create_variable_name(words[1:])
api.send_string("function {}() ".format(func_name) + "{{{left}{left}{left}")
vimextension.VimExtensionGrammar.definitions.append("{}_function".format(func_name))
示例7: get_clipboard_contents
def get_clipboard_contents(keys):
clipboard_contents = baseutils.get_clipboard_contents()
api.send_string(keys)
time.sleep(.1)
new_contents = baseutils.get_clipboard_contents()
baseutils.set_clipboard_contents(clipboard_contents)
return new_contents
示例8: manip_text_object
def manip_text_object(self, words):
num = self._num(words)
text_obj = self.text_objects[' '.join(words[1:])]
action = self._actions[words[0]][0]
cleanup = '' if words[0] != 'copy' else self._shortcuts['clearSelect']
command = (text_obj + action + cleanup) * num
api.send_string(command)
示例9: upper_incremental
def upper_incremental(self, words):
if not words[-1].isdigit():
words.append('1')
action = atomutils.ACTIONS.get(words[0], 'm')
limit = atomutils.INCREMENTAL_LIMITS[words[-4]]
search_value = self.search_chars[words[-2]].upper()
num = words[-1]
api.send_string(self.activate + '{}-{}-{}-{}`^'.format(num, action, limit, search_value))
示例10: do_surround_same
def do_surround_same(self, words):
text = self.activate + '1-' + atomutils.ACTIONS[words[0]]
if words[1] == 'outer':
text += '-a-'
else:
text += '-i-'
text += ''.join(atomutils.STRING_OBJECTS[words[-1]]) + '`^'
api.send_string(text)
示例11: letters
def letters(self, words):
num = int(words.pop()) if words[-1].isdigit() else 1
letter = baseutils.ALPHABET[words[-1]]
if len(words) > 1 or self.capital:
api.send_string(letter.upper())
return
for i in range(num):
api.send_string(letter)
示例12: execute_string_or_func
def execute_string_or_func(self, action):
if isinstance(action, str):
api.send_string(action)
return True
elif isinstance(action, tuple):
action[0](*action[1], **action[2])
return True
return False
示例13: count
def count(self, words):
iter_count = int(words[-1]) + 1
send_str = ''
for i, num in enumerate(range(iter_count)):
send_str += str(num)
if i != iter_count - 1:
send_str += ', '
api.send_string(send_str)
示例14: increment
def increment(self, words):
keys = "{ctrl+a}"
if words[0] == "decrease":
keys = "{ctrl+x}"
num = ""
if words[-1].isdigit():
num = words[-1]
api.send_string("{esc}" + "{}{}{}a".format(vimutils.FUNCTIONS["number jump"], num, keys))
示例15: do_motion
def do_motion(self, words):
if not words[-1].isdigit():
words.append('1')
select_default = 's'
if words[0] not in atomutils.ACTIONS:
select_default = 'm'
api.send_string(self.activate + select_default + atomutils.MOTIONS[words[-2]] + words[-1] + '!')
atomutils.do_action(words[0])