When using Vim to edit scripts such as Python, how can I embed a small shell below to facilitate observing the output results?
phpcn_u1582
phpcn_u1582 2017-05-16 16:37:03
0
10
662

[Problem Description]
I hope it won’t jump out of Vim
I hope it is: in normal-mode, press a certain key, and then there will be a small shell window below for easy observation of the output (just like IDE does That)
Sometimes just to test some ideas, frequently switching between Vim and Shell is not the answer

[Environment & Reproduction]
Ubuntu14-Vim7.4 (not compatible with Vi)

update
Solved
Don’t reinvent the wheel. The one you make yourself is not only bad, but also because you are not familiar with the syntax of vim script, it will end up being a crappy wheel

Please Google search 'vim quickrun'

phpcn_u1582
phpcn_u1582

reply all(10)
伊谢尔伦

Can be used:

  • neovim’s terminal

  • tmux + vim

  • vim + Conque-Shell

伊谢尔伦

Direct execution :!python a.py 可以啦!
另外非要映射快捷键的话,我使用了一个大神的vim配置,很完善,k-vim, 他里面就有一个运行按键设置::F10 就跟:!python a.pyThe effect is the same,

阿神

vim’s make will display the execution results below.
I am not particularly satisfied with the plug-in for executing shell in vim. So I later used tmux and vim, but some problems may occur, and it always feels bad in a system with a gui.
So now I use vim + tilda. There are many gadgets similar to tilda. You can search for them. I even forgot what they are called.

我想大声告诉你

You will definitely know how to split windows
! ! Execute the command line and write the results to the current buffer
Macros and key bindings

The combination of these is what you want

世界只因有你

@shomy’s method could be slightly improved:

:!python %

% refers to the current file, you need to save it before executing.

Peter_Zhu

Recommended to use https://github.com/klen/python-mode

Run python scripts directly, also supports virtualenv

  • Run python code (<leader>r)

给我你的怀抱

Use neovim, which has a terminal window.

漂亮男人

This is mine:

function Result_of_run(run_sign)
    "!ls这样运行, 显示的结果会切换到shell界面
    echo system(a:run_sign . shellescape(expand('%')))
endfunction

autocmd BufNewFile,BufRead *.py nnoremap <buffer> <F2> :up<CR>:call Result_of_run("python ")<CR>
漂亮男人

You can use neovim, built-in terminal, you can refer to my configuration (compatible with vim)

https://github.com/wsdjeg/DotFiles

仅有的幸福

nnoremap <leader>r :!%:p<CR>

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template