diff options
author | Sam Chudnick <sam@chudnick.com> | 2023-06-11 07:54:59 -0400 |
---|---|---|
committer | Sam Chudnick <sam@chudnick.com> | 2023-06-11 07:54:59 -0400 |
commit | 3adcf542289a0883924ae9b9be8b898c36702c95 (patch) | |
tree | f02166ef4c95161ffa994eb1a3e5729c93c2c66b /.vim/pack/vendor/start/vim-devicons/rplugin | |
parent | dfcc303e7cc284a45f55bae81ed888dc256432b8 (diff) |
Add some Vim plugins
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.py | 31 |
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: | ||
3 | from .base import Base | ||
4 | from os.path import isdir | ||
5 | |||
6 | |||
7 | class 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'] | ||