1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 14:00:06 +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 BufEnter,WinEnter,InsertLeave * setl cursorcolumn
autocmd BufLeave,WinLeave,InsertEnter * setl nocursorcolumn autocmd BufLeave,WinLeave,InsertEnter * setl nocursorcolumn
endif endif
autocmd WinLeave * call SpaceVim#layers#core#statusline#remove_section('search status')
autocmd BufReadPost * autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") | \ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" | \ exe "normal! g`\"" |

View File

@ -654,5 +654,19 @@ function! SpaceVim#layers#core#statusline#register_sections(name, func)
endfunction 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: " vim:set et sw=2 cc=80 nowrap:

View File

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