Esempio 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()
Esempio 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()
Esempio 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
Esempio 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()
Esempio 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()
Esempio 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')
Esempio 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()
Esempio 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
Esempio 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()
Esempio 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')
Esempio 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')
Esempio 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')
Esempio 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 =')
Esempio 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')
Esempio 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')
Esempio 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 =')
Esempio 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()
Esempio 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()
Esempio 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)
Esempio 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)
Esempio 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')
Esempio 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')
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio n. 37
0
 def key_original(self):
     windows.focus(2)
Esempio n. 38
0
 def key_original(self):
     windows.focus(2)
     buffers.original.open()
     self._current_buffer = buffers.original
     self.redraw_hud()
Esempio n. 39
0
 def key_one(self):
     windows.focus(2)
     buffers.one.open()
     self._current_buffer = buffers.one
     self.redraw_hud()
Esempio n. 40
0
 def key_two(self):
     windows.focus(2)
     buffers.two.open()
     self._current_buffer = buffers.two
     self.redraw_hud()
Esempio n. 41
0
 def key_result(self):
     windows.focus(2)
     buffers.result.open()
     self._current_buffer = buffers.result
     self.redraw_hud()
Esempio n. 42
0
 def key_two(self):
     windows.focus(2)
     buffers.two.open()
     self._current_buffer = buffers.two
     self.redraw_hud()
Esempio n. 43
0
 def key_one(self):
     windows.focus(2)
     buffers.one.open()
     self._current_buffer = buffers.one
     self.redraw_hud()
Esempio n. 44
0
 def key_original(self):
     windows.focus(2)
     buffers.original.open()
     self._current_buffer = buffers.original
     self.redraw_hud()
Esempio n. 45
0
 def key_result(self):
     windows.focus(2)
     buffers.result.open()
     self._current_buffer = buffers.result
     self.redraw_hud()
Esempio n. 46
0
 def key_original(self):
     windows.focus(2)
Esempio n. 47
0
 def open(self, winnr=None):
     if winnr is not None:
         windows.focus(winnr)
     vim.command('%dbuffer' % self.number)
Esempio n. 48
0
 def open_hud(self, winnr):
     windows.split()
     windows.focus(winnr)
     buffers.hud.open()
     vim.command('wincmd K')
     self.redraw_hud()
Esempio n. 49
0
 def key_result(self):
     windows.focus(4)
Esempio n. 50
0
 def open_hud(self, winnr):
     windows.split()
     windows.focus(winnr)
     buffers.hud.open()
     vim.command('wincmd K')
     self.redraw_hud()
Esempio n. 51
0
 def key_result(self):
     windows.focus(4)
Esempio n. 52
0
 def goto_result(self):
     windows.focus(4)
Esempio n. 53
0
 def goto_result(self):
     windows.focus(4)
Esempio n. 54
0
 def open(self, winnr=None):
     if winnr is not None:
         windows.focus(winnr)
     vim.command('%dbuffer' % self.number)