當前位置: 首頁>>代碼示例>>Python>>正文


Python vim.command方法代碼示例

本文整理匯總了Python中vim.command方法的典型用法代碼示例。如果您正苦於以下問題:Python vim.command方法的具體用法?Python vim.command怎麽用?Python vim.command使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vim的用法示例。


在下文中一共展示了vim.command方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: normalize

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import command [as 別名]
def normalize():
    newbuf = [""]
    for line in vim.current.buffer:
        line = line.strip()
        if line:
            top = newbuf.pop()
            if top:
                top += " " + line
            else:
                top = "\t"+line
            newbuf.append(top)
        elif newbuf[-1]:
            newbuf.append("")
    vim.current.buffer[:] = newbuf
    vim.command("set ff=dos")


### initialization and setup #### 
開發者ID:kdart,項目名稱:pycopia,代碼行數:20,代碼來源:vimplayer.py

示例2: gdscript_complete

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import command [as 別名]
def gdscript_complete():
    util.clear_cache()
    completer.clear_completions()

    line = util.get_line()[0:util.get_cursor_col_num() - 1]
    syn_attr = util.get_syn_attr()
    if syn_attr == "gdComment":
        return
    elif syn_attr == "gdString":
        completer.complete_paths()
    elif re.match("(\s*class\s+\w+\s+)?extends\s*", line):
        completer.complete_class_names(classes.EXTENDABLE)
    elif re.match("export\(\s*", line):
        completer.complete_class_names(classes.EXPORTABLE)
    elif re.match("\s*func", line):
        completer.complete_method_signatures()
    elif line and line[-1] == ".":
        completer.complete_dot()
    else:
        completer.complete_script(include_globals=True)

    completions = completer.get_completions()
    vim.command("let gdscript_completions = " + str(completions)) 
開發者ID:calviken,項目名稱:vim-gdscript3,代碼行數:25,代碼來源:init.py

示例3: update_buffers

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import command [as 別名]
def update_buffers(req):
    b1_id = int(vim.eval("s:b1"))
    b1 = vim.buffers[b1_id]

    b2_id = int(vim.eval("s:b2"))
    b2 = vim.buffers[b2_id]

    # Set up the buffers
    set_buffer_content(b1, req.full_message())

    if req.response is not None:
        set_buffer_content(b2, req.response.full_message())

    # Save the port, ssl, host setting
    vim.command("let s:dest_port=%d" % req.dest_port)
    vim.command("let s:dest_host='%s'" % escape(req.dest_host))

    if req.use_tls:
        vim.command("let s:use_tls=1")
    else:
        vim.command("let s:use_tls=0") 
開發者ID:roglew,項目名稱:pappy-proxy,代碼行數:23,代碼來源:repeater.py

示例4: set_up_windows

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import command [as 別名]
def set_up_windows():
    reqid = vim.eval("a:2")
    storage_id = vim.eval("a:3")
    msg_addr = vim.eval("a:4")

    vim.command("let s:storage_id=%d" % int(storage_id))
    
    # Get the left buffer
    vim.command("new")
    vim.command("only")
    b2 = vim.current.buffer
    vim.command("let s:b2=bufnr('$')")

    # Vsplit new file
    vim.command("vnew")
    b1 = vim.current.buffer
    vim.command("let s:b1=bufnr('$')")

    print msg_addr
    comm_type, comm_addr = msg_addr.split(":", 1)
    set_conn(comm_type, comm_addr)
    with ProxyConnection(kind=comm_type, addr=comm_addr) as conn:
        # Get the request
        req = conn.req_by_id(reqid, int(storage_id))
        update_buffers(req) 
開發者ID:roglew,項目名稱:pappy-proxy,代碼行數:27,代碼來源:repeater.py

示例5: mw_diff

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import command [as 別名]
def mw_diff(article_name):
    article_name = infer_default(article_name)

    s = site()
    vim.command("diffthis")
    vim.command(
        "leftabove vsplit %s"
        % fn_escape(article_name + " - REMOTE")
    )
    vim.command(
        "setlocal buftype=nofile bufhidden=delete nobuflisted"
    )
    vim.command("set ft=mediawiki")
    vim.current.buffer[:] = (
        s.Pages[article_name].text().split("\n")
    )
    vim.command("diffthis")
    vim.command("set nomodifiable") 
開發者ID:aquach,項目名稱:vim-mediawiki-editor,代碼行數:20,代碼來源:mediawiki_editor.py

示例6: run_this_line

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import command [as 別名]
def run_this_line(dedent=False):
    line = vim.current.line
    if dedent:
        line = line.lstrip()
    if line.rstrip().endswith('?'):
        # intercept question mark queries -- move to the word just before the
        # question mark and call the get_doc_buffer on it
        w = vim.current.window
        original_pos =  w.cursor
        new_pos = (original_pos[0], vim.current.line.index('?')-1)
        w.cursor = new_pos
        if line.rstrip().endswith('??'):
            # double question mark should display source
            # XXX: it's not clear what level=2 is for, level=1 is sufficient
            # to get the code -- follow up with IPython team on this
            get_doc_buffer(1)
        else:
            get_doc_buffer()
        # leave insert mode, so we're in command mode
        vim.command('stopi')
        w.cursor = original_pos
        return
    msg_id = send(line)
    print_prompt(line, msg_id) 
