Exemplo n.º 1
0
 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()
Exemplo n.º 2
0
 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()
Exemplo n.º 3
0
 def key_original(self):
     if self._current_layout == 0:
         windows.focus(2)
     elif self._current_layout == 1:
         return
     elif self._current_layout == 2:
         return
Exemplo n.º 4
0
    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()
Exemplo n.º 5
0
    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()
Exemplo n.º 6
0
    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')
Exemplo n.º 7
0
    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()
Exemplo n.º 8
0
 def key_original(self):
     if self._current_layout == 0:
         windows.focus(2)
     elif self._current_layout == 1:
         return
     elif self._current_layout == 2:
         return
Exemplo n.º 9
0
    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()
Exemplo n.º 10
0
    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')
Exemplo n.º 11
0
    def _diff_3(self):
        self.diffoff()
        self._current_diff_mode = 3

        windows.focus(3)
        vim.command('diffthis')

        windows.focus(4)
        vim.command('diffthis')
Exemplo n.º 12
0
    def _diff_3(self):
        self.diffoff()
        self._current_diff_mode = 3

        windows.focus(3)
        vim.command('diffthis')

        windows.focus(4)
        vim.command('diffthis')
Exemplo n.º 13
0
    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 =')
Exemplo n.º 14
0
    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')
Exemplo n.º 15
0
    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')
Exemplo n.º 16
0
    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 =')
Exemplo n.º 17
0
    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()
Exemplo n.º 18
0
    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()
Exemplo n.º 19
0
    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)
Exemplo n.º 20
0
    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)
Exemplo n.º 21
0
    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')
Exemplo n.º 22
0
    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')
Exemplo n.º 23
0
 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)
Exemplo n.º 24
0
 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)
Exemplo n.º 25
0
 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)
Exemplo n.º 26
0
 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)
Exemplo n.º 27
0
 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)
Exemplo n.º 28
0
    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)
Exemplo n.º 29
0
    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)
Exemplo n.º 30
0
 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)
Exemplo n.º 31
0
    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)
Exemplo n.º 32
0
    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)
Exemplo n.º 33
0
    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)
Exemplo n.º 34
0
    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)
Exemplo n.º 35
0
    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)
Exemplo n.º 36
0
    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)
Exemplo n.º 37
0
 def key_original(self):
     windows.focus(2)
Exemplo n.º 38
0
 def key_original(self):
     windows.focus(2)
     buffers.original.open()
     self._current_buffer = buffers.original
     self.redraw_hud()
Exemplo n.º 39
0
 def key_one(self):
     windows.focus(2)
     buffers.one.open()
     self._current_buffer = buffers.one
     self.redraw_hud()
Exemplo n.º 40
0
 def key_two(self):
     windows.focus(2)
     buffers.two.open()
     self._current_buffer = buffers.two
     self.redraw_hud()
Exemplo n.º 41
0
 def key_result(self):
     windows.focus(2)
     buffers.result.open()
     self._current_buffer = buffers.result
     self.redraw_hud()
Exemplo n.º 42
0
 def key_two(self):
     windows.focus(2)
     buffers.two.open()
     self._current_buffer = buffers.two
     self.redraw_hud()
Exemplo n.º 43
0
 def key_one(self):
     windows.focus(2)
     buffers.one.open()
     self._current_buffer = buffers.one
     self.redraw_hud()
Exemplo n.º 44
0
 def key_original(self):
     windows.focus(2)
     buffers.original.open()
     self._current_buffer = buffers.original
     self.redraw_hud()
Exemplo n.º 45
0
 def key_result(self):
     windows.focus(2)
     buffers.result.open()
     self._current_buffer = buffers.result
     self.redraw_hud()
Exemplo n.º 46
0
 def key_original(self):
     windows.focus(2)
Exemplo n.º 47
0
 def open(self, winnr=None):
     if winnr is not None:
         windows.focus(winnr)
     vim.command('%dbuffer' % self.number)
Exemplo n.º 48
0
 def open_hud(self, winnr):
     windows.split()
     windows.focus(winnr)
     buffers.hud.open()
     vim.command('wincmd K')
     self.redraw_hud()
Exemplo n.º 49
0
 def key_result(self):
     windows.focus(4)
Exemplo n.º 50
0
 def open_hud(self, winnr):
     windows.split()
     windows.focus(winnr)
     buffers.hud.open()
     vim.command('wincmd K')
     self.redraw_hud()
Exemplo n.º 51
0
 def key_result(self):
     windows.focus(4)
Exemplo n.º 52
0
 def goto_result(self):
     windows.focus(4)
Exemplo n.º 53
0
 def goto_result(self):
     windows.focus(4)
Exemplo n.º 54
0
 def open(self, winnr=None):
     if winnr is not None:
         windows.focus(winnr)
     vim.command('%dbuffer' % self.number)