Build programming environment git + vscode under Windows

Time:2020-9-29

Linux terminal bash, win10 terminal is the power shell or command prompt, the two terminal languages are quite different, especially some slash / backslash, single quotation mark ‘and double quotation mark’ difference is difficult to remember. Therefore, GIT Bash is a solution to control windows with bash language of Linux (bash for Windows). For windows scripting, vscode is a very powerful tool, which is more suitable than visual studio and pychar. Compared with sublime, it can run all kinds of scripts. But the disadvantage is that it takes more memory and disk. Therefore, GIT + vscode is a very friendly bash for Windows programming environment combination for users who do not have win + Linux dual system or Linux subsystem on windows.

Git installation and configuration process

1. Download. There are two download addresseshttps://gitforwindows.org/perhapshttps://git-scm.com/download/winAll right.

2. Select the installation path, select the location to install, the default is / bin / bash, then the declaration at the beginning of each shell script is ා / bin / bash. If my Bash is installed in D: ා / D / tools / git / git / bin / bash, the declaration at the beginning of each shell script needs to be rewritten as ා / D / tools / git / git / bin / bash

3. Installation options. Check windows explorer integration, GIT LFS, associate. Git * configuration files with the default text editor, associate. Sh files to be run with bash

 

 

4. Create git in the start menu and click next

5. Select VIM as git’s default editor and click next

6. Adjust the environment variables. I choose use git from git bash only and use git’s own command-line tool. If git from the command line and also from 3rd party software is selected, it means that the windows command line is selected and click next

7. Select HTTP transport backend, I choose use the OpenSSL library, and click next

8. Configure line break settings. I select check out windows style, commit UNIX style line endings to automatically convert line breaks in files, and click next

9. Configure the terminal emulator. I select the default msys2 terminal of minyy and click next

10. Select the default git pull behavior. I choose the default and click next

 

11. Select the credential storage credential helper, I select git credential manager, and click next

 

12. Configure external options, check enable file system caching, enable symbolic links and enable empirical support for pseudo console, and click Install.

 

After installation, open as shown in the figure below and jump to releaseNote.html File: / / / D / tools / git / Git/ ReleaseNotes.html

 

There are three available modules in GIT. One is git GUI, as shown in the figure below. One is git bash to simulate Linux terminal, and the other is git CMD to simulate Windows terminal.

 

 

Vscode installation and configuration process

Script programming I recommend vscode. You can also plant various terminals into vscode and run the code directly in vscode. See strategy for implantation method.

Download the address firsthttps://vscode.en.softonic.com/orhttps://code.visualstudio.com/All right.

Double click Install, agree to the agreement, select the installation path, add to the program in the start menu, check add to path, and click Install.

The configuration process of vscode includes installing and expanding extension and implanting terminal.

My installed extensions include: Simplified ChineseChinese (Simplified) language pack for visual studio code, FORTRAN program color marking

The embedded terminal is git bash: click file preferences settings and search“ terminal.intergrated.shell . windows “, click Edit in below setting.json Enter the path of GIT

{
    "terminal.integrated.shell.windows": "D:\tools\git\Git\bin\bash.exe"
}
#Note: to avoid recognizing \ "as an escape character, we will use double backslash \ \ to write bash.exe The path of.

 

 

Then click the shortcut key Ctrl + ~ to display the implanted git bash as the terminal. In the options on the right side of terminal, you can also select the default shell (select Default shell), in which you can select command prompt, windows PowerShell, or WSL shell.

 

 

Configuration complete