How To Output All The Lines Into Python Console In Vim?
I have set F2 prompt key with map :w:! D:\Python34\python %,when i open an python file in vim and press F2,the python file will be executed .For a si
Solution 1:
Avoid blocking
To make the call asynchonous (to avoid that GVIM is blocked during the Python session), use the Windows-specific :!start
command:
nnoremap <f2> :w<cr>:!start D:\Python34\python -i %<cr>
List teh codez
I don't know whether it is possible to list the passed source code from the interactive Python debugger. But you can print the file contents before starting it:
nnoremap <f2> :w<cr>:!start cmd /c type % && D:\Python34\python -i %<cr>
Additional tips
- You should use
:noremap
; it makes the mapping immune to remapping and recursion. - As your mapping only works correctly from normal mode, use
:nnoremap
(or extend it to support visual-mode selections, too).
Solution 2:
Maybe Vim plugin Conque will solve your problem:
- Installation instrucions are here https://code.google.com/p/conque/
- To use just type
:ConqueTermVSplit python -i test.py
(VSplit is for vertical split - you may use horizontal) - There is no blocking of your window with python code - you may escape interactive mode and switch to your window with Ctrl+W twice
Post a Comment for "How To Output All The Lines Into Python Console In Vim?"