From f2dae6b3c0414cb3321ffc5d654e9e0cc03cfe29 Mon Sep 17 00:00:00 2001 From: Konfekt Date: Fri, 24 Apr 2020 13:04:13 +0200 Subject: [PATCH] use SAGE's help() function to look up doc. Ideally, would use SAGE's ?, but I do not know how to call it from the command line instead of SAGE's REPL --- ftplugin/sage.vim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ftplugin/sage.vim b/ftplugin/sage.vim index 36938e5..9f39266 100644 --- a/ftplugin/sage.vim +++ b/ftplugin/sage.vim @@ -10,4 +10,20 @@ compiler sage let b:undo_ftplugin = 'setlocal tabstop< shiftwidth< expandtab<' let b:undo_ftplugin .= '| setlocal makeprg< errorformat<' + +if executable('sage') + if !has('gui_running') + command! -buffer -nargs=1 SageHelp + \ silent exe '!' . 'sage -c ''help()''' | + \ redraw! + elseif has('terminal') + command! -buffer -nargs=1 SageHelp + \ silent exe 'term ' . 'sage -c ''help()''' + else + command! -buffer -nargs=1 SageHelp echo system('sage -c '''' 2>/dev/null') + endif + setlocal keywordprg=:SageHelp + let b:undo_ftplugin .= '| setlocal keywordprg<' +endif + let b:did_ftplugin = 1