Shell | Use bash in tools such as VS Code

Preface

I believe that many Gitfriends who have used it need to be used in a certain directory in many cases Git Bash Here, but to do so requires an additional position in the taskbar, and in many cases, we are in the process of writing code. in the current project directory use Bashthis article on how to appeal in terms of VS Code, IDEAconfiguration choices terminal of the two development tools.

note

This article assumes that your friends have been installed Git, and my Bashpath is D:\\Git\\bin\\bash.exe.

VS CodeConfiguration terminal selection

First, we need to download a Shell launcherplug-in named , and then settings.jsonadd the following content in the configuration (according to your needs, you can switch to use multiple terminals):

"shellLauncher.shells.windows": [
    {
    
    
        "shell": "C:\\WINDOWS\\System32\\cmd.exe",
        "label": "cmd"
    },
    {
    
    
        "shell": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
        "label": "PowerShell"
    },
    {
    
    
        "shell": "D:\\Git\\bin\\bash.exe",
        "label": "Git bash"
    }
]

Then select 首选项 -> 键盘快捷映射, the following interface will appear:

image-20200907145333102

Then enter the location shown in the figure below shellLauncher.launchto filter:

image-20200907145514533

Then press the shortcut key setting of the plug-in as shown in the figure:

image-20200907145806368

After completing the above configuration, press the shortcut key (mine is Alt + T), and the terminal selection shown in the figure below will appear:

image-20200907145954022

To use the Bashterminal, click on the third option. The final effect is as follows:

image-20200907150109890

IDEAMedium placementBash

First open File -> Settings -> Tools -> Terminal, the following interface will appear:

image-20200907144001547

Then follow the prompts in the figure above and Shell pathmodify it to your own Bashpath. After modification, click Applyand close the window, open the terminal again, and you can use the Bashterminal, as shown below~

image-20200907144528328

to sum up

This article describes how VS Code, IDEAin the configuration using the Bashterminal, if wrong, welcomed the exchange correction.

Guess you like

Origin blog.csdn.net/qq_41698074/article/details/108448322