Merge branch 'symbols'

This commit is contained in:
Bailey Ling 2013-08-27 18:13:20 +00:00
commit 2c7e31801f
10 changed files with 64 additions and 85 deletions

View File

@ -15,7 +15,7 @@ Lean & mean statusline for vim that's light as air.
# Straightforward customization
If you don't like the defaults, you can replace all sections with standard `statusline` syntax.
If you don't like the defaults, you can replace all sections with standard `statusline` syntax. Give your statusline that you've built over the years a face lift.
![image](https://f.cloud.github.com/assets/306502/1009429/d69306da-0b38-11e3-94bf-7c6e3eef41e9.png)

View File

@ -195,18 +195,6 @@ function! airline#extensions#load()
endif
endif
if get(g:, 'airline#extensions#readonly#enabled', 1)
call airline#extensions#readonly#init()
endif
if (get(g:, 'airline#extensions#paste#enabled', 1) && get(g:, 'airline_detect_paste', 1))
call airline#extensions#paste#init()
endif
if get(g:, 'airline#extensions#iminsert#enabled', 0) || get(g:, 'airline_detect_iminsert', 0)
call airline#extensions#iminsert#init()
endif
" load all other extensions not part of the default distribution
for file in split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n")
" check to see that both the resolved and unresolved paths do not match

View File

@ -3,8 +3,7 @@
let s:empty_message = get(g:, 'airline#extensions#branch#empty_message',
\ get(g:, 'airline_branch_empty_message', ''))
let s:symbol = get(g:, 'airline#extensions#branch#symbol',
\ get(g:, 'airline_branch_prefix', get(g:, 'airline_powerline_fonts', 0) ? ' ' : ''))
let s:symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch)
let s:has_fugitive = exists('*fugitive#head')
let s:has_fugitive_detect = exists('*fugitive#detect')
@ -28,7 +27,7 @@ function! airline#extensions#branch#get_head()
endif
endif
return empty(head) ? s:empty_message : s:symbol.head
return empty(head) ? s:empty_message : s:symbol.' '.head
endfunction
function! airline#extensions#branch#init(ext)

View File

@ -1,14 +0,0 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
function! airline#extensions#iminsert#get_text()
if &iminsert
return toupper(get(b:, 'keymap_name', 'lang'))
endif
return ''
endfunction
function! airline#extensions#iminsert#init()
let g:airline_section_a .= ' '.g:airline_left_alt_sep.' %{airline#extensions#iminsert#get_text()}'
endfunction

View File

@ -1,14 +0,0 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
let s:symbol = get(g:, 'airline#extensions#paste#symbol',
\ get(g:, 'airline_paste_symbol', (get(g:, 'airline_powerline_fonts', 0) ? ' ' : '').'PASTE'))
function! airline#extensions#paste#get_mark()
return &paste ? ' ' . s:symbol : ''
endfunction
function! airline#extensions#paste#init()
let g:airline_section_a .= '%{airline#extensions#paste#get_mark()}'
endfunction

View File

@ -1,15 +0,0 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
let s:symbol = get(g:, 'airline#extensions#readonly#symbol',
\ get(g:, 'airline_readonly_symbol', get(g:, 'airline_powerline_fonts', 0) ? '' : 'RO'))
function! airline#extensions#readonly#get_mark()
return &ro ? s:symbol : ''
endfunction
function! airline#extensions#readonly#init()
let g:airline_section_gutter = ' %#airline_file#%{airline#extensions#readonly#get_mark()} '
\ .g:airline_section_gutter
endfunction

View File

@ -10,9 +10,7 @@ else
let s:show_message = get(g:, 'airline#extensions#whitespace#show_message', 1)
endif
let s:symbol = get(g:, 'airline#extensions#whitespace#symbol',
\ get(g:, 'airline_whitespace_symbol', get(g:, 'airline_powerline_fonts', 0) ? '✹' : '!'))
let s:symbol = get(g:, 'airline#extensions#whitespace#symbol', g:airline_symbols.whitespace)
let s:checks = get(g:, 'airline#extensions#whitespace#checks', ['indent', 'trailing'])
let s:trailing_format = get(g:, 'airline#extensions#whitespace#trailing_format', 'trailing[%s]')

View File

@ -0,0 +1,18 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
function! airline#parts#paste()
return g:airline_detect_paste && &paste ? ' '.g:airline_symbols.paste : ''
endfunction
function! airline#parts#iminsert()
if g:airline_detect_iminsert && &iminsert && exists('b:keymap_name')
return ' '.g:airline_left_alt_sep.' '.toupper(b:keymap_name)
endif
return ''
endfunction
function! airline#parts#readonly()
return &readonly ? g:airline_symbols.readonly : ''
endfunction

View File

