Exemple #1
0
 def git_update(self, words):
     commit_message = vimutils.get_clipboard_contents('{esc}dd').strip()
     filepath = vimutils.get_clipboard_contents('{esc}' +
         vimutils.FUNCTIONS['FilenameToClipboard'] + 'a')
     containing_dir = os.path.split(filepath)[:-1][0]
     os.chdir(containing_dir)
     subprocess.call(['git', 'add', '--all', ':/'])
     subprocess.call(['git', 'commit', '-m', "{}".format(commit_message)])
     subprocess.call(['git', 'push'])
     print('Git repo updated!')
Exemple #2
0
 def git_update(self, words):
     commit_message = vimutils.get_clipboard_contents('{esc}dd').strip()
     filepath = vimutils.get_clipboard_contents(
         '{esc}' + vimutils.FUNCTIONS['FilenameToClipboard'] + 'a')
     containing_dir = os.path.split(filepath)[:-1][0]
     os.chdir(containing_dir)
     subprocess.call(['git', 'add', '--all', ':/'])
     subprocess.call(['git', 'commit', '-m', "{}".format(commit_message)])
     subprocess.call(['git', 'push'])
     print('Git repo updated!')
Exemple #3
0
 def migrate(self, words):
     filepath = vimutils.get_clipboard_contents("{F11}{space}1a")
     project_dir = vimutils.get_django_project_root(filepath)
     if project_dir is not None:
         os.chdir(project_dir)
         subprocess.call(["python3", "manage.py", "migrate"])
         subprocess.call(["python3", "manage.py", "makemigrations"])
Exemple #4
0
 def migrate(self, words):
     filepath = vimutils.get_clipboard_contents('{F11}{space}1a')
     project_dir = vimutils.get_django_project_root(filepath)
     if project_dir is not None:
         os.chdir(project_dir)
         subprocess.call(['python3', 'manage.py', 'migrate'])
         subprocess.call(['python3', 'manage.py', 'makemigrations'])
Exemple #5
0
 def launch_shell(self, words):
     buff_path = vimutils.get_clipboard_contents(
         "{escape}:let @+ = expand('%:p'){enter}")
     subprocess.call(['x-terminal-emulator'])
     time.sleep(1)
     print(os.path.split(buff_path))
     api.send_string('cd ' + os.path.split(buff_path)[0] + '{enter}')
Exemple #6
0
 def git_remote(self, words):
     filepath = vimutils.get_clipboard_contents('{F11}{space}1a')
     up_dir = os.path.split(filepath)[:-1][0]
     while up_dir:
         try:
             with open(os.path.join(up_dir, '.git', 'config')) as f:
                 for line in f:
                     split_line = line.split()
                     if split_line[0] == 'url':
                         url = re.sub(r'[a-z]+@', '', split_line[-1])
                         baseutils.open_firefox_url(url)
                         return
         except FileNotFoundError:
             pass
         up_dir = os.path.split(up_dir[:-1])[0]
Exemple #7
0
 def git_remote(self, words):
     filepath = vimutils.get_clipboard_contents('{F11}{space}1a')
     up_dir = os.path.split(filepath)[:-1][0]
     while up_dir:
         try:
             with open(os.path.join(up_dir, '.git', 'config')) as f:
                 for line in f:
                     split_line = line.split()
                     if split_line[0] == 'url':
                         url = re.sub(r'[a-z]+@', '', split_line[-1])
                         baseutils.open_firefox_url(url)
                         return
         except FileNotFoundError:
             pass
         up_dir = os.path.split(up_dir[:-1])[0]
Exemple #8
0
 def launch_shell(self, words):
     buff_path = vimutils.get_clipboard_contents("{escape}:let @+ = expand('%:p'){enter}")
     subprocess.call(['x-terminal-emulator'])
     time.sleep(1)
     print(os.path.split(buff_path))
     api.send_string('cd ' + os.path.split(buff_path)[0] + '{enter}')