def run(self, immediate=False, single_pane=False, project=False, other_group=False): path, goto = self._determine_path() if project: folders = self.window.folders() if len(folders) == 1: path = folders[0] elif folders: names = [basename(f) for f in folders] longest_name = max([len(n) for n in names]) for i, f in enumerate(folders): name = names[i] offset = ' ' * (longest_name - len(name) + 1) names[i] = u'%s%s%s' % (name, offset, self.display_path(f)) self.window.show_quick_panel( names, lambda i: self._show_folder( i, path, goto, single_pane, other_group), sublime.MONOSPACE_FONT) return if immediate: show(self.window, path, goto=goto, single_pane=single_pane, other_group=other_group) else: prompt.start('Directory:', self.window, path, self._show)
def run(self, edit, **kwargs): if kwargs and kwargs["to"]: self.move_to_extreme(kwargs["to"]) return else: files = self.get_marked() or self.get_selected() if files: prompt.start('Move to:', self.view.window(), self.path, self._move)
def run(self, edit, **kwargs): if kwargs and kwargs["to"]: self.move_to_extreme(kwargs["to"]) return elif kwargs and kwargs["duplicate"]: self.items = self._get_items(self.path) self.cursor = self.view.substr(self.view.line(self.view.sel()[0].a))[2:] self._duplicate(duplicate=kwargs["duplicate"]) else: files = self.get_marked() or self.get_selected() if files: prompt.start('Move to:', self.view.window(), self.path, self._move)
def _duplicate(self, duplicate=''): fqn = next(self.items) for i in itertools.count(2): p, n = os.path.split(fqn) cfp = u"{1} {0}.{2}".format(i, join(p, n.split('.')[0]), '.'.join(n.split('.')[1:])) if os.path.isfile(cfp) or os.path.isdir(cfp): pass else: break if duplicate == 'rename': prompt.start('New name:', self.view.window(), os.path.basename(cfp), self._copy_duplicate, rename=(fqn, cfp, self.cursor)) else: self._copy_duplicate(fqn, cfp, 0)
def run(self, immediate=False, single_pane=False, project=False): path = self._determine_path() if project: folders = self.window.folders() if len(folders) == 1: path = folders[0] elif folders: folders = [ [basename(f), f] for f in folders] self.window.show_quick_panel(folders, self._show_folder) return if immediate: show(self.window, path, single_pane=single_pane) else: prompt.start('Directory:', self.window, path, self._show)
def run(self, edit, **kwargs): if kwargs and kwargs["to"]: self.move_to_extreme(kwargs["to"]) return elif kwargs and kwargs["duplicate"]: self.items = self._get_items(self.path) self.cursor = self.view.substr(self.view.line( self.view.sel()[0].a))[2:] self._duplicate(duplicate=kwargs["duplicate"]) else: files = self.get_marked() or self.get_selected() if files: prompt.start('Move to:', self.view.window(), self.path, self._move)
def run(self, immediate=False, single_pane=False, project=False): path = self._determine_path() if project: folders = self.window.folders() if len(folders) == 1: path = folders[0] elif folders: folders = [[basename(f), f] for f in folders] self.window.show_quick_panel(folders, self._show_folder) return if immediate: show(self.window, path, single_pane=single_pane) else: prompt.start('Directory:', self.window, path, self._show)
def run(self, edit): s = self.view.settings() self.index = self.get_all() sources_move = s.get('dired_to_move', []) sources_copy = s.get('dired_to_copy') or self.get_marked(full=True) or self.get_selected(parent=False, full=True) mitems = len(sources_move) citems = len(sources_copy) if not (mitems or citems): return sublime.status_message('Nothing to paste') both = mitems and citems msg = '%s%s to:' % (('Move %d' % mitems) if mitems else '', ('%sopy %d' % (' and c' if both else 'C', citems)) if citems else '') path = self.get_path() window = self.view.window() or sublime.active_window() prompt.start(msg, window, path, self.initfo, sources_move, sources_copy)
def run(self, immediate=False, single_pane=False, project=False, other_group=False): path, goto = self._determine_path() if project: folders = self.window.folders() if len(folders) == 1: path = folders[0] elif folders: names = [basename(f) for f in folders] longest_name = max([len(n) for n in names]) for i, f in enumerate(folders): name = names[i] offset = ' ' * (longest_name - len(name) + 1) names[i] = u'%s%s%s' % (name, offset, self.display_path(f)) self.window.show_quick_panel(names, lambda i: self._show_folder(i, path, goto, single_pane, other_group), sublime.MONOSPACE_FONT) return if immediate: show(self.window, path, goto=goto, single_pane=single_pane, other_group=other_group) else: prompt.start('Directory:', self.window, path, self._show)
def run(self, edit): prompt.start('Goto:', self.view.window(), self.path, self.goto)
def run(self, immediate=False): if immediate: show(self.window, self._determine_path()) else: prompt.start('Directory:', self.window, self._determine_path(), self._show)