[Help] Some Questions about Vim Shell Configuration in Vim

  question, vim

Link to original topic:From CodingStyle, Artisan Community

It was very difficult to install Vim shell on your own VIM, but now you still encounter some configuration problems. I’ve come here specially to ask you, thank you first!

Reference documents:vimshell.txt on Github

Shortcut keys sometimes fail when terminating terminal operation.

As mentioned in the reference document, < C-c > is the shortcut key to terminate the running script. this shortcut key will trigger a function that will send an interrupt request. However, it seems that this shortcut is only valid in two cases:

  • When Vim Shell is waiting for user input, pressing < C-c > is equivalent to entering a car, and Vim Shell will create a new line.

  • When using the time built-in command. For example, enter in Vim Shelltime python test.pyPress < C-c > while waiting, and the script ends immediately;
    However, it does not work in other situations, such as typing in the Vim Shell.exe python test.py, or enter in vimmandVimShellInteractive python test.pyThis shortcut is useless. Why is this?

How to send the path and full name of the text being edited to Vim Shell

The problem is very simple, but I can’t solve it. Now, I can type in vimmandVimShellInteractive python test.pyPy script that I am editing. But if I want to achieve itRun python Script at One ButtonHow should I configure vimrc? The main problem is how can I send the full path and file name of the file I am editing to VimShell.

Thank you!
Weiming 20/5/2016

Second question:
图片描述
There is an answer on line 47 of the window below.


Add: You can try thishttps://github.com/thinca/vim-quickrun
You can automatically identify your file type and call the corresponding interpreter.
The premise is not to write #! shebang
5/22/2016


QuickRun complement
图片描述

Well, just tried, js can also run Q quickly, Java can automatically Javac Class.java and then java Class
Do not need to write their own file names, other file types can also be defined by themselves

I changed the settings a little bit myself.

let g:quickrun_config = {}
 let g:quickrun_config._ = {
 \ 'outputter/buffer/split': ''
 \ }
 
 autocmd FileType quickrun resize 10
 map <Leader>q :QuickRun<CR>

5/24/2016


Shebang refers to the first line of the script file.

#!  /bin/bash

This kind of content, such as my first screenshot#! /usr/bin/env pythonUnder Linux, the shell calls this program and takes the script file as the first parameter.
QuickRun is perfectly compatible with shebang.
QuickRun will try to run code like the first screenshot./usr/bin/env python /path/to/file.py
However, Windows does not have env and does not recognize the backslash path delimiter

Of course, the concept of shebang does not exist in Windows itself.
In short, scripts written under Windows do not need to be added#! shebang
PS: You can look under WindowsPython\Scripts\Under the directory*.py, these documents have been added#! shebang

5/24/2016