search

Home  >  Q&A  >  body text

[Help] Some questions about Vim Shell configuration in Vim

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, <C-c> 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:

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 enter VimShellInteractive python test.py in Vim Command to execute the test.py script I am editing. But if I want to implement the shortcut key for running a python script with 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

曾经蜡笔没有小新曾经蜡笔没有小新2774 days ago623

reply all(1)I'll reply

  • 高洛峰

    高洛峰2017-05-16 16:38:51

    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 <Leader>q :QuickRun<CR>

    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 #!shebang when writing scripts under Windows

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

    5/24/2016🎜

    reply
    0
  • Cancelreply