From edd3439e65d0890f2f3208e4973880496f76948a Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 14 Jul 2017 04:14:58 +0800 Subject: [PATCH] Fix SPC c t --- autoload/SpaceVim/mapping/space.vim | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/autoload/SpaceVim/mapping/space.vim b/autoload/SpaceVim/mapping/space.vim index af323b11d..febb9b889 100644 --- a/autoload/SpaceVim/mapping/space.vim +++ b/autoload/SpaceVim/mapping/space.vim @@ -79,8 +79,8 @@ function! SpaceVim#mapping#space#init() abort call SpaceVim#mapping#space#def('nmap', ['c', 'p'], 'vipNERDCommenterComment', 'comment paragraphs', 0, 1) call SpaceVim#mapping#space#def('nmap', ['c', 'P'], 'vipNERDCommenterInvert', 'toggle comment paragraphs', 0, 1) - nnoremap CommentToLine :comment_to_line(0) - nnoremap CommentToLineInvert :comment_to_line(1) + nnoremap CommentToLine :call comment_to_line(0) + nnoremap CommentToLineInvert :call comment_to_line(1) call SpaceVim#mapping#space#def('nmap', ['c', 't'], 'CommentToLine', 'comment to line', 0, 1) call SpaceVim#mapping#space#def('nmap', ['c', 'T'], 'CommentToLineInvert', 'toggle comment to line', 0, 1) @@ -336,13 +336,17 @@ function! s:commentOperator(type, ...) endfunction function! s:comment_to_line(invert) abort - let line = str2nr(input('line number :')) + let input = input('line number :') + if empty(input) + return + endif + let line = str2nr(input) let ex = line - line('.') if ex > 0 exe 'normal! V'. ex .'j' elseif ex == 0 else - exe 'normal! V'. ex .'k' + exe 'normal! V'. abs(ex) .'k' endif if a:invert call feedkeys("\NERDCommenterInvert")