def tc_find(self, args, range): """ The find command """ # Save the current explorer for restoration when the searcher finish self.expSave = self.explorers[self.selectedExplorer] # Replace the current explorer with a searcher and borrow its buffer se = searcher(self.nvim, self.expSave.buffer, self.expSave.cwd) se.window = self.expSave.window # Perform the search with the correct parameters dir = self.expSave.cwd se.find(dir, args[0]) self.explorers[self.selectedExplorer] = se self.explorers[self.selectedExplorer].draw() self.nvim.command('startinsert') self.nvim.command('normal! $') str = 'Help: <kbd> Filter pattern; <bs> Go to parent' self.nvim.current.buffer.append(str)
def tc_search(self, args, range): """ Search patterns comes from command line """ # Save the current explorer for restoration when the searcher finish self.expSave = self.explorers[self.selectedExplorer] # Replace the current explorer with a searcher and borrow its buffer se = searcher(self.nvim, self.expSave.buffer, self.expSave.cwd) # Perfor the search with the correct parameters dir = self.expSave.cwd filePattern = args[1] if(len(args) > 2): inputPattern = args[2] else: inputPattern = '' se.search(dir, filePattern, inputPattern) self.explorers[self.selectedExplorer] = se self.explorers[self.selectedExplorer].draw() self.nvim.command('startinsert') self.nvim.command('normal! $')
def tc_grep(self, args, range): """ The grep command """ # Save the current explorer for restoration when the searcher finish self.expSave = self.explorers[self.selectedExplorer] # Replace the current explorer with a searcher and borrow its buffer se = searcher(self.nvim, self.expSave.buffer, self.expSave.cwd) se.window = self.expSave.window # Perform the search with the correct parameters dir = self.expSave.cwd filePattern = "" if (len(args) > 1): filePattern = args[0] pattern = args[1] else: pattern = args[0] se.grep(dir, filePattern, pattern) self.explorers[self.selectedExplorer] = se self.explorers[self.selectedExplorer].draw() self.nvim.command('startinsert') self.nvim.command('normal! $') str = 'Help: <kbd> Filter pattern; <bs> Go to parent' self.nvim.current.buffer.append(str)