From d00d81ad74839c284d2ecf380f32012ea9a78ab0 Mon Sep 17 00:00:00 2001 From: Lin Kun Date: Fri, 15 May 2020 21:45:12 +0800 Subject: [PATCH] Fix: Add statements to check whether the character under the cursor is empty. (#3531) --- autoload/SpaceVim/layers/edit.vim | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim index a28320f84..d03073865 100644 --- a/autoload/SpaceVim/layers/edit.vim +++ b/autoload/SpaceVim/layers/edit.vim @@ -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('')) 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('')) 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('')) 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('')), 'toupper(v:val)') if !empty(cword) let save_register = @k