vscode 集成 cygwin

vscode 现在是我的主力开发编辑器,它自带 terminal 不需要我各种切换,我还想要在 windows 下执行一些简单的 .sh 文件。所以,我希望有一款工具能够在 windows 下使用 linux shell 的命令,并且能和 vscode 集成。Cygwin 刚好能够满足我的小小需求。

Cygwin 的下载和安装自不必说,网上有很多教程,要是想偷懒,根据提示一直点击“下一步”就成。

更换 vscode terminal 为 Cygwin

vscode 官方文档说明了如何集成 Cygwin 的 Shell:

https://code.visualstudio.com/docs/editor/integrated-terminal

Can I use Cygwin's shell with the terminal on Windows?
Yes, to use the Cygwin shell, you will first need to install the chere package and then add the following settings to your settings.json file: "terminal.integrated.shell.windows": "C:\\Cygwin\\bin\\bash.exe",
"terminal.integrated.shellArgs.windows": ["/bin/xhere", "/bin/bash"]

然而直接 copy 配置,是不会成功。需要更改安装目录,如下:

// cygwin 的安装目录
"terminal.integrated.shell.windows": "E:\\cygwin64\\bin\\bash.exe",
// 使得 cygwin 切换到当前工作目录
"terminal.integrated.env.windows": {
"CHERE_INVOKING": "1"
},
// 使 cygwin 能够在 vscode 中正常使用 Shell 命令
"terminal.integrated.shellArgs.windows": [
"-l"
],

使用 git

如果你没有使用过 git 登录过远程仓库,那么你只需要点击这里

如果你已经使用过,那么通过 cygwin shell 执行 git 登录,需要将原来的 .ssh/ 文件夹拷贝到 cygwin shell 用户目录的文件夹下。

用我的机器举个栗子:

我的电脑名是 廖大爷,我的 cygwin 安装在 E:\cygwin64

打开 cygwin shell 命令行窗口,显示默认的用户目录是 廖大爷@DESKTOP-U6MI28E,实际位置在E:\cygwin64\home\廖大爷\,执行 ls -a:

.   .bash_history  .bashrc     .inputrc  .ssh
.. .bash_profile .gitconfig .profile

而在我的 C:\User\廖大爷\ 文件夹里已经存在了 .ssh/,并且是我正在使用的,所以我并不想生成新的 SSH 公钥,需将原来的内容拷贝到 cygwin shell 的用户目录中,现在我们有了 cygwin shell,不用再操作鼠标:

cp -r C:\User\廖大爷\.ssh\ ~

可以进入愉快的编码时间啦

其他

Windows下安装和使用Git(Cygwin篇)

Integrated Terminal

vscode 集成 cygwin 的注意事项的更多相关文章

  1. NodeJS,MongoDB,Vue,VSCode 集成学习

    NodeJS,MongoDB,Vue,VSCode 集成学习 开源项目地址:http://www.mangdot.com

  2. VSCode集成TypeScript编译

    先安装github客户端和nodeJS客户端吧,直接去官网下载,nodeJS客户端安装完就集成了npm; 查看是否成功: git version  node -v npm-v 安装TypeScript ...

  3. vscode 集成git bash, mingw, mintty 的terminal

    设置 右上角打开json文件的设置 输入以下代码: "terminal.external.windowsExec": "D:\\Program Files\\Git\\b ...

  4. centos 下使用vscode 调试egg.js 注意事项

    这两天在centos下,直接用vscode运行egg.js的例子.遇到个问题就是当安装了vscode-egg插件,会遇到一个现象.就是同样的代码,Windows下调试可以顺利进行,但是centos有时 ...

  5. VSCode集成Git代码管理

    一.安装和配置VSCode与Git 1.下载Git并安装: https://git-scm.com/download/ 2.下载VSCode并进行安装: https://code.visualstud ...

  6. vscode集成eslint

    1. 安装 ESLint 扩展 首先,打开 VSCode 扩展面板并搜索 ESLint 扩展,然后点击安装 2. 项目安装eslint yarn add eslint -D 3. 设置eslint配置 ...

  7. 踩坑:VScode 集成 eslint 插件

    本文以 Vue 官方脚手架 Vue-cli 为例: 1. 创建 Vue 项目 注意:Vue-cli 默认给出了 eslint 配置,一路回车即可.最后在安装模块的时候,选择直接安装!我用淘宝镜像安装时 ...

  8. vscode配置Microsoft C++注意事项

    vscode配置c++插件教程链接如下: https://code.visualstudio.com/docs/cpp/config-msvc#_check-your-microsoft-visual ...

  9. Node.js集成支付宝接口注意事项

    目录 签名 发送请求表单 验签 总结 签名 使用node.js自带的加密模块crypto和字符编码模块iconv-lite 根据支付宝接口文档参数格式得到签名之前的字符串beforeSignStr,然 ...

随机推荐

  1. java.util.Stack类中的peek()方法

    java.util.stack类中常用的几个方法:isEmpty(),add(),remove(),contains()等各种方法都不难,但需要注意的是peek()这个方法. peek()查看栈顶的对 ...

  2. MongoError: no primary found in replicaset

    nodejs连接mongodb时,使用集群方式报错 2017-09-22T01:42:32.115Z - error: db connect failed 2017-09-22T01:42:32.12 ...

  3. springmvc controller方法返回值

  4. 《深入理解JAVA虚拟机》----------第二章 JAVA内存区域与内存溢出异常,笔记(下)

    2. HotSpot虚拟机对象探秘 2.1 对象的创建 虚拟机遇到一条New指令时,首先将去检查这个指令的参数是否能在常量池中定位到一个类的符号引用,并且检查这个符号引用代表的类是否已被加载.解析和初 ...

  5. mongodb-MYSQL

    #encoding:utf8 import pymongoimport MySQLdbimport randomdef GetMongoData(): MyQuery = Mongo_Tab.find ...

  6. 【mac上安装&配置&使用git】

    转自:https://www.jianshu.com/p/7edb6b838a2e 目录 安装git 创建ssh key.配置git 提交本地项目到GitHub 一.安装Git MAC 上安装Git主 ...

  7. 567. Permutation in String判断某字符串中是否存在另一个字符串的Permutation

    [抄题]: Given two strings s1 and s2, write a function to return true if s2 contains the permutation of ...

  8. ggplot2 梯度作图

    ggplot2是R语言的绘图包 library('ggplot2') df <- data.frame(var=c("a","b","c&quo ...

  9. [leetcode]31. Next Permutation下一个排列

    Implement next permutation, which rearranges numbers into the lexicographically next greater permuta ...

  10. node.js中通过dgram数据报模块创建UDP服务器和客户端

    node.js中 dgram 模块提供了udp数据包的socket实现,可以方便的创建udp服务器和客户端. 一.创建UDP服务器和客户端 服务端: const dgram = require('dg ...