def key_two(self): windows.focus(3) buffers.two.open() self._current_mid_buffer = buffers.two self.diff(self._current_diff_mode) windows.focus(3) self.redraw_hud()
def key_original(self): if self._current_layout == 0: windows.focus(2) elif self._current_layout == 1: return elif self._current_layout == 2: return
def key_result(self): windows.focus(3) buffers.result.open() self._current_buffer_second = buffers.result self.diff(self._current_diff_mode) self.redraw_hud()
def key_original(self): windows.focus(2) buffers.original.open() self._current_buffer_first = buffers.original self.diff(self._current_diff_mode) self.redraw_hud()
def _diff_1(self): self.diffoff() self._current_diff_mode = 1 for i in range(2, self._number_of_windows + 2): windows.focus(i) vim.command('diffthis')
def _diff_3(self): self.diffoff() self._current_diff_mode = 3 windows.focus(3) vim.command('diffthis') windows.focus(4) vim.command('diffthis')
def redraw_hud(self): with windows.remain(): windows.focus(1) vim.command('setlocal modifiable') buffers.hud.set_lines(self.hud_lines()) vim.command('setlocal nomodifiable') vim.command('set winfixheight') vim.command('resize ' + setting('hud_size', '3')) vim.command('wincmd =')
def _key_use_12(self, target): targetwin = 2 if target == 1 else 4 with windows.remain(): self.diffoff() windows.focus(3) vim.command('diffthis') windows.focus(targetwin) vim.command('diffthis')
def diffoff(self): with windows.remain(): for winnr in range(2, 2 + self._number_of_windows): windows.focus(winnr) curbuffer = buffers.current for buffer in buffers.all: buffer.open() vim.command('diffoff') if setting('wrap'): vim.command('setlocal ' + setting('wrap')) curbuffer.open()
def _layout_0(self): self._number_of_windows = 1 self._current_layout = 0 # Open the layout windows.close_all() # Put the buffers in the appropriate windows windows.focus(1) self._current_buffer.open() self.open_hud(2) windows.focus(2)
def scrollbind(self, enabled): if self._current_diff_mode: return with windows.remain(): self._current_scrollbind = enabled for winnr in range(2, 2 + self._number_of_windows): windows.focus(winnr) if enabled: vim.command('set scrollbind') else: vim.command('set noscrollbind') if enabled: vim.command('syncbind')
def key_two(self): if self._current_layout == 0: windows.focus(4) elif self._current_layout == 1: windows.focus(4) elif self._current_layout == 2: windows.focus(4)
def key_one(self): if self._current_layout == 0: windows.focus(3) elif self._current_layout == 1: windows.focus(2) elif self._current_layout == 2: windows.focus(2)
def goto_result(self): if self._current_layout == 0: windows.focus(5) elif self._current_layout == 1: windows.focus(3) elif self._current_layout == 2: windows.focus(3)
def key_two(self): def open_two(winnr): buffers.two.open(winnr) if winnr == 2: self._current_buffer_first = buffers.two else: self._current_buffer_second = buffers.two self.diff(self._current_diff_mode) self.redraw_hud() curwindow = windows.currentnr() if curwindow == 1: curwindow = 2 # If file two is showing, go to it. windows.focus(2) if buffers.current == buffers.two: return windows.focus(3) if buffers.current == buffers.two: return # If both the original and result are showing, open file two in the # current window. windows.focus(2) if buffers.current == buffers.original: windows.focus(3) if buffers.current == buffers.result: open_two(curwindow) return # If file one is in window 2, then we open file two in window 2. windows.focus(3) if buffers.current == buffers.two: open_two(3) return # Otherwise, open file two in window 2. open_two(curwindow)
def key_one(self): def open_one(winnr): buffers.one.open(winnr) if winnr == 2: self._current_buffer_first = buffers.one else: self._current_buffer_second = buffers.one self.diff(self._current_diff_mode) self.redraw_hud() curwindow = windows.currentnr() if curwindow == 1: curwindow = 2 # If file one is showing, go to it. windows.focus(2) if buffers.current == buffers.one: return windows.focus(3) if buffers.current == buffers.one: return # If both the original and result are showing, open file one in the # current window. windows.focus(2) if buffers.current == buffers.original: windows.focus(3) if buffers.current == buffers.result: open_one(curwindow) return # If file two is in window 1, then we open file one in window 1. windows.focus(2) if buffers.current == buffers.two: open_one(2) return # Otherwise, open file one in the current window. open_one(curwindow)
def _layout_1(self): self._number_of_windows = 3 self._current_layout = 1 # Open the layout windows.close_all() windows.split() windows.split() # Put the buffers in the appropriate windows windows.focus(1) buffers.original.open() windows.focus(2) self._current_mid_buffer.open() windows.focus(3) buffers.result.open() self.open_hud(4) windows.focus(4)
def _layout_2(self): self._number_of_windows = 4 self._current_layout = 2 # Open the layout windows.close_all() windows.split() windows.split() # Put the buffers in the appropriate windows windows.focus(1) buffers.one.open() windows.focus(2) buffers.result.open() windows.focus(3) buffers.two.open() self.open_hud(4) windows.focus(3)
def _layout_1(self): self._number_of_windows = 2 self._current_layout = 1 # Open the layout windows.close_all() windows.split() # Put the buffers in the appropriate windows windows.focus(1) self._current_buffer_first.open() windows.focus(2) self._current_buffer_second.open() self.open_hud(3) windows.focus(3)
def key_original(self): windows.focus(2)
def key_original(self): windows.focus(2) buffers.original.open() self._current_buffer = buffers.original self.redraw_hud()
def key_one(self): windows.focus(2) buffers.one.open() self._current_buffer = buffers.one self.redraw_hud()
def key_two(self): windows.focus(2) buffers.two.open() self._current_buffer = buffers.two self.redraw_hud()
def key_result(self): windows.focus(2) buffers.result.open() self._current_buffer = buffers.result self.redraw_hud()
def open(self, winnr=None): if winnr is not None: windows.focus(winnr) vim.command('%dbuffer' % self.number)
def open_hud(self, winnr): windows.split() windows.focus(winnr) buffers.hud.open() vim.command('wincmd K') self.redraw_hud()
def key_result(self): windows.focus(4)
def goto_result(self): windows.focus(4)