1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 15:50:04 +08:00
SpaceVim/bundle/defx-sftp/rplugin/python3/defx/column/sftp_time.py

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)])