* Added [BOM] (byte-order-mark) text in file encoding info

Like in vim-airline
See https://github.com/vim-airline/vim-airline/pull/992 and fdb74f549d

Ref #2015

* Test with no text added, to check travis results

* make bom a sepaate segment
This commit is contained in:
Philip Wellnitz 2019-10-12 17:02:57 +09:00 committed by GitHub
parent f4dfe39112
commit 589461e109
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 34 deletions

View File

@ -5,6 +5,7 @@
"file_size": "information:unimportant",
"file_format": "information:unimportant",
"file_encoding": "file_format",
"file_bom": "file_format",
"file_type": "file_format",
"branch": "information:additional",
"file_scheme": "file_name",

View File

@ -352,6 +352,18 @@ def file_encoding(pl, segment_info):
return vim_getbufoption(segment_info, 'fileencoding') or None
@requires_segment_info
@add_divider_highlight_group('background:divider')
def file_bom(pl, segment_info):
'''Return BOM of the current file
:return: Byte order mark or None if unknown or missing BOM
Divider highlight group used: ``background:divider``.
'''
return 'bom' if vim_getbufoption(segment_info, 'bomb') else None
@requires_segment_info
@add_divider_highlight_group('background:divider')
def file_type(pl, segment_info):