Skip to content

Commit

Permalink
use compiler to switch to sage (instead of pyton, say, by :comp python)
Browse files Browse the repository at this point in the history
  • Loading branch information
Konfekt committed Apr 24, 2020
1 parent 9919cfe commit 09d565f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
18 changes: 18 additions & 0 deletions compiler/sage.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
if exists("current_compiler") | finish | endif
let current_compiler = "sage"

if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif

let s:cpo_save = &cpo
set cpo&vim

setlocal makeprg=sage\ -b\ &&\ sage\ -t\ %:S
setlocal errorformat<

silent CompilerSet makeprg
silent CompilerSet errorformat

let &cpo = s:cpo_save
unlet s:cpo_save
6 changes: 4 additions & 2 deletions ftplugin/sage.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ if version > 600
endif

" Sage settings (from Franco Saliola)
autocmd Filetype sage set tabstop=2|set shiftwidth=2|set expandtab
autocmd FileType sage set makeprg=sage\ -b\ &&\ sage\ -t\ %
setlocal tabstop=2 shiftwidth=2 expandtab
compiler sage

let b:undo_ftplugin = 'setlocal tabstop< shiftwidth< expandtab<'
let b:undo_ftplugin .= '| setlocal makeprg< errorformat<'
let b:did_ftplugin = 1

0 comments on commit 09d565f

Please sign in to comment.