diff --git a/autoload/vimfiler/columns/filetypeicon.vim b/autoload/vimfiler/columns/filetypeicon.vim new file mode 100644 index 000000000..29c8c9ba5 --- /dev/null +++ b/autoload/vimfiler/columns/filetypeicon.vim @@ -0,0 +1,51 @@ +let s:save_cpo = &cpo +set cpo&vim +scriptencoding utf-8 + +let s:FILE = SpaceVim#api#import('file') + +let s:fish = &shell =~# 'fish' + +function! vimfiler#columns#filetypeicon#define() abort + return s:column +endfunction"}}} + +let s:column = { + \ 'name' : 'filetypeicon', + \ 'description' : 'plugin for vimfiler that provides filetype icon', + \ 'syntax' : 'vimfilerColumn__FileType', + \ } + +" @vimlint(EVL103, 1, a:files) +" @vimlint(EVL103, 1, a:context) +function! s:column.length(files, context) abort + return 3 +endfunction +" @vimlint(EVL103, 0, a:files) +" @vimlint(EVL103, 0, a:context) + +" @vimlint(EVL103, 1, a:context) +function! s:column.define_syntax(context) abort +endfunction +" @vimlint(EVL103, 0, a:context) + +" @vimlint(EVL103, 1, a:context) +function! s:column.get(file, context) abort + if a:file.vimfiler__is_directory + return ' ' + else + let icon = s:FILE.fticon(a:file.action__path) + + if !empty(icon) + return '[' . icon . ']' + else + return ' ' + endif + endif +endfunction +" @vimlint(EVL103, 0, a:context) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim:set et sw=2: diff --git a/config/plugins/vimfiler.vim b/config/plugins/vimfiler.vim index 0f1b677ee..84ee0077d 100644 --- a/config/plugins/vimfiler.vim +++ b/config/plugins/vimfiler.vim @@ -31,6 +31,7 @@ try \ 'toggle' : 1, \ 'auto_expand': 1, \ 'direction' : 'rightbelow', + \ 'explorer_columns' : 'filetypeicon', \ 'parent': 0, \ 'status' : 1, \ 'safe' : 0,