From f7b3c755117a9a21c739c39dbf29e60e88168d40 Mon Sep 17 00:00:00 2001 From: Quangang Sheng Date: Tue, 17 Sep 2024 20:11:21 +0800 Subject: [PATCH] add symbol for noeol only show this symbol when g:WebDevIconsNoEndOfLineDefaultSymbol is configured --- doc/webdevicons.txt | 8 +++++++- plugin/webdevicons.vim | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/webdevicons.txt b/doc/webdevicons.txt index c1f5db1..583ddb0 100644 --- a/doc/webdevicons.txt +++ b/doc/webdevicons.txt @@ -651,7 +651,13 @@ Character Mappings ~ " set a byte character marker (BOM) utf-8 symbol when retrieving file encoding " disabled by default with no value let g:WebDevIconsUnicodeByteOrderMarkerDefaultSymbol = '' -< + + + + " set a noendofline symbol when retrieving file format + " disabled by default with no value + let g:WebDevIconsNoEndOfLineDefaultSymbol = '󰭜' + > " enable folder/directory glyph flag (disabled by default with 0) diff --git a/plugin/webdevicons.vim b/plugin/webdevicons.vim index 596ec68..d374440 100644 --- a/plugin/webdevicons.vim +++ b/plugin/webdevicons.vim @@ -82,6 +82,7 @@ call s:set('g:WebDevIconsTabAirLineAfterGlyphPadding', '') call s:set('g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol', '') call s:set('g:WebDevIconsUnicodeByteOrderMarkerDefaultSymbol', '') +call s:set('g:WebDevIconsNoEndOfLineDefaultSymbol', '') call s:set('g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol', g:DevIconsEnableFoldersOpenClose ? '' : '') call s:set('g:WebDevIconsUnicodeDecorateFolderNodesSymlinkSymbol', '') call s:set('g:DevIconsDefaultFolderOpenSymbol', '') @@ -565,11 +566,16 @@ endfunction function! WebDevIconsGetFileFormatSymbol(...) let fileformat = '' let bomb = '' + let noeolf = '' if (&bomb && g:WebDevIconsUnicodeByteOrderMarkerDefaultSymbol !=? '') let bomb = g:WebDevIconsUnicodeByteOrderMarkerDefaultSymbol . ' ' endif + if (!&eol && g:WebDevIconsNoEndOfLineDefaultSymbol !=? '') + let noeolf = g:WebDevIconsNoEndOfLineDefaultSymbol . ' ' + endif + if &fileformat ==? 'dos' let fileformat = '' elseif &fileformat ==? 'unix' @@ -580,7 +586,7 @@ function! WebDevIconsGetFileFormatSymbol(...) let artifactFix = s:DevIconsGetArtifactFix() - return bomb . fileformat . artifactFix + return bomb . noeolf . fileformat . artifactFix endfunction " for airline plugin {{{3