本文整理汇总了Python中pynhost.api.send_string函数的典型用法代码示例。如果您正苦于以下问题:Python send_string函数的具体用法?Python send_string怎么用?Python send_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了send_string函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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}")
开发者ID:codespeak,项目名称:grammars,代码行数:7,代码来源:shortfuncs.py
示例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))
开发者ID:codespeak,项目名称:grammars,代码行数:7,代码来源:pycommands.py
示例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))
开发者ID:codespeak,项目名称:grammars,代码行数:7,代码来源:pycommands.py
示例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))
开发者ID:codespeak,项目名称:grammars,代码行数:7,代码来源:pycommands.py
示例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))
开发者ID:codespeak,项目名称:grammars,代码行数:7,代码来源:pycommands.py
示例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))
开发者ID:codespeak,项目名称:grammars,代码行数:7,代码来源:hscommands.py
示例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
开发者ID:codespeak,项目名称:grammars,代码行数:7,代码来源:vimutils.py
示例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)
开发者ID:DumboSpeak,项目名称:DumboGuest,代码行数:7,代码来源:manip.py
示例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))
开发者ID:codespeak,项目名称:grammars,代码行数:8,代码来源:textmanip.py
示例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)
开发者ID:codespeak,项目名称:grammars,代码行数:8,代码来源:textmanip.py
示例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)
开发者ID:codespeak,项目名称:grammars,代码行数:8,代码来源:letters.py
示例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
开发者ID:DumboSpeak,项目名称:DumboGuest,代码行数:8,代码来源:history.py
示例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)
开发者ID:codespeak,项目名称:grammars,代码行数:8,代码来源:sample2.py
示例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))
开发者ID:codespeak,项目名称:grammars,代码行数:8,代码来源:shortfuncs.py
示例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])
开发者ID:codespeak,项目名称:grammars,代码行数:8,代码来源:textmanip.py
示例16: tag
def tag(self, words):
text = '<'
if words[-1] == 'close':
text += '/'
text += self.tags[' '.join(words[1:])]
text += '>'
if words[-1] != 'close':
text += '{left}'
api.send_string(text)
开发者ID:codespeak,项目名称:grammars,代码行数:9,代码来源:html.py
示例17: bottom
def bottom(self, words):
text = (vimutils.FUNCTIONS['RightIfNotFirstCol'] +
vimutils.FUNCTIONS['GoToVisualMode'] +
'{F11}G$')
if words[0] != 'select':
text += vimutils.commands[words[0]]
if words[0] == 'copy':
text += 'i'
api.send_string(text)
开发者ID:codespeak,项目名称:grammars,代码行数:9,代码来源:textmanip2.py
示例18: change_tab
def change_tab(self, words):
direction = 'gt'
if words[0] == 'left':
direction = 'gT'
num = int(baseutils.set_number(words))
for i in range(num):
if i != 0:
time.sleep(.1)
api.send_string('{escape}{escape}' + direction)
开发者ID:codespeak,项目名称:grammars,代码行数:9,代码来源:fbase.py
示例19: numbered_action
def numbered_action(self, words):
action = self._actions.get(words[0], [None])[0]
count = self._num(words)
if action is None:
send_str = ''.join([self._shortcuts[words[0]] for i in range(count)])
else:
keys = '+'.join([self.numbered_directions[words[1]][1:-1] for i in range(count)])
send_str = '{shift+' + keys + '}' + action
api.send_string(send_str)
开发者ID:DumboSpeak,项目名称:DumboGuest,代码行数:9,代码来源:manip.py
示例20: tab_direction
def tab_direction(self, words):
direction = '{ctrl+shift+tab}'
if 'right' in [words[-1], words[-2]]:
direction = '{ctrl+tab}'
num = baseutils.last_number(words)
for i in range(num):
api.send_string(direction)
if i + 1 < num:
time.sleep(.2)
开发者ID:codespeak,项目名称:grammars,代码行数:9,代码来源:shortcuts.py
注:本文中的pynhost.api.send_string函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论