install.fairie/dotfiles/.vim/plugged/vim-devicons/autoload/devicons/plugins/unite.vim
Git E2E Dev Test Username e30fca43b3 git subrepo clone (merge) https://github.com/ryanoasis/vim-devicons.git ./dotfiles/.vim/plugged/vim-devicons
subrepo:
  subdir:   "dotfiles/.vim/plugged/vim-devicons"
  merged:   "71f239af2"
upstream:
  origin:   "https://github.com/ryanoasis/vim-devicons.git"
  branch:   "master"
  commit:   "71f239af2"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"
2022-10-18 10:37:31 -04:00

37 lines
1.2 KiB
VimL

function! devicons#plugins#unite#init() abort
let s:filters = {
\ 'name': 'devicons_unite_converter'
\ }
function! s:filters.filter(candidates, context) abort
for candidate in a:candidates
if has_key(candidate, 'action__buffer_nr')
let bufname = bufname(candidate.action__buffer_nr)
let filename = fnamemodify(bufname, ':p:t')
let path = fnamemodify(bufname, ':p:h')
elseif has_key(candidate, 'word') && has_key(candidate, 'action__path')
let path = candidate.action__path
let filename = candidate.word
endif
let icon = WebDevIconsGetFileTypeSymbol(filename, isdirectory(filename))
" prevent filenames of buffers getting 'lost'
if filename != path
let path = printf('%s', filename)
endif
" Customize output format.
let candidate.abbr = printf('%s %s', icon, path)
endfor
return a:candidates
endfunction
call unite#define_filter(s:filters)
unlet s:filters
call unite#custom#source('file,file_rec,buffer,file_rec/async,file_rec/neovim,file_rec/neovim2,file_rec/git', 'converters', 'devicons_unite_converter')
endfunction
" vim: tabstop=2 softtabstop=2 shiftwidth=2 expandtab: