[Help] Some questions about Vim Shell configuration in Vim
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-16 16:36:51
0
1
552

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

The shortcut keys sometimes fail when terminating the terminal running

As mentioned in the reference document, is a shortcut key to terminate a running script. This shortcut key will trigger a function, which will send an interrupt request. However, it seems that this shortcut key is only effective in two situations:

  • When Vim Shell is waiting for user input, the effect of pressing is equivalent to pressing Enter, and Vim Shell will create a new line;

  • When using the time built-in command. For example, entertime python test.pyin Vim Shell, and press while waiting, the script will end immediately;
    However, it will have no effect in other situations. For example, when enteringexe python test.pyin Vim Shell, or when enteringVimShellInteractive python test.pyin Vim Command, this shortcut key is useless. why is that?

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

The problem is simple, but I can't solve it. Now, I can enterVimShellInteractive python test.pyin 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

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all (1)
小葫芦

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

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

5/24/2016


shebang refers to the first line of the script file

#!/bin/bash

Content like this, such as my first screenshot#!/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.pyQuickRun is perfectly compatible with the shebang
For code like the first screenshot, QuickRun will try to run/usr/bin/env python /path/to/file.py

However, Windows does not have env and will not accept the objection. Slash path separator


Of course, there is no concept of shebang in Windows itself#!shebang
PS: 你可以在Windows 下看看PythonScripts目录下的*.py, 这些文件都有加入#!shebangIn short, there is no need to add#!shebangwhen writing scripts under Windows

PS: You can look at the PythonScriptsdirectory under Windows *.py, these files have been added #!shebang

5/24/2016
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!