summaryrefslogtreecommitdiff
path: root/.vim/pack/vendor/start/vim-devicons/rplugin
diff options
context:
space:
mode:
Diffstat (limited to '.vim/pack/vendor/start/vim-devicons/rplugin')
-rw-r--r--.vim/pack/vendor/start/vim-devicons/rplugin/python3/denite/filter/devicons_denite_converter.py31
1 files changed, 31 insertions, 0 deletions
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 @@
1# -*- coding: utf-8 -*-
2# vim:se fenc=utf8 noet:
3from .base import Base
4from os.path import isdir
5
6
7class Filter(Base):
8
9 def __init__(self, vim):
10 super().__init__(vim)
11 self.name = 'devicons_denite_converter'
12 self.description = 'add devicons in front of candidates'
13
14 def filter(self, context):
15 for candidate in context['candidates']:
16
17 if 'bufnr' in candidate:
18 bufname = self.vim.funcs.bufname(candidate['bufnr'])
19 filename = self.vim.funcs.fnamemodify(bufname, ':p:t')
20 elif 'word' in candidate and 'action__path' in candidate:
21 filename = candidate['word']
22
23 icon = self.vim.funcs.WebDevIconsGetFileTypeSymbol(
24 filename, isdir(filename))
25
26 # Customize output format if not done already.
27 if icon not in candidate.get('abbr', '')[:10]:
28 candidate['abbr'] = ' {} {}'.format(
29 icon, candidate.get('abbr', candidate['word']))
30
31 return context['candidates']