本文整理汇总了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 ####
示例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))
示例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")
示例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)
示例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")
示例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)
示例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)))
示例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'")
示例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'")
示例10: previous_command
# 需要导入模块: import vim [as 别名]
# 或者: from vim import command [as 别名]
def previous_command():
"""Run previous command."""
_slimesend(CTRL_P)
示例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")
示例12: execute
# 需要导入模块: import vim [as 别名]
# 或者: from vim import command [as 别名]
def execute(cmd):
vim.command(cmd)
示例13: normal
# 需要导入模块: import vim [as 别名]
# 或者: from vim import command [as 别名]
def normal(str):
vim.command("normal "+str)
示例14: return2vim
# 需要导入模块: import vim [as 别名]
# 或者: from vim import command [as 别名]
def return2vim(val):
vim.command('let g:python_rv = "%s"' % (val,))
# utility functions
示例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)