def _highlight(self, context: UserContext, target: Candidate) -> None: util.clearmatch(self.vim) if 'action__pattern' in target: self.vim.current.window.vars['denite_match_id'] = self.vim.call( 'matchadd', context['highlight_preview_line'], target['action__pattern']) else: line = int(target.get('action__line', 0)) self.vim.current.window.vars['denite_match_id'] = self.vim.call( 'matchaddpos', context['highlight_preview_line'], [line])
def cleanup(self): if not self._is_suspend and not self._context['has_preview_window']: self._vim.command('pclose!') clearmatch(self._vim) if not self._context['immediately']: # Redraw to clear prompt self._vim.command('redraw | echo ""') self._vim.command('highlight! link CursorLine CursorLine') if self._context['cursor_shape']: self._vim.command('set guicursor&') self._vim.options['guicursor'] = self._guicursor
def cleanup(self): self._vim.command('pclose!') clearmatch(self._vim) # Redraw to clear prompt self._vim.command('redraw | echo ""') self._vim.command('highlight! link CursorLine CursorLine') if self._vim.call('exists', '#ColorScheme'): self._vim.command('silent doautocmd ColorScheme') if self._context['cursor_shape']: self._vim.command('set guicursor&') self._vim.options['guicursor'] = self._guicursor
def cleanup(self): if not self._is_suspend and not self._context['has_preview_window']: self._vim.command('pclose!') clearmatch(self._vim) if not self._context['immediately']: # Redraw to clear prompt self._vim.command('redraw | echo ""') self._vim.command('highlight! link CursorLine CursorLine') if self._vim.call('exists', '#ColorScheme'): self._vim.command('silent doautocmd ColorScheme') if self._vim.call('mode') == 'n': self._vim.command('normal! zv') if self._context['cursor_shape']: self._vim.command('set guicursor&') self._vim.options['guicursor'] = self._guicursor
def cleanup(self): # Clear previewed buffers if not self._is_suspend and not self._context['has_preview_window']: self._vim.command('pclose!') for bufnr in self._vim.vars['denite#_previewed_buffers'].keys(): if not self._vim.call('win_findbuf', bufnr): self._vim.command('silent bdelete ' + str(bufnr)) self._vim.vars['denite#_previewed_buffers'] = {} clearmatch(self._vim) if not self._context['immediately']: # Redraw to clear prompt self._vim.command('redraw | echo ""') self._vim.command('highlight! link CursorLine CursorLine') if self._context['cursor_shape']: self._vim.command('set guicursor&') self._vim.options['guicursor'] = self._guicursor if self._context['split'] == 'floating': self._vim.options['titlestring'] = self._titlestring self._vim.options['ruler'] = self._ruler
def _quit_buffer(self) -> None: self._cleanup() if self._vim.call('bufwinnr', self._bufnr) < 0: # Denite buffer is already closed return winids = self._vim.call('win_findbuf', self._vim.vars['denite#_filter_bufnr']) if winids: # Quit filter buffer self._vim.call('win_gotoid', winids[0]) self._close_current_window() # Move to denite window self._vim.call('win_gotoid', self._winid) # Restore the window if self._context['split'] == 'no': self._switch_prev_buffer() for k, v in self._save_window_options.items(): self._vim.current.window.options[k] = v else: if self._context['split'] == 'tab': self._vim.command('tabclose!') if self._context['split'] != 'tab': self._close_current_window() self._vim.call('win_gotoid', self._prev_winid) # Restore the position self._vim.call('setpos', '.', self._prev_curpos) if self._get_wininfo() and self._get_wininfo() == self._prev_wininfo: # Note: execute restcmd twice to restore layout properly self._vim.command(self._winrestcmd) self._vim.command(self._winrestcmd) clearmatch(self._vim)
def _highlight(self, context, line): util.clearmatch(self.vim) self.vim.current.window.vars['denite_match_id'] = self.vim.call( 'matchaddpos', context['highlight_preview_line'], [line])