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