mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 12:50:04 +08:00
pref(options)!: rename statusline options
change spacevim_statusline_left_sections = spacevim_statusline_left change spacevim_statusline_right_sections = spacevim_statusline_right BREAKING CHANGE: rename the statusline sections option
This commit is contained in:
parent
43f9e530f1
commit
b244af6e08
@ -582,11 +582,12 @@ let g:spacevim_enable_statusline_tag = 1
|
||||
" 'version control info'
|
||||
" ]
|
||||
" <
|
||||
" `statusline_left_sections` is deprecated, use `statusline_left` instead.
|
||||
|
||||
""
|
||||
" Define the left section of statusline in active windows. By default:
|
||||
" >
|
||||
" let g:spacevim_statusline_left_sections =
|
||||
" let g:spacevim_statusline_left =
|
||||
" \ [
|
||||
" \ 'winnr',
|
||||
" \ 'filename',
|
||||
@ -595,7 +596,9 @@ let g:spacevim_enable_statusline_tag = 1
|
||||
" \ 'version control info'
|
||||
" \ ]
|
||||
" <
|
||||
let g:spacevim_statusline_left_sections = ['winnr', 'filename', 'major mode',
|
||||
" `g:spacevim_statusline_left_sections` is deprecated,
|
||||
" use `g:spacevim_statusline_left` instead.
|
||||
let g:spacevim_statusline_left = ['winnr', 'filename', 'major mode',
|
||||
\ 'search count',
|
||||
\ 'syntax checking', 'minor mode lighters',
|
||||
\ ]
|
||||
@ -616,18 +619,23 @@ let g:spacevim_statusline_left_sections = ['winnr', 'filename', 'major mode',
|
||||
" - cursorpos: the corsur position
|
||||
" - percentage: the percent of current page
|
||||
" - totallines: the total lines of current buffer
|
||||
"
|
||||
" `statusline_right_sections` is deprecated, use `statusline_right` instead.
|
||||
|
||||
""
|
||||
" Define the right section of statusline in active windows. By default:
|
||||
" >
|
||||
" g:spacevim_statusline_right_sections =
|
||||
" g:spacevim_statusline_right =
|
||||
" \ [
|
||||
" \ 'fileformat',
|
||||
" \ 'cursorpos',
|
||||
" \ 'percentage'
|
||||
" \ ]
|
||||
" <
|
||||
let g:spacevim_statusline_right_sections = ['fileformat', 'cursorpos', 'percentage']
|
||||
"
|
||||
" `g:spacevim_statusline_right_sections` is deprecated,
|
||||
" use `g:spacevim_statusline_right` instead.
|
||||
let g:spacevim_statusline_right = ['fileformat', 'cursorpos', 'percentage']
|
||||
|
||||
""
|
||||
" @section statusline_unicode, options-statusline_unicode
|
||||
|
@ -46,8 +46,8 @@ function! SpaceVim#layers#VersionControl#config() abort
|
||||
\ 'vcs-transient-state', 1)
|
||||
call SpaceVim#layers#core#statusline#register_sections('vcs', s:_function('s:git_branch'))
|
||||
call SpaceVim#layers#core#statusline#register_sections('hunks', s:_function('s:hunks'))
|
||||
call add(g:spacevim_statusline_left_sections, 'vcs')
|
||||
call add(g:spacevim_statusline_left_sections, 'hunks')
|
||||
call add(g:spacevim_statusline_left, 'vcs')
|
||||
call add(g:spacevim_statusline_left, 'hunks')
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'v'], 'call SpaceVim#layers#core#statusline#toggle_section("vcs")',
|
||||
\ 'toggle-vcs-info', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'h'], 'call SpaceVim#layers#core#statusline#toggle_section("hunks")',
|
||||
|
@ -107,7 +107,7 @@ endif
|
||||
if &cc ==# '80'
|
||||
call add(s:loaded_modes, 'fill-column-indicator')
|
||||
endif
|
||||
if index(g:spacevim_statusline_right_sections, 'whitespace') != -1
|
||||
if index(g:spacevim_statusline_right, 'whitespace') != -1
|
||||
call add(s:loaded_modes, 'whitespace')
|
||||
endif
|
||||
" build in sections for SpaceVim statusline
|
||||
@ -492,7 +492,7 @@ function! SpaceVim#layers#core#statusline#get(...) abort
|
||||
endtry
|
||||
let st = '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep
|
||||
\ . '%#SpaceVim_statusline_b# startify %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep . ' '
|
||||
if index(g:spacevim_statusline_left_sections, 'vcs') != -1
|
||||
if index(g:spacevim_statusline_left, 'vcs') != -1
|
||||
let st .= '%#SpaceVim_statusline_c#' . call(s:registed_sections['vcs'], [])
|
||||
\ . '%#SpaceVim_statusline_c_SpaceVim_statusline_z#' . s:lsep
|
||||
endif
|
||||
@ -589,13 +589,13 @@ endfunction
|
||||
|
||||
function! s:active() abort
|
||||
let lsec = []
|
||||
for section in g:spacevim_statusline_left_sections
|
||||
for section in g:spacevim_statusline_left
|
||||
if has_key(s:registed_sections, section)
|
||||
call add(lsec, call(s:registed_sections[section], []))
|
||||
endif
|
||||
endfor
|
||||
let rsec = []
|
||||
for section in g:spacevim_statusline_right_sections
|
||||
for section in g:spacevim_statusline_right
|
||||
if has_key(s:registed_sections, section)
|
||||
call add(rsec, call(s:registed_sections[section], []))
|
||||
endif
|
||||
@ -719,25 +719,25 @@ let s:section_old_pos = {
|
||||
\ }
|
||||
|
||||
function! SpaceVim#layers#core#statusline#toggle_section(name) abort
|
||||
if index(g:spacevim_statusline_left_sections, a:name) == -1
|
||||
\ && index(g:spacevim_statusline_right_sections, a:name) == -1
|
||||
if index(g:spacevim_statusline_left, a:name) == -1
|
||||
\ && index(g:spacevim_statusline_right, a:name) == -1
|
||||
\ && !has_key(s:section_old_pos, a:name)
|
||||
if a:name ==# 'search status'
|
||||
call insert(g:spacevim_statusline_left_sections, a:name, 2)
|
||||
call insert(g:spacevim_statusline_left, a:name, 2)
|
||||
else
|
||||
call add(g:spacevim_statusline_right_sections, a:name)
|
||||
call add(g:spacevim_statusline_right, a:name)
|
||||
endif
|
||||
elseif index(g:spacevim_statusline_right_sections, a:name) != -1
|
||||
let s:section_old_pos[a:name] = ['r', index(g:spacevim_statusline_right_sections, a:name)]
|
||||
call remove(g:spacevim_statusline_right_sections, index(g:spacevim_statusline_right_sections, a:name))
|
||||
elseif index(g:spacevim_statusline_left_sections, a:name) != -1
|
||||
let s:section_old_pos[a:name] = ['l', index(g:spacevim_statusline_left_sections, a:name)]
|
||||
call remove(g:spacevim_statusline_left_sections, index(g:spacevim_statusline_left_sections, a:name))
|
||||
elseif index(g:spacevim_statusline_right, a:name) != -1
|
||||
let s:section_old_pos[a:name] = ['r', index(g:spacevim_statusline_right, a:name)]
|
||||
call remove(g:spacevim_statusline_right, index(g:spacevim_statusline_right, a:name))
|
||||
elseif index(g:spacevim_statusline_left, a:name) != -1
|
||||
let s:section_old_pos[a:name] = ['l', index(g:spacevim_statusline_left, a:name)]
|
||||
call remove(g:spacevim_statusline_left, index(g:spacevim_statusline_left, a:name))
|
||||
elseif has_key(s:section_old_pos, a:name)
|
||||
if s:section_old_pos[a:name][0] ==# 'r'
|
||||
call insert(g:spacevim_statusline_right_sections, a:name, s:section_old_pos[a:name][1])
|
||||
call insert(g:spacevim_statusline_right, a:name, s:section_old_pos[a:name][1])
|
||||
else
|
||||
call insert(g:spacevim_statusline_left_sections, a:name, s:section_old_pos[a:name][1])
|
||||
call insert(g:spacevim_statusline_left, a:name, s:section_old_pos[a:name][1])
|
||||
endif
|
||||
endif
|
||||
let &l:statusline = SpaceVim#layers#core#statusline#get(1)
|
||||
@ -969,16 +969,16 @@ function! SpaceVim#layers#core#statusline#register_sections(name, func) abort
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#check_section(name) abort
|
||||
return (index(g:spacevim_statusline_left_sections, a:name) != -1
|
||||
\ || index(g:spacevim_statusline_right_sections, a:name) != -1)
|
||||
return (index(g:spacevim_statusline_left, a:name) != -1
|
||||
\ || index(g:spacevim_statusline_right, a:name) != -1)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#remove_section(name) abort
|
||||
if index(g:spacevim_statusline_left_sections, a:name) != -1
|
||||
call remove(g:spacevim_statusline_left_sections, index(g:spacevim_statusline_left_sections, a:name))
|
||||
if index(g:spacevim_statusline_left, a:name) != -1
|
||||
call remove(g:spacevim_statusline_left, index(g:spacevim_statusline_left, a:name))
|
||||
endif
|
||||
if index(g:spacevim_statusline_right_sections, a:name) != -1
|
||||
call remove(g:spacevim_statusline_right_sections, index(g:spacevim_statusline_left_sections, a:name))
|
||||
if index(g:spacevim_statusline_right, a:name) != -1
|
||||
call remove(g:spacevim_statusline_right, index(g:spacevim_statusline_left, a:name))
|
||||
endif
|
||||
let &l:statusline = SpaceVim#layers#core#statusline#get(1)
|
||||
endfunction
|
||||
|
@ -774,6 +774,7 @@ Define the left section of statusline in active windows. By default:
|
||||
'version control info'
|
||||
]
|
||||
<
|
||||
`statusline_left_sections` is deprecated, use `statusline_left` instead.
|
||||
|
||||
==============================================================================
|
||||
STATUSLINE_RIGHT_SECTIONS *SpaceVim-options-statusline_right_sections*
|
||||
@ -793,6 +794,8 @@ cursorpos: the corsur position
|
||||
percentage: the percent of current page
|
||||
totallines: the total lines of current buffer
|
||||
|
||||
`statusline_right_sections` is deprecated, use `statusline_right` instead.
|
||||
|
||||
==============================================================================
|
||||
STATUSLINE_SEPARATOR *SpaceVim-options-statusline_separator*
|
||||
|
||||
@ -1127,10 +1130,10 @@ default, to enable this feature:
|
||||
*g:spacevim_enable_statusline_tag*
|
||||
Enable/Disable showing current tag on statusline
|
||||
|
||||
*g:spacevim_statusline_left_sections*
|
||||
*g:spacevim_statusline_left*
|
||||
Define the left section of statusline in active windows. By default:
|
||||
>
|
||||
let g:spacevim_statusline_left_sections =
|
||||
let g:spacevim_statusline_left =
|
||||
\ [
|
||||
\ 'winnr',
|
||||
\ 'filename',
|
||||
@ -1139,11 +1142,13 @@ Define the left section of statusline in active windows. By default:
|
||||
\ 'version control info'
|
||||
\ ]
|
||||
<
|
||||
`g:spacevim_statusline_left_sections` is deprecated, use
|
||||
`g:spacevim_statusline_left` instead.
|
||||
|
||||
*g:spacevim_statusline_right_sections*
|
||||
*g:spacevim_statusline_right*
|
||||
Define the right section of statusline in active windows. By default:
|
||||
>
|
||||
g:spacevim_statusline_right_sections =
|
||||
g:spacevim_statusline_right =
|
||||
\ [
|
||||
\ 'fileformat',
|
||||
\ 'cursorpos',
|
||||
@ -1151,6 +1156,9 @@ Define the right section of statusline in active windows. By default:
|
||||
\ ]
|
||||
<
|
||||
|
||||
`g:spacevim_statusline_right_sections` is deprecated, use
|
||||
`g:spacevim_statusline_right` instead.
|
||||
|
||||
*g:spacevim_statusline_unicode*
|
||||
Enable/Disable unicode symbols in statusline, includes the mode icons and
|
||||
fileformat icons. This option is enabled by default, to disable it:
|
||||
|
Loading…
Reference in New Issue
Block a user