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


Python vim.vars方法代碼示例

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


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

示例1: highlight_line

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import vars [as 別名]
def highlight_line(group, buf_number, line_number):
    match_id = int(vim.buffers[buf_number].vars.get('_roast_match_id', 0))

    if match_id:
        win = None
        for win in vim.windows:
            if win.buffer.number == buf_number:
                break

        try:
            vim.eval(f'matchdelete({match_id})' if win is None else f'matchdelete({match_id}, {win.number})')
        except vim.error:
            # TODO: Only hide E803 error, which is thrown if this match_id has already been deleted.
            pass

    vim.buffers[buf_number].vars['_roast_match_id'] = vim.eval(
        fr"matchadd('{group}', '\V' . escape(getbufline({buf_number}, {line_number + 1})[0], '\') . '\$')"
    ) 
開發者ID:sharat87,項目名稱:roast.vim,代碼行數:20,代碼來源:roast.py

示例2: __init__

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import vars [as 別名]
def __init__(self, vim):
        Ncm2Source.__init__(self, vim)

        env = vim.vars['ncm2_jedi#environment']
        if not env:
            osenv = os.environ
            if 'VIRTUAL_ENV' not in osenv and 'CONDA_PREFIX' in osenv:
                # if conda is active
                self._env = jedi.create_environment(osenv['CONDA_PREFIX'])
            else:
                # get_default_environment handles VIRTUAL_ENV
                self._env = jedi.get_default_environment()
        else:
            self._env = jedi.create_environment(env)

        rc_settings = vim.vars['ncm2_jedi#settings']
        for name in rc_settings:
            setattr(settings, name, rc_settings[name]) 
開發者ID:ncm2,項目名稱:ncm2-jedi,代碼行數:20,代碼來源:ncm2_jedi.py

示例3: show_error

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import vars [as 別名]
def show_error(message: str):
    vim.vars['__roast_error_message'] = message
    vim.eval("timer_start(10, {_ -> execute(['echohl Error', 'redraw', 'echomsg g:__roast_error_message',"
             " 'echohl None', 'unlet g:__roast_error_message'], '')})") 
開發者ID:sharat87,項目名稱:roast.vim,代碼行數:6,代碼來源:roast.py

示例4: next_render

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import vars [as 別名]
def next_render(delta=1):
    renderer = vim.current.buffer.vars['_roast_renderer']
    if not isinstance(renderer, str):
        renderer = renderer.decode()
    vim.command('buffer __roast_' + renderers[(renderers.index(renderer) + delta) % len(renderers)] + '__') 
開發者ID:sharat87,項目名稱:roast.vim,代碼行數:7,代碼來源:roast.py

示例5: test_binary

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import vars [as 別名]
def test_binary():
    assert NoName().binary == 'ls'
    with mock.patch.dict(vim.vars, {'validator_no_name_binary': b'lls'}):
        assert NoName().binary == 'lls' 
開發者ID:maralla,項目名稱:validator.vim,代碼行數:6,代碼來源:test_validator.py

示例6: test_args

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import vars [as 別名]
def test_args():
    assert NoName().cmd_args == '-a -b -c -d'
    with mock.patch.dict(vim.vars, {'validator_no_name_args': b'-l'}):
        assert NoName().cmd_args == '-l' 
開發者ID:maralla,項目名稱:validator.vim,代碼行數:6,代碼來源:test_validator.py

示例7: test_load_checkers

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import vars [as 別名]
def test_load_checkers():
    import vim

    with mock.patch.dict(vim.vars, {
            'validator_filetype_map': {b'abcd': b'linter1'}}):
        assert isinstance(load_checkers(b'abcd')['checker1'], Linter1)
    assert isinstance(load_checkers(b'linter2')['checker2'], Linter2) 
開發者ID:maralla,項目名稱:validator.vim,代碼行數:9,代碼來源:test_load.py

示例8: nvim_call_function

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import vars [as 別名]
def nvim_call_function(method, args):
    vim.vars['_neovim_rpc_tmp_args'] = args
    # vim.eval('getcurpos()') return an array of string, it should be an array
    # of int.  Use json_encode to workaround this
    return vim.bindeval('call("%s",g:_neovim_rpc_tmp_args)' % method) 
開發者ID:roxma,項目名稱:vim-hug-neovim-rpc,代碼行數:7,代碼來源:neovim_rpc_methods.py

示例9: nvim_get_var

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import vars [as 別名]
def nvim_get_var(name):
    return vim.vars[name] 
開發者ID:roxma,項目名稱:vim-hug-neovim-rpc,代碼行數:4,代碼來源:neovim_rpc_methods.py

示例10: nvim_set_var

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import vars [as 別名]
def nvim_set_var(name, val):
    vim.vars[name] = val
    return val 
開發者ID:roxma,項目名稱:vim-hug-neovim-rpc,代碼行數:5,代碼來源:neovim_rpc_methods.py

示例11: nvim_buf_get_var

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import vars [as 別名]
def nvim_buf_get_var(buffer, name):
    return buffer.vars[name] 
開發者ID:roxma,項目名稱:vim-hug-neovim-rpc,代碼行數:4,代碼來源:neovim_rpc_methods.py

示例12: nvim_buf_set_var

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import vars [as 別名]
def nvim_buf_set_var(buffer, name, val):
    buffer.vars[name] = val 
開發者ID:roxma,項目名稱:vim-hug-neovim-rpc,代碼行數:4,代碼來源:neovim_rpc_methods.py

示例13: nvim_win_set_var

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import vars [as 別名]
def nvim_win_set_var(window, name, val):
    window.vars[name] = val 
開發者ID:roxma,項目名稱:vim-hug-neovim-rpc,代碼行數:4,代碼來源:neovim_rpc_methods.py

示例14: nvim_set_client_info

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import vars [as 別名]
def nvim_set_client_info(*args):
    # https://github.com/roxma/vim-hug-neovim-rpc/issues/61
    vim.vars['_neovim_rpc_client_info'] = args 
開發者ID:roxma,項目名稱:vim-hug-neovim-rpc,代碼行數:5,代碼來源:neovim_rpc_methods.py

示例15: nvim_get_client_info

# 需要導入模塊: import vim [as 別名]
# 或者: from vim import vars [as 別名]
def nvim_get_client_info():
    if '_neovim_rpc_client_info' not in vim.vars:
        return []
    return vim.vars['_neovim_rpc_client_info'] 
開發者ID:roxma,項目名稱:vim-hug-neovim-rpc,代碼行數:6,代碼來源:neovim_rpc_methods.py


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