Merge pull request #2385 from ReubenM/master

Completely customizable linenr, maxlinenr, colnr symbols and strings
This commit is contained in:
Christian Brabandt 2021-05-26 08:02:03 +02:00 committed by GitHub
commit 05bd105cab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 24 deletions

View File

@ -87,12 +87,15 @@ function! airline#init#bootstrap()
call s:check_defined('g:airline_right_sep', "\ue0b2") " 
call s:check_defined('g:airline_right_alt_sep', "\ue0b3") " 
" ro=, ws=☲, lnr=, mlnr=☰, colnr=, br=, nx=Ɇ, crypt=🔒, dirty=⚡
" Note: For powerline, we add an extra space after maxlinenr symbol,
" because it is usually setup as a ligature in most powerline patched
" fonts. It can be over-ridden by configuring a custom maxlinenr
call extend(g:airline_symbols, {
\ 'readonly': "\ue0a2",
\ 'whitespace': "\u2632",
\ 'maxlinenr': "\u2630",
\ 'linenr': "\ue0a1",
\ 'colnr': "\ue0a3",
\ 'maxlinenr': "\u2630 ",
\ 'linenr': " \ue0a1:",
\ 'colnr': " \ue0a3:",
\ 'branch': "\ue0a0",
\ 'notexists': "\u0246",
\ 'dirty': "\u26a1",
@ -109,8 +112,8 @@ function! airline#init#bootstrap()
\ 'readonly': "\u229D",
\ 'whitespace': "\u2632",
\ 'maxlinenr': "\u2630",
\ 'linenr': "\u33d1",
\ 'colnr': "\u2105",
\ 'linenr': " \u33d1:",
\ 'colnr': " \u2105:",
\ 'branch': "\u16A0",
\ 'notexists': "\u0246",
\ 'crypt': nr2char(0x1F512),
@ -125,9 +128,9 @@ function! airline#init#bootstrap()
call extend(g:airline_symbols, {
\ 'readonly': 'RO',
\ 'whitespace': '!',
\ 'linenr': 'ln',
\ 'linenr': ' ln:',
\ 'maxlinenr': '',
\ 'colnr': 'co',
\ 'colnr': ' cn:',
\ 'branch': '',
\ 'notexists': '?',
\ 'crypt': 'cr',
@ -155,13 +158,13 @@ function! airline#init#bootstrap()
endif
call airline#parts#define_raw('path', '%F%m')
call airline#parts#define('linenr', {
\ 'raw': '%{g:airline_symbols.linenr}:%l',
\ 'raw': '%{g:airline_symbols.linenr}%l',
\ 'accent': 'bold'})
call airline#parts#define('maxlinenr', {
\ 'raw': '/%L%{g:airline_symbols.maxlinenr} ',
\ 'raw': '/%L%{g:airline_symbols.maxlinenr}',
\ 'accent': 'bold'})
call airline#parts#define('colnr', {
\ 'raw': ' %{g:airline_symbols.colnr}:%v',
\ 'raw': '%{g:airline_symbols.colnr}%v',
\ 'accent': 'bold'})
call airline#parts#define_function('ffenc', 'airline#parts#ffenc')
call airline#parts#define('hunks', {
@ -233,9 +236,9 @@ function! airline#init#sections()
endif
if !exists('g:airline_section_z')
if airline#util#winwidth() > 79
let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%p%%'.spc, 'linenr', 'maxlinenr', 'colnr'])
let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%p%%', 'linenr', 'maxlinenr', 'colnr'])
else
let g:airline_section_z = airline#section#create(['%p%%'.spc, 'linenr', 'colnr'])
let g:airline_section_z = airline#section#create(['%p%%', 'linenr', 'colnr'])
endif
endif
if !exists('g:airline_section_error')

View File

@ -71,12 +71,14 @@ section meaning (example)~
optionally may contain Byte Order Mark `[BOM]` and missing end of last
line `[!EOL]`
Z current position in the file
percentage % ☰ current line/number of lines ln : column
So this: 10% ☰ 10/100 ln : 20 means: >
percentage % ln: current line/number of lines ☰ cn: column
So this: 10% ln:10/100☰ cn:20
means: >
10% - 10 percent
☰ 10 - current line 10
/100 ln - of 100 lines
: 20 - current column 20
ln: - line number is
10/100☰ - 10 of 100 total lines
cn: - column number is
20 - 20
<
[...] additional sections (warning/errors/statistics)
from external plugins (e.g. YCM/syntastic/...)
@ -343,6 +345,16 @@ CUSTOMIZATION *airline-customization*
The following are some unicode symbols for customizing the left/right
separators, as well as the powerline font glyphs.
Note: Some additional characters like spaces and colons may be included in the
default. Including them within the symbol definitions rather than outside of
them allows you to eliminate or otherwise alter them.
Note: Be aware that some of these glyphs are defined as ligatures, so they may
show up different (usually bigger) if followed by a space. This only happens
if both the font and terminal implementation used support ligatures. If you
want to follow a glyph with a space _without_ the alternate ligature being
rendered, follow it with a non-breaking-space character.
Note: You must define the dictionary first before setting values. Also, it's
a good idea to check whether it exists as to avoid accidentally overwriting
its contents. >
@ -355,12 +367,12 @@ its contents. >
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.colnr = '㏇'
let g:airline_symbols.colnr = '℅'
let g:airline_symbols.colnr = ' :'
let g:airline_symbols.colnr = ' :'
let g:airline_symbols.crypt = '🔒'
let g:airline_symbols.linenr = '☰'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = '␤'
let g:airline_symbols.linenr = ' :'
let g:airline_symbols.linenr = ' :'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.maxlinenr = '㏑'
@ -378,10 +390,10 @@ its contents. >
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.colnr = ''
let g:airline_symbols.colnr = ' :'
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.linenr = ' :'
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.dirty='⚡'
" old vim-powerline symbols