本文整理汇总了Python中neovim.command方法的典型用法代码示例。如果您正苦于以下问题:Python neovim.command方法的具体用法?Python neovim.command怎么用?Python neovim.command使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neovim
的用法示例。
在下文中一共展示了neovim.command方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: place_sign
# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import command [as 别名]
def place_sign(self, buffname, lineno):
"""place_sign
Places a new sign on the buffer and registers it as a breakpoint with
pudb
:param buffname:
:param lineno:
"""
# do nothing without a line number
if not lineno:
return None
# don't place it if it has already been placed
if self.has_breakpoint(buffname, lineno):
return self.pudbbp(buffname, lineno)
signcmd = "sign place {} line={} name={} file={}".format(
signid(buffname, lineno),
lineno,
self.sgnname(),
buffname)
__logger__.debug(signcmd)
self.nvim.command(signcmd)
if buffname in self._bps_placed:
self._bps_placed[buffname].append(signid(buffname, lineno))
else:
self._bps_placed[buffname] = [signid(buffname, lineno)]
return self.pudbbp(buffname, lineno)
示例2: remove_sign
# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import command [as 别名]
def remove_sign(self, buffname, lineno):
"""remove_sign
removes the sign from the buffer and the breakpoint from pudb
:param buffname:
:param bpt:
"""
if not self.has_breakpoint(buffname, lineno):
return
__logger__.info(
'removing sign %d at line: %d',
signid(buffname, lineno),
lineno)
vimmsg = 'sign unplace {} file={}'.format(
signid(buffname, lineno),
buffname)
__logger__.debug(vimmsg)
self.nvim.command(vimmsg)
self._bps_placed[buffname].pop(
self._bps_placed[buffname].index(
signid(buffname, lineno)))
示例3: AerojumpUp
# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import command [as 别名]
def AerojumpUp(self, args, range):
""" Go up one line of matches
Parameters:
n/a
Returns:
n/a
"""
self.aj.cursor_line_up()
# TODO: [Performance] Incremental update of highlights?
self.__update_highlights(self.aj.get_highlights())
self.main_win.cursor = self.aj.get_cursor()
self.nvim.command('startinsert')
self.nvim.command('normal! $')
示例4: AerojumpDown
# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import command [as 别名]
def AerojumpDown(self, args, range):
""" Go down one line of matches
Parameters:
n/a
Returns:
n/a
"""
self.aj.cursor_line_down()
# TODO: [Performance] Incremental update of highlights?
self.__update_highlights(self.aj.get_highlights())
self.main_win.cursor = self.aj.get_cursor()
self.nvim.command('startinsert')
self.nvim.command('normal! $')
示例5: AerojumpSelNext
# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import command [as 别名]
def AerojumpSelNext(self, args, range):
""" Select the next match
Parameters:
n/a
Returns:
n/a
"""
self.aj.cursor_match_next()
# TODO: [Performance] Incremental update of highlights?
self.__update_highlights(self.aj.get_highlights())
self.main_win.cursor = self.aj.get_cursor()
self.nvim.command('startinsert')
self.nvim.command('normal! $')
示例6: AerojumpSelPrev
# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import command [as 别名]
def AerojumpSelPrev(self, args, range):
""" Select the previous match
Parameters:
n/a
Returns:
n/a
"""
self.aj.cursor_match_prev()
# TODO: [Performance] Incremental update of highlights?
self.__update_highlights(self.aj.get_highlights())
self.main_win.cursor = self.aj.get_cursor()
self.nvim.command('startinsert')
self.nvim.command('normal! $')
示例7: AerojumpExit
# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import command [as 别名]
def AerojumpExit(self, args, range):
""" Exit aerojump without moving the selection
Parameters:
n/a
Returns:
n/a
"""
self.nvim.command('stopinsert')
self.nvim.current.buffer = self.og_buf
self.nvim.command('bwipeout %s' % self.aerojump_buf_num)
self.nvim.command('bwipeout %s' % self.filt_buf_num)
if self.uses_tabs:
self.nvim.command('tabclose')
# Restore original position
self.nvim.current.window.cursor = self.top_pos
self.nvim.command('normal! zt')
self.nvim.current.window.cursor = self.og_pos
示例8: session
# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import command [as 别名]
def session(self, args):
if not plugin.is_active:
self._vim.async_call(
lambda: self._vim.command('echom "No instance running."'),
)
return
self._vim.async_call(
lambda: self._vim.command('echom "Session ID: {}"'
.format(self._session_id)),
)
示例9: _handle_message
# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import command [as 别名]
def _handle_message(self, message):
if isinstance(message, m.WriteRequest):
self._message = message
self._text_applied.clear()
self._vim.async_call(
lambda: self._vim.funcs.TandemHandleWriteRequest(async=True),
)
self._text_applied.wait()
elif isinstance(message, m.SessionInfo):
self._session_id = message.session_id
self._vim.async_call(
lambda: self._vim.command('echom "Session ID: {}"'
.format(message.session_id)),
)
示例10: open_temp_matlab_script
# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import command [as 别名]
def open_temp_matlab_script(self, args):
dirname = os.path.join(os.path.expanduser('~'), '.vim-matlab/scratch/')
if not os.path.exists(dirname):
try:
os.makedirs(dirname)
except OSError as ex:
# In case of a race condition
if ex.errno != errno.EEXIST:
raise
timestamp = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
if len(args) > 0:
filename = "{}_{}.m".format(timestamp, args[0])
else:
filename = "{}.m".format(timestamp)
self.vim.command('edit {}'.format(os.path.join(dirname, filename)))
示例11: fix_name
# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import command [as 别名]
def fix_name(self, args):
curr_file = vim_helper.get_current_file_path()
modified = os.path.getmtime(curr_file)
changed = os.path.getctime(curr_file)
head_lines = self.vim.current.buffer[:100]
head_string = '\n'.join(head_lines)
def get_basename_ext(path):
filename = os.path.basename(path)
return os.path.splitext(filename)
def rename_function(name):
new_head = self.function_name_pattern.sub(
r"\1{}\3".format(name), head_string).split('\n')
for i, line in enumerate(new_head):
if line != head_lines[i]:
self.vim.current.buffer[i] = line
basename, ext = get_basename_ext(curr_file)
if len(args) > 0:
new_name, new_ext = get_basename_ext(args[0])
new_ext = new_ext if len(new_ext) > 0 else ext
rename_function(new_name)
self.vim.command("Rename {}{}".format(new_name, new_ext))
return
if vim_helper.is_current_buffer_modified() or changed != modified:
match = self.function_name_pattern.search(head_string)
if match is None:
return
function_name = match.group(2)
self.vim.command("Rename {}{}".format(function_name, ext))
else:
rename_function(basename)
示例12: set_sgnname
# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import command [as 别名]
def set_sgnname(self, sgnname):
self.nvim.command("let g:pudb_sign_name='{}'".format(sgnname))
# @property
示例13: set_bpsymbol
# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import command [as 别名]
def set_bpsymbol(self, bpsymbol):
self.nvim.command("let g:pudb_breakpoint_symbol='{}'".format(bpsymbol))
# @property
示例14: set_lgroup
# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import command [as 别名]
def set_lgroup(self, hlgroup):
self.nvim.command("let g:pudb_highlight_group='{}'".format(hlgroup))
# @property
示例15: set_launcher
# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import command [as 别名]
def set_launcher(self, launcher):
self.nvim.command("let g:pudb_python_launcher='{}'".format(launcher))
# @property