plugin/threesomelib/init.py @ adb7e3942b34

Omg something works.
author Steve Losh <steve@stevelosh.com>
date Sun, 12 Jun 2011 21:44:55 -0400
parents 0a0ec65f5e57
children 02506b7b8b92
import vim
from modes import Grid
from util import windows
from util.buffers import buffers


CONFLICT_MARKER_START = '<<<<<<<'
CONFLICT_MARKER_MARK = '======='
CONFLICT_MARKER_END = '>>>>>>>'

current_mode = Grid

def process_result():
    windows.close_all()
    buffers.result.open()

    lines = []
    in_conflict = False
    for line in buffers.result.lines:
        if in_conflict:
            if CONFLICT_MARKER_MARK in line:
                lines.append(line)
            if CONFLICT_MARKER_END in line:
                in_conflict = False
            continue

        if CONFLICT_MARKER_START in line:
            in_conflict = True
            continue

        lines.append(line)

    buffers.result.set_lines(lines)


def init():
    process_result()
    current_mode.activate()