From 3adcf542289a0883924ae9b9be8b898c36702c95 Mon Sep 17 00:00:00 2001 From: Sam Chudnick Date: Sun, 11 Jun 2023 07:54:59 -0400 Subject: Add some Vim plugins --- .../denite/filter/devicons_denite_converter.py | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .vim/pack/vendor/start/vim-devicons/rplugin/python3/denite/filter/devicons_denite_converter.py (limited to '.vim/pack/vendor/start/vim-devicons/rplugin/python3/denite') diff --git a/.vim/pack/vendor/start/vim-devicons/rplugin/python3/denite/filter/devicons_denite_converter.py b/.vim/pack/vendor/start/vim-devicons/rplugin/python3/denite/filter/devicons_denite_converter.py new file mode 100644 index 0000000..6768009 --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/rplugin/python3/denite/filter/devicons_denite_converter.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# vim:se fenc=utf8 noet: +from .base import Base +from os.path import isdir + + +class Filter(Base): + + def __init__(self, vim): + super().__init__(vim) + self.name = 'devicons_denite_converter' + self.description = 'add devicons in front of candidates' + + def filter(self, context): + for candidate in context['candidates']: + + if 'bufnr' in candidate: + bufname = self.vim.funcs.bufname(candidate['bufnr']) + filename = self.vim.funcs.fnamemodify(bufname, ':p:t') + elif 'word' in candidate and 'action__path' in candidate: + filename = candidate['word'] + + icon = self.vim.funcs.WebDevIconsGetFileTypeSymbol( + filename, isdir(filename)) + + # Customize output format if not done already. + if icon not in candidate.get('abbr', '')[:10]: + candidate['abbr'] = ' {} {}'.format( + icon, candidate.get('abbr', candidate['word'])) + + return context['candidates'] -- cgit v1.2.3