Esempio n. 1
0
def make_buffer_name(state):
    return '{}{} pyunite:{} ({})'.format(
        '' if state['replace'] else '[NR] ',
        state['scope'][:3].upper(),
        str(uniqueid())[:7],
        len(list(aggregate_candidates(state))),
    )
Esempio n. 2
0
def start_unite(state):
    validate_state(state)
    state['uid'] = str(uniqueid())
    state['tabpage_from'] = vim.current.tabpage
    state['window_from'] = vim.current.window
    state['container'] = {
        'global': vim,
        'tabpage': vim.current.tabpage,
        'window': vim.current.window
    }[state['scope']]
    old_state = buffer_logic(state)
    if state['close_on_empty'] and len(list(aggregate_candidates(state))) == 0:
        return
    saved = vim.current.window
    window_logic(state, old_state)
    set_buffer_syntax(state)
    if not state['focus_on_open']:
        change_window(saved, autocmd=True)
    variables.states.append(state)