|
148 | 148 | "filebrowser": "xdg-open", # Program to handle opening paths
|
149 | 149 | "webbrowser": "xdg-open", # Program to hangle opening urls
|
150 | 150 | "terminal": "xterm", # Terminal
|
| 151 | + "terminal_editor": "vim", # Terminal editor |
151 | 152 | "indicator_submenu": "->", # Symbol to indicate a submenu item
|
152 | 153 | "indicator_edit": "*", # Symbol to indicate an item will launch an editor
|
153 | 154 | "indicator_alias": "", # Symbol to indecate an aliased command
|
@@ -587,6 +588,27 @@ def open_terminal(self, command, hold=False, direct=False):
|
587 | 588 | os.system(self.prefs['terminal'] + ' -e ' + sh_command_file)
|
588 | 589 |
|
589 | 590 |
|
| 591 | + def open_in_terminal_editor(self, path): |
| 592 | + if not os.path.exists(path): |
| 593 | + if d.debug: |
| 594 | + print("Open in the default terminal editor...") |
| 595 | + print(str(path) + ": path doesn't exist") |
| 596 | + return |
| 597 | + |
| 598 | + cmd = "%s -e '%s %s'" % ( |
| 599 | + d.prefs['terminal'], |
| 600 | + d.prefs['terminal_editor'], |
| 601 | + path.replace(' ', '\\ ') |
| 602 | + ) |
| 603 | + |
| 604 | + if d.debug: |
| 605 | + print("Open in the default terminal editor...") |
| 606 | + print("Terminal will be held open upon command finishing") |
| 607 | + print("Command is: " + str(cmd)) |
| 608 | + |
| 609 | + return d.execute(cmd, False) |
| 610 | + |
| 611 | + |
590 | 612 | def open_file(self, path):
|
591 | 613 | self.load_preferences()
|
592 | 614 | if self.debug:
|
@@ -1531,7 +1553,9 @@ def handle_command(d, out):
|
1531 | 1553 | out = os.path.expanduser(out)
|
1532 | 1554 | if d.debug:
|
1533 | 1555 | print("Tilda found, expanding to " + str(out))
|
1534 |
| - if out[-1] == ';': |
| 1556 | + if out[-1] == '@': |
| 1557 | + d.open_in_terminal_editor(out[:-1]) |
| 1558 | + elif out[-1] == ';': |
1535 | 1559 | terminal_hold = False
|
1536 | 1560 | out = out[:-1]
|
1537 | 1561 | if out[-1] == ';':
|
|
0 commit comments