add new shortcut <localleader>tt => ToggleRspecTest(), which toggles now: true of a spec test

This commit is contained in:
hophacker 2019-07-14 14:52:01 +08:00
parent f6402e096a
commit 5f2532e1e3

View File

@ -304,5 +304,15 @@ function! TogglePaste()
endif endif
endfunction endfunction
function! ToggleRspecTest()
let l:line=getline('.')
if l:line =~? ',\s*now:\s.*true'
call setline('.', substitute(l:line, "\,\\s*now:\\s*true", "", ""))
else
call setline('.', substitute(l:line, "\\(['\"]\\)\\s*do", "\\1, now: true do", ""))
endif
endfunction
" set paste " set paste
nnoremap <localleader>p :call TogglePaste()<cr> nnoremap <localleader>tp :call TogglePaste()<cr>
nnoremap <localleader>tt :call ToggleRspecTest()<cr>