使用mintty(
Cygwin’s great for getting some Linux command-line goodness in Windows, but using the Windows Shell to access it kills some of that magic. Using Mintty and a few other methods, you can make the experience much more luxurious.
Cygwin非常适合在Windows中获得Linux命令行优势,但是使用Windows Shell进行访问可以消除这种魔力。 使用Mintty和其他一些方法,您可以使体验更加豪华。
Windows Shell限制 (Windows Shell Limitations)
We’ve already shown you how to install and use Cygwin so you can use Windows and not have to miss out on that command-line goodness. For a lot of people, however, the excitement of running bash in Windows is severely hampered by the fact that Cygwin uses the Command Prompt shell to get things done. Here are some of the more common problems and complaints with this setup:
我们已经向您展示了如何安装和使用Cygwin,以便您可以使用Windows,而不必错过命令行的优点。 但是,对于许多人来说,由于Cygwin使用Command Prompt shell完成任务,因此严重阻碍了Windows中运行bash的兴奋性。 以下是此设置的一些较常见的问题和不满意之处:
- Resizing the window horizontally doesn’t work properly 水平调整窗口大小无法正常工作
- Can’t efficiently change font faces or sizes on-the-fly.无法即时有效地更改字体或大小。
- Scrolling via the keyboard doesn’t work. 通过键盘滚动不起作用。
- Selecting text over multiple lines doesn’t work. 选择多行文本不起作用。
- With some configurations, selecting text at all doesn’t work. 对于某些配置,根本无法选择文本。
- It’s all sorts of ugly compared to what Linux terminals provide. 与Linux终端所提供的相比,这真是丑陋。
A useful tool that’s a chore to utilize doesn’t really take me very far. How about you?
一件有用的有用工具并不能使我走得太远。 你呢?
Mintty节省了一天 (Mintty Saves the Day)
Mintty is a great alternative shell for Cygwin that provides a host of useful features and alleviates the above problems. If you use MSYS/MinGW instead of Cygwin, Mintty works beautifully with that, too.
Mintty是Cygwin的绝佳替代外壳,它提供了许多有用的功能并缓解了上述问题。 如果您使用MSYS / MinGW而不是Cygwin,那么Mintty也可以很好地工作。
You can install Mintty by grabbing it from the project’s download page (make sure you get the proper version for your setup!), or you can just run Cygwin’s Setup.exe file again.
您可以通过从项目的下载页面获取Mintty来安装Mintty(请确保您获取的安装版本正确!),也可以再次运行Cygwin的Setup.exe文件。
At the Select Packages screen, look under “Shells” and find Mintty. Click where it says “Skip” and hit the Next button. Once you’ve finished installing it, you should be able to go to Start > All Programs > Cygwin > mintty to launch it.
在“选择软件包”屏幕上,在“外壳”下查找并找到Mintty。 单击显示“跳过”的位置,然后单击“下一步”按钮。 安装完成后,您应该可以转到开始>所有程序> Cygwin> mintty来启动它。
Here’s what the default Mintty window looks like:
这是默认的Mintty窗口的样子:
It’s a little vanilla, but you’ll notice the resizing works properly and the font is at least a little better. You can hit Ctrl and + or – to make the font bigger or smaller at any point in time. Right-click the Title Bar and choose Options…
这有点香草,但是您会注意到调整大小的工作正常,并且字体至少好一点。 您可以按Ctrl和+或–在任何时间点放大或缩小字体。 右键单击标题栏,然后选择“选项”。
First thing I did was change the window transparency and the cursor in the Looks tab to something I’m more familiar with. Head over to the Text tab when you’re done that.
我要做的第一件事是将窗口透明度和“外观”选项卡中的光标更改为我更熟悉的内容。 完成后,转到“文本”选项卡。
You can change the default font, of course, but also the Locale and Character Set to something different from what Windows is using right now. You can also play with font smoothing if your monitor shows it a little too jaggedly.
当然,您可以更改默认字体,但也可以将“区域设置”和“字符集”更改为与Windows当前使用的字体不同的名称。 如果显示器显示的锯齿有点太锯齿,您也可以使用字体平滑处理。
Under the Mouse options, you’ll be able to change your mouse interaction settings, such as copying and pasting. You can also easily make the mouse place the command-line cursor, something that vim users often seem to like. Lastly, click on Window.
在“鼠标”选项下,您将能够更改鼠标交互设置,例如复制和粘贴。 您也可以轻松地使鼠标放在命令行光标上,这是vim用户经常喜欢的东西。 最后,单击“窗口”。
Here, you can change the default terminal size, the scrollback buffer size, and choose a modifier for scrolling with the arrow keys. By default, Shift+Up/Down will scroll through the buffer in the window. Now here’s what my modified Mintty configuration looks like.
在这里,您可以更改默认终端大小,回滚缓冲区大小,并选择修改器以使用箭头键滚动。 默认情况下,Shift +上/下将滚动浏览窗口中的缓冲区。 现在,这就是我修改后的Mintty配置的样子。
(Click on the above image to see a larger version.)
(单击上图查看大图。)
其他方法(适用于腻子爱好者) (Other Methods (for PuTTY-Lovers))
Mintty is great, but others may not like it so much. We showed you how to install an SSH server on Cygwin, and many people use PuTTY or KiTTY to connect to Cygwin that way. However, if you don’t want to set up SSH access, there’s an easier way.
Mintty很棒,但是其他人可能不太喜欢它。 我们向您展示了如何在Cygwin上安装SSH服务器,许多人使用PuTTY或KiTTY以这种方式连接到Cygwin。 但是,如果您不想设置SSH访问,则有一种更简单的方法。
PuTTYcyg is a patched version of PuTTY that is able to connect to native Cygwin installations. There’s only one hitch: PuTTY was recently updated to version 0.61, adding support for Windows 7’s jump lists, Aero-resizing, and non-fixed-width fonts. PuTTYcyg hasn’t been updated yet, so you’ll have to choose between Cygwin support and Windows 7-compatibility. I haven’t been able to find the patch itself, so I haven’t tried adding support to the latest version of PuTTY. If you have, please leave a line in the comments.
PuTTYcyg是PuTTY的修补版本,能够连接到本机Cygwin安装。 只有一个障碍:PuTTY最近更新到版本0.61,增加了对Windows 7跳转列表,Aero调整大小和非固定宽度字体的支持。 PuTTYcyg尚未更新,因此您必须在Cygwin支持和Windows 7兼容性之间进行选择。 我还没有找到补丁本身,所以没有尝试为最新版本的PuTTY添加支持。 如果有,请在评论中保留一行。
Personally, I prefer KiTTY over PuTTY because of it’s more customizable and was updated more often over the past 4-years. There’s a KiTTY-compatible PuTTYcfg patch which adds this functionality for others like me. To be honest, though, since I started using Mintty with Cygwin I haven’t touched KiTTY in weeks.
就个人而言,我更喜欢KiTTY,而不是PuTTY,因为它具有更高的可定制性,并且在过去4年中更新的频率更高。 有一个与KiTTY兼容的PuTTYcfg补丁程序,为我这样的其他人添加了此功能。 不过,老实说,自从我开始在Cygwin中使用Mintty以来,我已经有几周没接触过KiTTY了。
Lastly, if you’re looking for something that supports Cygwin as well as the Windows Command Prompt, you might be interested in Console. It’s a console replacement that allows tabbing of multiple types of shells as well as adding transparency and on-the-fly font changes.
最后,如果您正在寻找支持Cygwin以及Windows Command Prompt的产品,那么您可能会对Console感兴趣。 它是控制台的替代品,它允许制表符多种类型的外壳,以及增加透明度和即时字体更改。
Do you have a preferred Cygwin shell? Do you have an alternative to Cygwin? Know of a patch that works with PuTTY 0.61? Let us know below!
您有首选的Cygwin外壳吗? 您有Cygwin的替代产品吗? 知道适用于PuTTY 0.61的补丁程序吗? 让我们在下面知道!
翻译自: https://www.howtogeek.com/68511/how-to-improve-your-cygwin-experience-with-mintty/
使用mintty(