1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 10:20:05 +08:00

Fix toggle cursorline (#2171)

This commit is contained in:
Wang Shidong 2018-09-16 13:54:57 +08:00 committed by GitHub
parent 4c32447783
commit 0008a752ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 12 deletions

View File

@ -20,8 +20,8 @@ function! SpaceVim#autocmds#init() abort
autocmd WinEnter * call SpaceVim#plugins#windowsmanager#MarkBaseWin()
autocmd BufRead,BufNewFile *.pp setfiletype puppet
if g:spacevim_enable_cursorline == 1
autocmd BufEnter,WinEnter,InsertLeave * setl cursorline
autocmd BufLeave,WinLeave,InsertEnter * setl nocursorline
autocmd BufEnter,WinEnter,InsertLeave * call s:enable_cursorline()
autocmd BufLeave,WinLeave,InsertEnter * call s:disable_cursorline()
endif
if g:spacevim_enable_cursorcolumn == 1
autocmd BufEnter,WinEnter,InsertLeave * setl cursorcolumn
@ -64,6 +64,16 @@ function! SpaceVim#autocmds#init() abort
augroup END
endfunction
function! s:enable_cursorline() abort
if g:_spacevim_cursorline_flag == -1
setl cursorline
endif
endfunction
function! s:disable_cursorline() abort
setl nocursorline
endfunction
function! s:reload_touchpad_status() abort
if s:touchpadoff
call s:disable_touchpad()
@ -147,11 +157,11 @@ function! SpaceVim#autocmds#VimEnter() abort
endif
call SpaceVim#plugins#projectmanager#RootchandgeCallback()
if !empty(get(g:, '_spacevim_bootstrap_after', ''))
try
call call(g:_spacevim_bootstrap_after, [])
catch
call SpaceVim#logger#error('failed to call bootstrap_after function: ' . g:_spacevim_bootstrap_after)
endtry
try
call call(g:_spacevim_bootstrap_after, [])
catch
call SpaceVim#logger#error('failed to call bootstrap_after function: ' . g:_spacevim_bootstrap_after)
endtry
endif
endfunction

View File

@ -60,8 +60,13 @@ function! SpaceVim#layers#ui#config() abort
call SpaceVim#mapping#space#def('nnoremap', ['t', 'f'], 'call call('
\ . string(s:_function('s:toggle_colorcolumn')) . ', [])',
\ 'fill-column-indicator', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'h', 'h'], 'set cursorline!',
\ 'toggle highlight of the current line', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'h', 'h'], 'call call('
\ . string(s:_function('s:toggle_cursorline')) . ', [])',
\ ['toggle highlight of the current line',
\ [
\ 'SPC t h h is to toggle the highlighting of cursorline'
\ ]
\ ], 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'h', 'i'], 'call call('
\ . string(s:_function('s:toggle_indentline')) . ', [])',
\ ['toggle highlight indentation levels',
@ -213,6 +218,12 @@ function! s:toggle_win_fringe() abort
endif
endfunction
let g:_spacevim_cursorline_flag = -1
function! s:toggle_cursorline() abort
setl cursorline!
let g:_spacevim_cursorline_flag = g:_spacevim_cursorline_flag * -1
endfunction
function! s:toggle_spell_check() abort
if &l:spell
let &l:spell = 0

View File

@ -18,7 +18,7 @@ let g:ctrlp_custom_ignore = get(g:, 'ctrlp_custom_ignore', {
\ })
if executable('rg') && !exists('g:ctrlp_user_command')
let g:ctrlp_user_command = 'rg %s --no-ignore --hidden --files -g "" '
\ . join(zvim#util#Generate_ignore(g:spacevim_wildignore,'rg', 1))
\ . join(zvim#util#Generate_ignore(get(g:, 'spacevim_wildignore', ''),'rg', 1))
elseif executable('ag') && !exists('g:ctrlp_user_command')
let g:ctrlp_user_command = 'ag --hidden -i -g "" ' . join(zvim#util#Generate_ignore(g:spacevim_wildignore,'ag')) . ' %s'
endif

View File

@ -1,5 +1,7 @@
Execute ( SpaceVim colorscheme ):
let g:current_colors = g:colors_name
let g:current_colors = get(g:, 'colors_name', '')
colorscheme SpaceVim
AssertEqual g:colors_name, 'SpaceVim'
exe 'colorscheme ' . g:current_colors
if !empty(g:current_colors)
exe 'colorscheme ' . g:current_colors
endif

View File

@ -82,6 +82,7 @@ The next release is v0.9.0.
- Fix active statusline displaying fileformat info ([#2125](https://github.com/SpaceVim/SpaceVim/pull/2125))
- Fix unkown v:progpath ([#2169](https://github.com/SpaceVim/SpaceVim/pull/2169))
- Fix builtin statusline theme ([#2170](https://github.com/SpaceVim/SpaceVim/pull/2170))
- Fix toggle cursorline highlighting ([#2171](https://github.com/SpaceVim/SpaceVim/pull/2171))
### Removed