1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 10:50:05 +08:00

Fix cursor indicator

This commit is contained in:
wsdjeg 2018-03-25 20:13:07 +08:00
parent c0ea6fa673
commit 0b43283e53
3 changed files with 23 additions and 11 deletions

View File

@ -27,6 +27,7 @@ function! SpaceVim#autocmds#init() abort
autocmd BufEnter,WinEnter,InsertLeave * setl cursorcolumn
autocmd BufLeave,WinLeave,InsertEnter * setl nocursorcolumn
endif
autocmd WinLeave * call SpaceVim#layers#core#statusline#remove_section('search status')
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |

View File

@ -654,5 +654,19 @@ function! SpaceVim#layers#core#statusline#register_sections(name, func)
endfunction
function! SpaceVim#layers#core#statusline#check_section(name) abort
return (index(s:loaded_sections_l, a:name) != -1
\ || index(s:loaded_sections_r, a:name) != -1)
endfunction
function! SpaceVim#layers#core#statusline#remove_section(name) abort
if index(s:loaded_sections_l, a:name) != -1
call remove(s:loaded_sections_l, index(s:loaded_sections_l, a:name))
endif
if index(s:loaded_sections_r, a:name) != -1
call remove(s:loaded_sections_r, index(s:loaded_sections_l, a:name))
endif
let &l:statusline = SpaceVim#layers#core#statusline#get(1)
endfunction
" vim:set et sw=2 cc=80 nowrap:

View File

@ -86,26 +86,23 @@ endfunction
let s:si_flag = 0
function! s:update_search_index(key) abort
if a:key == 'd'
if mapcheck("<Plug>(incsearch-nohl-n)") !=# ''
if a:key ==# 'd'
if mapcheck('<Plug>(incsearch-nohl-n)') !=# ''
call feedkeys("\<Plug>(incsearch-nohl-n)")
else
normal! n
endif
normal! ml
elseif a:key == 'r'
if mapcheck("<Plug>(incsearch-nohl-N)") !=# ''
elseif a:key ==# 'r'
if mapcheck('<Plug>(incsearch-nohl-N)') !=# ''
call feedkeys("\<Plug>(incsearch-nohl-N)")
else
normal! N
endif
normal! ml
endif
if s:si_flag == 0
call SpaceVim#layers#core#statusline#toggle_section('search status')
let s:si_flag = 1
else
let &l:statusline = SpaceVim#layers#core#statusline#get(1)
normal! ml
if !SpaceVim#layers#core#statusline#check_section('search status')
call SpaceVim#layers#core#statusline#toggle_section('search status')
endif
let &l:statusline = SpaceVim#layers#core#statusline#get(1)
normal! `l
endfunction