1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 23:00:04 +08:00

Fix: Add statements to check whether the character under the cursor is empty. (#3531)

This commit is contained in:
Lin Kun 2020-05-15 21:45:12 +08:00 committed by GitHub
parent 1c6b15619f
commit d00d81ad74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,7 +114,7 @@ function! SpaceVim#layers#edit#config() abort
\ 'change symbol style to under_score', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'U'], 'silent call call('
\ . string(s:_function('s:up_case')) . ', [])',
\ 'change symbol style to UP_CACE', 1)
\ 'change symbol style to UP_CASE', 1)
call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'k'], 'silent call call('
\ . string(s:_function('s:kebab_case')) . ', [])',
\ 'change symbol style to kebab-case', 1)
@ -307,6 +307,9 @@ endfunction
function! s:lowerCamelCase() abort
" fooFzz
if matchstr(getline('.'), '\%' . col('.') . 'c.') =~ '\s'
return
endif
let cword = s:parse_symbol(expand('<cword>'))
if !empty(cword)
let rst = [cword[0]]
@ -324,6 +327,9 @@ endfunction
function! s:UpperCamelCase() abort
" FooFzz
if strcharpart(getline('.')[col('.') - 1:], 0, 1) =~ '\s'
return
endif
let cword = s:parse_symbol(expand('<cword>'))
if !empty(cword)
let rst = map(cword, "substitute(v:val, '^.', '\\u&', 'g')")
@ -338,6 +344,9 @@ endfunction
function! s:kebab_case() abort
" foo-fzz
if matchstr(getline('.'), '\%' . col('.') . 'c.') =~ '\s'
return
endif
let cword = s:parse_symbol(expand('<cword>'))
if !empty(cword)
let save_register = @k
@ -364,6 +373,9 @@ endfunction
function! s:up_case() abort
" FOO_FZZ
if matchstr(getline('.'), '\%' . col('.') . 'c.') =~ '\s'
return
endif
let cword =map(s:parse_symbol(expand('<cword>')), 'toupper(v:val)')
if !empty(cword)
let save_register = @k