mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 19:00:06 +08:00
24 lines
655 B
Python
24 lines
655 B
Python
|
from pynvim import Nvim
|
||
|
import time
|
||
|
import typing
|
||
|
|
||
|
from defx.column.time import Column as Base, Highlights
|
||
|
from defx.context import Context
|
||
|
from defx.util import Candidate
|
||
|
|
||
|
|
||
|
class Column(Base):
|
||
|
|
||
|
def __init__(self, vim: Nvim) -> None:
|
||
|
super().__init__(vim)
|
||
|
|
||
|
self.name = 'sftp_time'
|
||
|
|
||
|
def get_with_highlights(
|
||
|
self, context: Context, candidate: Candidate
|
||
|
) -> typing.Tuple[str, Highlights]:
|
||
|
path = candidate['action__path']
|
||
|
text = time.strftime(self.vars['format'],
|
||
|
time.localtime(path.stat().st_mtime))
|
||
|
return (text, [(self.highlight_name, self.start, self._length)])
|