Just adopted it!

Thanks Marc

PS: what about adding it somewhere to the developer guide?

Le 08/03/2020 à 19:57, Marc Mezzarobba a écrit :
Just in case it may be useful to somebody else, here is a vim config
snippet for copy-pasting examples and doctests to the sage repl.
(Improvements welcome!)

function! YankSageTest(type, ...)
     if a:0
         let lines = getline("'<", "'>")
     else
         let lines = getline("'[", "']")
     endif
     let pattern =  '^\s*\(sage\|\.\.\.\.\): '
     call filter(lines, {i, l -> l =~ pattern})
     call map(lines, {i, l -> substitute(l, pattern, "", "")})
     call setreg(v:register, join(lines, "\n"), "l")
endfunction
nnoremap <localleader>Y :set opfunc=YankSageTest<CR>g@
vnoremap <localleader>Y :<C-U>call YankSageTest(visualmode(), 1)<CR


--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/95eefe46-5b54-3d8b-6b55-d9503b5c3626%40gmail.com.

Reply via email to