Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
61 lines
2.0 KiB
Python
61 lines
2.0 KiB
Python
# ============================================================================
|
|
# FILE: dein_log.py
|
|
# AUTHOR: delphinus <delphinus@remora.cx>
|
|
# License: MIT license
|
|
# ============================================================================
|
|
|
|
import re
|
|
from .base import Base
|
|
|
|
HEADER_RE = re.compile(r'^\s*[a-zA-Z_]\w*://')
|
|
SPACE_RE = re.compile(r'^\s+')
|
|
DEIN_LOG_SYNTAX_HIGHLIGHT = [
|
|
{'name': 'Progress', 're': r'\[[ =]\+\]', 'link': 'String'},
|
|
{'name': 'Source', 're': r'|.\{-}|', 'link': 'Type'},
|
|
{'name': 'URI', 're': r'-> diff URI', 'link': 'Underlined'},
|
|
]
|
|
|
|
|
|
class Source(Base):
|
|
|
|
def __init__(self, vim):
|
|
super().__init__(vim)
|
|
|
|
self.name = 'dein/log'
|
|
|
|
def on_init(self, context):
|
|
context['__source_log'] = []
|
|
|
|
def gather_candidates(self, context):
|
|
dein_context = self.vim.call('dein#install#_get_context')
|
|
context['is_async'] = bool(dein_context)
|
|
if context['args'] and context['args'][0] == '!':
|
|
log_func = 'dein#install#_get_updates_log'
|
|
else:
|
|
log_func = 'dein#install#_get_log'
|
|
logs = self.vim.call(log_func)
|
|
|
|
def make_candidates(row):
|
|
return {
|
|
'word': ' -> diff URI',
|
|
'kind': 'file',
|
|
'action__path': SPACE_RE.sub('', row),
|
|
} if HEADER_RE.match(row) else {'word': row, 'kind': 'word'}
|
|
|
|
rows = len(context['__source_log'])
|
|
candidates = list(map(make_candidates, logs[rows:]))
|
|
context['__source_log'] = logs
|
|
|
|
# Needs wait to call Vim output handlers
|
|
self.vim.command('sleep 100m')
|
|
return candidates
|
|
|
|
def highlight(self):
|
|
for syn in DEIN_LOG_SYNTAX_HIGHLIGHT:
|
|
self.vim.command(
|
|
'syntax match {0}_{1} /{2}/ contained containedin={0}'
|
|
.format(self.syntax_name, syn['name'], syn['re']))
|
|
self.vim.command(
|
|
'highlight default link {0}_{1} {2}'
|
|
.format(self.syntax_name, syn['name'], syn['link']))
|