Пример #1
0
 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))
Пример #2
0
 def replace(self, words):
     if len(words) == 1:
         api.send_string('{esc}:%s///g{left}{left}{left}')
         return
     api.send_string(r'{alt+1}{esc}:%s/\<{ctrl+r+w}\>/' +
                     vimutils.guess_at_text(words[1:]) +
                     '/g{enter}i{alt+2}')
Пример #3
0
 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
0
 def search(self, words):
     search_char = '/'
     if words[0] == 'relapse':
         search_char = '?'
     num = '1'
     if len(words) > 2 and words[1].isdigit():
         num = words[1]
         del words[1]             
     api.send_string('{esc}' + num + search_char)
     if len(words) > 1:
         # case insensitive
         api.send_string('\c' + vimutils.guess_at_text(words[1:]) + '{enter}i')
Пример #5
0
 def search(self, words):
     search_char = '/'
     if words[0] == 'relapse':
         search_char = '?'
     num = '1'
     if len(words) > 2 and words[1].isdigit():
         num = words[1]
         del words[1]
     api.send_string('{esc}' + num + search_char)
     if len(words) > 1:
         # case insensitive
         api.send_string('\c' + vimutils.guess_at_text(words[1:]) +
                         '{enter}i')
Пример #6
0
 def replace(self, words):
     if len(words) == 1:
         api.send_string('{esc}:%s///g{left}{left}{left}')
         return
     api.send_string(r'{alt+1}{esc}:%s/\<{ctrl+r+w}\>/'+ vimutils.guess_at_text(words[1:]) + '/g{enter}i{alt+2}')