1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 12:50:04 +08:00

Add os fileformat icon

This commit is contained in:
wsdjeg 2017-03-01 21:14:03 +08:00
parent c265d58ae9
commit 116df26da3
4 changed files with 57 additions and 0 deletions

View File

@ -186,6 +186,9 @@ let g:spacevim_buffer_index_type = 0
" Enable/Disable tabline filetype icon. default is 0. " Enable/Disable tabline filetype icon. default is 0.
let g:spacevim_enable_tabline_filetype_icon = 0 let g:spacevim_enable_tabline_filetype_icon = 0
"" ""
" Enable/Disable os fileformat icon. default is 0.
let g:spacevim_enable_os_fileformat_icon = 0
""
" Plugin groups to be loaded. " Plugin groups to be loaded.
" > " >
" let g:spacevim_plugin_groups = ['core', 'lang'] " let g:spacevim_plugin_groups = ['core', 'lang']

View File

@ -1,3 +1,4 @@
scriptencoding utf-8
let s:system = {} let s:system = {}
let s:system['isWindows'] = has('win16') || has('win32') || has('win64') let s:system['isWindows'] = has('win16') || has('win32') || has('win64')
@ -6,6 +7,52 @@ let s:system['isLinux'] = has('unix') && !has('macunix') && !has('win32unix')
let s:system['isOSX'] = has('macunix') let s:system['isOSX'] = has('macunix')
function! s:isDarwin() abort
if exists('s:is_darwin')
return s:is_darwin
endif
if has('macunix')
let s:is_darwin = 1
return s:is_darwin
endif
if ! has('unix')
let s:is_darwin = 0
return s:is_darwin
endif
if system('uname -s') ==# "Darwin\n"
let s:is_darwin = 1
else
let s:is_darwin = 0
endif
return s:is_darwin
endfunction
let s:system['isDarwin'] = function('s:isDarwin')
function! s:fileformat() abort
let fileformat = ''
if &fileformat ==? 'dos'
let fileformat = ''
elseif &fileformat ==? 'unix'
if s:isDarwin()
let fileformat = ''
else
let fileformat = ''
endif
elseif &fileformat ==? 'mac'
let fileformat = ''
endif
return fileformat
endfunction
let s:system['fileformat'] = function('s:fileformat')
function! SpaceVim#api#system#get() abort function! SpaceVim#api#system#get() abort
return deepcopy(s:system) return deepcopy(s:system)

View File

@ -79,3 +79,7 @@ let g:airline#extensions#tabline#tab_nr_type= 2
let g:airline#extensions#tabline#show_tab_type = 1 let g:airline#extensions#tabline#show_tab_type = 1
let g:airline#extensions#tabline#buffers_label = 'BUFFERS' let g:airline#extensions#tabline#buffers_label = 'BUFFERS'
let g:airline#extensions#tabline#tabs_label = 'TABS' let g:airline#extensions#tabline#tabs_label = 'TABS'
if g:spacevim_enable_os_fileformat_icon
let s:sys = SpaceVim#api#import('system')
let g:airline_section_y = " %{&fenc . ' ' . SpaceVim#api#import('system').fileformat()} "
endif

View File

@ -213,6 +213,9 @@ Set SpaceVim buffer index type, default is 0.
*g:spacevim_enable_tabline_filetype_icon* *g:spacevim_enable_tabline_filetype_icon*
Enable/Disable tabline filetype icon. default is 0. Enable/Disable tabline filetype icon. default is 0.
*g:spacevim_enable_os_fileformat_icon*
Enable/Disable os fileformat icon. default is 0.
*g:spacevim_plugin_groups* *g:spacevim_plugin_groups*
Plugin groups to be loaded. Plugin groups to be loaded.
> >