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:
parent
9207fdc97d
commit
3aaeb9a910
51
autoload/vimfiler/columns/filetypeicon.vim
Normal file
51
autoload/vimfiler/columns/filetypeicon.vim
Normal 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:
|
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user