示例#1
0
    def diff(self, diffmode):
        with windows.remain():
            getattr(self, '_diff_%d' % diffmode)()

        # Reset the scrollbind to whatever it was before we diffed.
        if not diffmode:
            self.scrollbind(self._current_scrollbind)
示例#2
0
    def diff(self, diffmode):
        with windows.remain():
            getattr(self, '_diff_%d' % diffmode)()

        # Reset the scrollbind to whatever it was before we diffed.
        if not diffmode:
            self.scrollbind(self._current_scrollbind)
示例#3
0
    def key_use(self):
        current_diff = self._current_diff_mode
        with windows.remain():
            self._diff_3()  # diff the middle and result windows

        if buffers.current == buffers.result:
            vim.command('diffget')
        elif buffers.current in (buffers.one, buffers.two):
            vim.command('diffput')

        self.diff(current_diff)
示例#4
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')
示例#5
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 =')
示例#6
0
    def key_use(self):
        current_diff = self._current_diff_mode
        with windows.remain():
            self._diff_3()  # diff the middle and result windows

        if buffers.current == buffers.result:
            vim.command('diffget')
        elif buffers.current in (buffers.one, buffers.two):
            vim.command('diffput')

        self.diff(current_diff)
示例#7
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')
示例#8
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 =')
示例#9
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()
示例#10
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()
示例#11
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')
示例#12
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')
示例#13
0
    def key_use(self):
        active = (self._current_buffer_first, self._current_buffer_second)

        if buffers.result not in active:
            return

        if buffers.one not in active and buffers.two not in active:
            return

        current_diff = self._current_diff_mode
        with windows.remain():
            self._diff_1()  # diff the windows

        if buffers.current == buffers.result:
            vim.command('diffget')
        elif buffers.current in (buffers.one, buffers.two):
            vim.command('diffput')

        self.diff(current_diff)
示例#14
0
    def key_use(self):
        active = (self._current_buffer_first, self._current_buffer_second)

        if buffers.result not in active:
            return

        if buffers.one not in active and buffers.two not in active:
            return

        current_diff = self._current_diff_mode
        with windows.remain():
            self._diff_1()  # diff the windows

        if buffers.current == buffers.result:
            vim.command('diffget')
        elif buffers.current in (buffers.one, buffers.two):
            vim.command('diffput')

        self.diff(current_diff)