@ -50,7 +50,7 @@ values):
let g:airline_detect_paste=1
<
* enable iminsert detection >
let g:airline_detect_iminsert=1
let g:airline_detect_iminsert=0
<
* determine whether inactive windows should have the left section collapsed to
only the filename of that buffer. >
@ -128,32 +128,32 @@ separators, as well as the powerline font glyths.
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_linecolumn_prefix = '␊ '
let g:airline_linecolumn_prefix = '␤ '
let g:airline_linecolumn_prefix = '¶ '
let g:airline#extensions#branch#symbol = '⎇ '
let g:airline#extensions#paste#symbol = 'ρ'
let g:airline#extensions#paste#symbol = 'Þ'
let g:airline#extensions#paste#symbol = '∥'
let g:airline#extensions#whitespace#symbol = 'Ξ'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = '␤'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
" powerline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline#extensions#branch#symbol = ' '
let g:airline#extensions#readonly#symbol = ''
let g:airline_linecolumn_prefix = ' '
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''
" old vim-powerline symbols
let g:airline_left_sep = '⮀'
let g:airline_left_alt_sep = '⮁'
let g:airline_right_sep = '⮂'
let g:airline_right_alt_sep = '⮃'
let g:airline#extensions#branch#symbol = '⭠'
let g:airline#extensions#readonly#symbol = '⭤'
let g:airline_linecolumn_prefix = '⭡'
let g:airline_symbols.branch = '⭠'
let g:airline_symbols.readonly = '⭤'
let g:airline_symbols.linenr = '⭡'
<
For more intricate customizations, you can replace the predefined sections

View File

@ -22,13 +22,31 @@ call s:check_defined('g:airline_right_sep', get(g:, 'airline_powerline_fonts', 0
call s:check_defined('g:airline_right_alt_sep', get(g:, 'airline_powerline_fonts', 0)?"":"<")
call s:check_defined('g:airline_detect_modified', 1)
call s:check_defined('g:airline_detect_paste', 1)
call s:check_defined('g:airline_linecolumn_prefix', get(g:, 'airline_powerline_fonts', 0)?' ':':')
call s:check_defined('g:airline_detect_iminsert', 0)
call s:check_defined('g:airline_inactive_collapse', 1)
call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus'])
call s:check_defined('g:airline_exclude_filetypes', [])
call s:check_defined('g:airline_exclude_preview', 0)
call s:check_defined('g:airline_mode_map', {
call s:check_defined('g:airline_symbols', {})
call extend(g:airline_symbols, {
\ 'paste': get(g:, 'airline_paste_symbol', g:airline_left_alt_sep.' PASTE'),
\ 'readonly': get(g:, 'airline_readonly_symbol', get(g:, 'airline_powerline_fonts', 0) ? '' : 'RO'),
\ 'whitespace': get(g:, 'airline_powerline_fonts', 0) ? '✹' : '!',
\ 'linenr': get(g:, 'airline_linecolumn_prefix', get(g:, 'airline_powerline_fonts', 0) ? '' : ':' ),
\ 'branch': get(g:, 'airline_branch_prefix', get(g:, 'airline_powerline_fonts', 0) ? '' : ''),
\ }, 'keep')
call s:check_defined('g:airline_parts', {})
call extend(g:airline_parts, {
\ 'mode': '%{get(w:,"airline_current_mode","")}',
\ 'iminsert': '%{airline#parts#iminsert()}',
\ 'paste': '%{airline#parts#paste()}',
\ 'readonly': '%#airline_file#%{airline#parts#readonly()}',
\ }, 'keep')
call s:check_defined('g:airline_mode_map', {})
call extend(g:airline_mode_map, {
\ '__' : '------',
\ 'n' : 'NORMAL',
\ 'i' : 'INSERT',
@ -40,22 +58,23 @@ call s:check_defined('g:airline_mode_map', {
\ 's' : 'SELECT',
\ 'S' : 'S-LINE',
\ '' : 'S-BLOCK',
\ })
\ }, 'keep')
call s:check_defined('g:airline_theme_map', {
call s:check_defined('g:airline_theme_map', {})
call extend(g:airline_theme_map, {
\ 'Tomorrow.*': 'tomorrow',
\ 'mo[l|n]okai': 'molokai',
\ 'wombat.*': 'wombat',
\ '.*solarized.*': 'solarized',
\ })
\ }, 'keep')
call s:check_defined('g:airline_section_a', '%{get(w:, "airline_current_mode", "")}')
call s:check_defined('g:airline_section_a', (g:airline_parts.mode).(g:airline_parts.paste).(g:airline_parts.iminsert))
call s:check_defined('g:airline_section_b', '')
call s:check_defined('g:airline_section_c', '%f%m')
call s:check_defined('g:airline_section_gutter', '%=')
call s:check_defined('g:airline_section_gutter', ' '.(g:airline_parts.readonly).'%=')
call s:check_defined('g:airline_section_x', "%{strlen(&filetype)>0?&filetype:''}")
call s:check_defined('g:airline_section_y', "%{strlen(&fenc)>0?&fenc:''}%{strlen(&ff)>0?'['.&ff.']':''}")
call s:check_defined('g:airline_section_z', '%3p%% '.g:airline_linecolumn_prefix.'%3l:%3c')
call s:check_defined('g:airline_section_z', '%3p%% %{g:airline_symbols.linenr} %3l:%3c')
call s:check_defined('g:airline_section_warning', '__')
let s:airline_initialized = 0