1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 02:10:05 +08:00

Add filetypeicon in vimfiler

This commit is contained in:
wsdjeg 2017-04-03 17:02:48 +08:00
parent 9207fdc97d
commit 3aaeb9a910
2 changed files with 52 additions and 0 deletions

View File

@ -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:

View File

@ -31,6 +31,7 @@ try
\ 'toggle' : 1, \ 'toggle' : 1,
\ 'auto_expand': 1, \ 'auto_expand': 1,
\ 'direction' : 'rightbelow', \ 'direction' : 'rightbelow',
\ 'explorer_columns' : 'filetypeicon',
\ 'parent': 0, \ 'parent': 0,
\ 'status' : 1, \ 'status' : 1,
\ 'safe' : 0, \ 'safe' : 0,