Original title link: Reposted from Craftsmanship Community CodingStyle
I finally installed Vim Shell on my own Vim, but now I still encounter some configuration problems. I came here specifically to ask for advice, thank you in advance!
Please refer to the document: vimshell.txt on Github
As mentioned in the reference document,
When Vim Shell is waiting for user input, the effect of pressing
When using the time built-in command. For example, entertime python test.py
in Vim Shell, and press
However, it will have no effect in other situations. For example, when enteringexe python test.py
in Vim Shell, or when enteringVimShellInteractive python test.py
in Vim Command, this shortcut key is useless. why is that?
The problem is simple, but I can't solve it. Now, I can enterVimShellInteractive python test.py
in Vim Command to execute the test.py script I am editing. But if I want to implement theshortcut key for running a python scriptwith one click, how should I configure vimrc? The main question is, how can I pass the full path and filename of the file I'm editing to VimShell.
Thanks!
Weiming 20/5/2016
Second question:
The answer is in line 47 of the window below
Supplement: You can try this https://github.com/thinca/vim-quickrun
It can automatically identify your file type and call the corresponding interpreter,
The premise is not to write #!shebang under Windows
5/22 /2016
QuickRun supplementary picture
Well, I just tried it, js can also run quickly, Java can automatically javac Class.java and then java Class
You don’t need to write the file name yourself, other file types can also be defined by yourself
I changed a little bit of settings myself
5/24/2016
shebang refers to the first line of the script file
Content like this, such as my first screenshot
However, Windows does not have env and will not accept the objection. Slash path separator#!/usr/bin/env python
, under Linux the shell will call this program and take the script file as the first parameter.#!/usr/bin/env python
,在Linux 下 shell 会调用这个程序,并将脚本文件作为第一个参数。QuickRun 完美兼容 shebang
第一张截图那样的代码,QuickRun 会尝试运行
/usr/bin/env python /path/to/file.py
QuickRun is perfectly compatible with the shebangFor code like the first screenshot, QuickRun will try to run
/usr/bin/env python /path/to/file.py
PS: You can look at theOf course, there is no concept of shebang in Windows itself
#!shebang
PS: 你可以在Windows 下看看
PythonScripts
目录下的*.py
, 这些文件都有加入#!shebang
In short, there is no need to add#!shebang
when writing scripts under WindowsPythonScripts
directory under Windows*.py
, these files have been added#!shebang
5/24/2016