forked from python-mode/python-mode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.vim
More file actions
30 lines (23 loc) · 845 Bytes
/
run.vim
File metadata and controls
30 lines (23 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
" DESC: Set scriptname
let g:scriptname = expand("<sfile>:t")
" OPTION: g:pymode_doc -- bool. Show documentation enabled
call helpers#SafeVar("g:pymode_run", 1)
" OPTION: g:pymode_doc_key -- string. Key for show python documantation.
call helpers#SafeVar("g:pymode_run_key", "<leader>r")
" DESC: Disable script loading
if helpers#SafeVar("b:run", 1) || g:pymode_run == 0
finish
endif
" DESC: Check python
if !helpers#CheckProgramm("python")
finish
endif
" DESC: Save file if it modified and run python code
fun! <SID>:RunPython() "{{{
if &modifiable && &modified | write | endif
call helpers#ShowPreviewCmd(g:python . " " . expand("%:p"))
endfunction "}}}
" DESC: Set commands
command! -buffer Pyrun call <SID>:RunPython()
" DESC: Set keys
exe "nnoremap <silent> <buffer> " g:pymode_run_key ":call <SID>:RunPython()<CR>"