開發者ID:vatlab,項目名稱:sos,代碼行數:26,代碼來源:vim_ipython.py

示例7: ctrlp_match

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import command [as 別名]
def ctrlp_match():
    """
    Deprecated interface that gets arguments by calling vim.eval() and returns
    outputs by calling vim.command(). Kept for Denite. Use ctrlp_match_with()
    or cpsm_py.ctrlp_match() in new code.
    """
    # TODO: a:regex is unimplemented.
    results, regexes = ctrlp_match_with(
            items=_vim_eval("a:items"), query=_vim_eval("a:str"),
            limit=int(_vim_eval("a:limit")), mmode=_vim_eval("a:mmode"),
            ispath=int(_vim_eval("a:ispath")), crfile=_vim_eval("a:crfile"),
            highlight_mode=_vim_eval("g:cpsm_highlight_mode"),
            match_crfile=int(_vim_eval("s:match_crfile")),
            max_threads=int(_vim_eval("g:cpsm_max_threads")),
            query_inverting_delimiter=_vim_eval("g:cpsm_query_inverting_delimiter"),
            regex_line_prefix=_vim_eval("s:regex_line_prefix"),
            unicode=int(_vim_eval("g:cpsm_unicode")))
    vim.command("let s:results = [%s]" % ",".join(
            map(_escape_and_quote, results)))
    vim.command("let s:regexes = [%s]" % ",".join(
            map(_escape_and_quote, regexes))) 
開發者ID:nixprime,項目名稱:cpsm,代碼行數:23,代碼來源:cpsm.py

示例8: jump_next_cell

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import command [as 別名]
def jump_next_cell():
    """Move cursor to the start of the next cell."""
    current_row, _ = vim.current.window.cursor
    cell_boundaries = _get_cell_boundaries()
    next_cell_row = _get_next_cell(current_row, cell_boundaries)
    if next_cell_row != current_row:
        try:
            vim.current.window.cursor = (next_cell_row, 0)
        except vim.error:
            vim.command("echo 'Cell header is outside the buffer boundaries'") 
開發者ID:hanschen,項目名稱:vim-ipython-cell,代碼行數:12,代碼來源:ipython_cell.py

示例9: jump_prev_cell

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import command [as 別名]
def jump_prev_cell():
    """Move cursor to the start of the current or previous cell."""
    current_row, _ = vim.current.window.cursor
    cell_boundaries = _get_cell_boundaries()
    prev_cell_row = _get_prev_cell(current_row, cell_boundaries)
    if prev_cell_row != current_row:
        try:
            vim.current.window.cursor = (prev_cell_row, 0)
        except vim.error:
            vim.command("echo 'Cell header is outside the buffer boundaries'") 
開發者ID:hanschen,項目名稱:vim-ipython-cell,代碼行數:12,代碼來源:ipython_cell.py

示例10: previous_command

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import command [as 別名]
def previous_command():
    """Run previous command."""
    _slimesend(CTRL_P) 
開發者ID:hanschen,項目名稱:vim-ipython-cell,代碼行數:5,代碼來源:ipython_cell.py

示例11: _slimesend

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import command [as 別名]
def _slimesend(string):
    """Send ``string`` using vim-slime."""
    if not string:
        return

    try:
        vim.command('SlimeSend1 ' + CTRL_U + '{}'.format(string))
    except vim.error:
        _error("Could not execute SlimeSend1 command, make sure vim-slime is "
               "installed") 
開發者ID:hanschen,項目名稱:vim-ipython-cell,代碼行數:12,代碼來源:ipython_cell.py

示例12: execute

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import command [as 別名]
def execute(cmd):
        vim.command(cmd) 
開發者ID:yuttie,項目名稱:hydrangea-vim,代碼行數:4,代碼來源:hydrangea.py

示例13: normal

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import command [as 別名]
def normal(str):
    vim.command("normal "+str) 
開發者ID:kdart,項目名稱:pycopia,代碼行數:4,代碼來源:pydev.py

示例14: return2vim

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import command [as 別名]
def return2vim(val):
    vim.command('let g:python_rv = "%s"' % (val,))

# utility functions 
開發者ID:kdart,項目名稱:pycopia,代碼行數:6,代碼來源:pydev.py

示例15: keyword_split

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import command [as 別名]
def keyword_split():
    modname = vim.eval('expand("<cword>")')
    filename = devhelpers.find_source_file(modname)
    if filename is not None:
        vim.command("split %s" % (filename,))
    else:
        print("Could not find source to %s." % modname, file=sys.stderr) 
開發者ID:kdart,項目名稱:pycopia,代碼行數:9,代碼來源:pydev.py


注:本文中的vim.command方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。