Cygwin/Windows 的最佳终端环境?
今天,我使用以下启动行通过 rxvt
运行 Cygwin:
rxvt -bg black -sl 8192 -fg white -sr -g 150x56 -fn "Fixedsys" -e /usr/bin/bash --login -i
这为我提供了一个可调整大小的本机 Windows 窗口,它比默认 cygwin.bat 提供的标准“DOS 框”要好得多。
然而,当前的配置确实存在一些问题:
- 我无法在终端窗口中输入非 ASCII 字符(即 æ、ø、å 和 Æ、Ø、Å,我经常使用这些字符。事实上,当我将它们粘贴到窗口中时,终端甚至不会接受它们。如果我粘贴像“bølle”(挪威语“bulley”)这样的字符串,我得到的只是“blle”,
- 我无法呈现 UTF-8 字符 。 ,它们仅显示为 ?,即使它们受字体支持(即,在 ISO-8859-1 中渲染相同的字符时,它们显示得很好。)
我运行的是英语 Windows Vista,区域设置和键盘布局设置为挪威语( ISO-8859-1 字符集?),但我在 Windows 2000 和 XP 上遇到了完全相同的问题。
有人知道如何解决此问题(即配置 rxvt 的更好方法)吗?
除了上述问题之外, 我对 rxvt 非常满意,所以如果我找到解决它们的方法,我想继续使用它,但是,如果问题无法(轻松)解决,还有其他好的终端解决方案吗?对于西格温?
更新
Andy和Mattias提供的解决方案(编辑.inputrc
文件)确实解决了输入问题,但输出渲染仍然是一个问题。 当我在 ISO-8859-1 中渲染时,输出很好,但是当使用 UTF-8 时,我只能得到 ? 对于非 ASCII 字符。 此行为在 rxvt
、urxvt
(在 Cygwin XFree X Server 下)、mintty
和 PuttyCyg 之间是一致的。
是否有类似的配置文件可以设置输出编码(即相当于在Linux系统上设置输出区域设置)?
Today I run Cygwin with rxvt
using the following startup line:
rxvt -bg black -sl 8192 -fg white -sr -g 150x56 -fn "Fixedsys" -e /usr/bin/bash --login -i
This gives me a resizeable native Windows window which is much better than the standard "DOS box" the default cygwin.bat
provides.
However, the current configuration does have a couple of issues:
- I am not able to enter non-ASCII characters into the terminal window (i.e. æ, ø, å and Æ, Ø, Å, which I use semi-frequently. In fact, the terminal will not even accept them when I paste them into the window. If I paste a string like "bølle" (Norwegian for "bulley"), all I get is "blle".
- I am not able to render UTF-8 character, they only show as ?, even if they are supported by the font (i.e. when rendering the same characters in ISO-8859-1 they show just fine.).
I am running English Windows Vista with locale and keyboard layout set to Norwegian (ISO-8859-1 character set?), but I've had the exact same issue on Windows 2000 and XP.
Anyone knows how to fix this (i.e. a better way to configure rxvt)?
Apart from the issues mentioned above, I'm very happy with rxvt
, so if I find a way to resolve them I'd like to continue using it. However, if the issues are not (easily) solvable, are the any other good terminal solutions for Cygwin?
Update
The solution provided by Andy and Mattias (editing the .inputrc
file) did solve the input problem, but output rendering is still an issue. Output is fine when I render in ISO-8859-1, but when using UTF-8 I only get ? for non-ASCII characters. This behavior is consistent between rxvt
, urxvt
(under Cygwin XFree X Server), mintty
and PuttyCyg.
Is there a similar configuration file where output encoding can be set (i.e. the equivalent of setting output locale on a Linux system)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(21)
与 emg-2 类似,Lifehacker 最近发表了一篇关于 MinTTY,不确定它是否包含您需要的修复。
On a similar note to emg-2, Lifehacker recently had an article about MinTTY, not sure if it contains fixes needed by you.
如果您只满足于运行 Cygwin 应用程序,那么 rxvt 应该可以正常工作。 Rxvt 应该有 UTF-8 支持。 您是否尝试过谷歌搜索解决方案?
如果您还需要运行本机 Windows 应用程序,那么除非您在 Windows 控制台内运行 bash,否则您就不走运了。 我认为有两个问题尚未解决(甚至无法解决):
这两个问题对于我尝试过的所有终端模拟器(rxvt、xterm、Emacs 和其他一些)都是相同的。
If you're content with only running Cygwin-applications, then rxvt should work fine. Rxvt should have UTF-8 support. Did you try googling for a solution?
If you also need to run native Windows applications, you're out of luck unless you run bash inside the Windows console. There are two issues which I don't believe are (or even can be) solved:
These two issues are the same with all the terminal emulators I've tried (rxvt, xterm, Emacs, and a few others).
除了完全可调整大小之外,rxvt 还为您提供了 Windows 控制台窗口所没有的哪些功能? 你有没有看过内存使用的差异 - rxvt 是一个猪。 我使用 rxvt 几个星期,然后切换回 Windows 控制台窗口,没有后悔。
Apart from the complete resizability, what features does rxvt gice you that a Windows console window doesn't? And have you looked at the difference in memory usage - rxvt is a hog. I use rxvt for a couple of weeks and the switched back to a windows console window, without regrets.
是的,mintty看起来更舒服,轻便,快速,但是有一个功能它没有,而默认(windows)控制台有,那就是搜索功能:从默认控制台,你可以搜索控制台上显示的字符串, 乐趣 ?
到目前为止,我还没有发现任何其他控制台具有此功能...我知道,告诉我,我真的不喜欢默认控制台。
yes, mintty seems more comfortable, light and fast, but there is one feature it doesn't have, and the default (windows) console have, that is the search function: from the default console, you can search string displayed on the console, fun ?
up to now, i haven't found any other console have this feature... i you know, tell me, i really don't like the default console.
我使用过几个终端,例如 putty、console、rxvt、mintty、teraterm。
最好的是四项。
它是免费的,完全兼容 lang 和 tty,完全可通过宏、快捷方式进行配置,并为 Cygwin 提供 cygterm。
但是,如果您的轻度用户,只需使用 mintty(当今的默认术语)或 rxvt。
I have used several terminals such as putty, console, rxvt, mintty, teraterm.
the best is the teraterm.
it is free, fully compatible for lang and tty, fully configurable with macro, shortcut, and give the cygterm for Cygwin.
however if you light user, just use mintty which is default term these day or rxvt.
minTTY 也很不错。 您可以在 cygwin 的设置中找到它。 支持调整大小、粘贴和透明度。
minTTY is also pretty good. You can find it in cygwin's setup. Supports re-sizing, pasting, and transparency.
我目前正在使用 PuttyCyg (http://code.google.com/p/puttycyg/)。 我不确定它是否包含您需要的修复,但它还有其他几个很酷的功能,例如存储到典型的 putty 配置文件的配置,可以像这样调用:putty -load mycygwin1。 此类配置文件可以配置以下内容:
编辑:可以输入您提到的字符。 还提供 UTF-8 支持(必须在配置中打开)。
I'm currently using PuttyCyg (http://code.google.com/p/puttycyg/). I'm not sure if it will contain fixes needed by you, but it has several other cool features, for example configurations stored to typical putty profiles, which can be invoked like: putty -load mycygwin1. Such profile can configure things like:
Edit: it is possible to enter chars you mentioned. UTF-8 support is also provided (it has to be turned on in configuration).
将以下两行添加到 readline 配置文件 ~/.inputrc
应该在 rxvt 和 mintty 中都可以工作。 更多信息请参见:
http://www.gnu。 org/software/bash/manual/bashref.html#Readline-Init-File-Syntax
Add the following two lines to the readline config file ~/.inputrc
Should work both in rxvt and mintty. More here:
http://www.gnu.org/software/bash/manual/bashref.html#Readline-Init-File-Syntax
在撰写本文时,已经四岁了,问题的实质已经消失:默认的 Cygwin 终端现在接受粘贴和渲染非 Ascii 字符,无需正式,至少对我来说是这样。 Cygwin 的默认终端现在是 mintty,并且 Cygwin 现在默认使用 UTF-8 运行。 (例如,/etc/profile.d/lang.sh 现在默认设置 UTF-8 字符集编码。)现在有 64 位版本的 Cygwin,但是,根据 http://www.cygwin.com/ml/cygwin/2013-09/msg00029.html,无 64 rxvt 的位端口。
即使标题中的问题也不像以前那么重要了,因为 mintty 不像旧的 Windows 命令控制台子系统窗口那样令人讨厌。 尽管如此,我还是会插入我共同维护的项目: https://github .com/software-jessies-org/jessies/wiki/Terminator,可能从第一天起就为 UTF-8 编写,尽管在我看来,它的主要卖点是查找功能。
Being four years old, at the time of writing, the meat of the question has gone off: the default Cygwin terminal now accepts pasting of, and renders, non-Ascii characters without formality, at least for me. Cygwin's default terminal is now mintty and Cygwin now operates with UTF-8 by default. (For example, /etc/profile.d/lang.sh now sets a UTF-8 character set encoding by default.) There's now a 64 bit version of Cygwin but, per http://www.cygwin.com/ml/cygwin/2013-09/msg00029.html, no 64 bit port of rxvt.
Even the question in the title is less vital than once it was, as mintty doesn't grate like the old Windows command console subsystem windows. Still, I'll plug the project I co-maintain: https://github.com/software-jessies-org/jessies/wiki/Terminator, which was written for UTF-8, possibly from day one, though its main selling point, imo, is the Find feature.
我也在使用 Console 。 控制台允许您自定义字体、背景等,并且还具有选项卡式界面(如果您同时使用多个终端窗口,那就太棒了)。
为了能够使用非 ASCII 字符,我将以下内容放入主目录的 .inputrc 文件中:
I'm using Console as well. Console allows you to customize font, background, etcetera and also has a tabbed interface (great if you use more than one terminal window at once).
In order to be able to use non-ASCII characters I have put the following in my .inputrc file in my home directory:
您可能需要设置代码页。
检查当前的:
如果没有代码页,则添加到 ~/.bashrc 文件:
我的 Cygwin 批处理 (Cygwin.bat) 文件的内容(通过快捷方式启动)是:
请注意,对于 CYGWIN 环境变量,您可以有多个项目,每个项目之间用空格分隔。 其他可以使用的项目:{ tty binmode title }。
更多信息可以在这里阅读:
http://www.cygwin.com/cygwin-ug-net/ setup-env.html
相关说明:您还可以将 mrxvt 用于 Cygwin。 它需要一个 X 服务器,一个不错的可靠/轻量级解决方案是使用 Xming。 我编译了 mrxvt 并安装了它 - 并不难,而且效果很好。
我使用 rxvt 作为初始窗口,然后使用别名命令将 mrxvt 作为独立于 rxvt 的进程启动,然后关闭 rxvt。 这使得 mrxvt 成为它自己的父进程,并且没有附加 cmd 会话。
我创建了一个别名来执行此操作:
为了方便起见,我创建了一个批处理文件来启动 Xming 和 rxvt:
该批处理文件是通过 Windows 快捷方式启动的。 这对我来说效果很好。
You may need to set the codepage.
Check your current :
If you have not the codepage, then add to your ~/.bashrc file:
The contents of my Cygwin batch (Cygwin.bat) file, started by a shortcut, are:
Note that for the CYGWIN environ variable you can have multiple items, each seperated by a space. Other items that can be used: { tty binmode title }.
More info can be read here:
http://www.cygwin.com/cygwin-ug-net/setup-env.html
A related note: you can also use mrxvt for Cygwin. It requires an X server, and a nice solid/lightweight solution is to use Xming. I compiled mrxvt and installed it - not really hard to do, and it works great.
I use rxvt as an initial window, then launch mrxvt as a seperate process from rxvt by using an alias command, then close rxvt. This makes mrxvt its own parent process, and has no cmd sessions attached.
I made an alias to do this:
For ease I created a batch file to start Xming and rxvt:
This batch file is launched by a windows shortcut. This has worked well for me.
我一直在使用 Console 它与 Cygwin (以及 PowerShell 和普通的旧 cmd)配合得很好。EXE文件)。
I've been using Console which works pretty well with Cygwin (as well as PowerShell and plain old cmd.exe).
当我在 Windows 上进行开发时,我发现 Poderosa 是 Cygwin 的不错选择。
When I was developing on Windows I found Poderosa to be a good choice for Cygwin.
标准 Cygwin/X 和 xterm 对我来说已经足够了。 安装 Cygwin X.org 软件包,然后运行脚本
C:\cygwin\bin\startxwin.bat
(假设默认安装路径)。 它将启动 X,然后启动 xterm。我使用这些选项更新了我的
.Xdefaults
以提高可用性:Standard Cygwin/X with xterm is good enough for me. Install the Cygwin X.org package, then run the script
C:\cygwin\bin\startxwin.bat
(assuming default install path). It'll start X and then xterm.I updated my
.Xdefaults
with these options for better usability:我会在 Windows 中设置您所在的国家/地区(控制面板 -> 区域设置 -> 最后一个选项卡(控制) -> 与 unicode 不兼容的语言的语言 -> 您的选择(挪威语))。 重新启动后开始开始->Cyqwin->rxvt-native。 对于俄语,它可以工作(无需编辑 .bashrc 或其他内容)。
它甚至(正如我猜测的那样)将软件的输出转换为utf-8,因为默认编码是C.UTF-8。 要检查它,请输入“echo $LANG”。
I would set up your country in windows (Control Panel -> Regional Settings -> Last Tab (control) -> Language for unicode-uncompatible languages -> Your choice (Norwegian)). After reboot start Start->Cyqwin->rxvt-native. For russian it works (without editing .bashrc or whatever).
It even (as I guess) converts the output of the soft into utf-8, because the default encoding is C.UTF-8. To check it type "echo $LANG".
关于 cygwin 的替代终端仿真器主题 - 查看 Console2; 它具有您需要的所有功能。
On the topic of alternative terminal emulators for cygwin - check out Console2; it has all the features you'll need.
如果您将 ls 与某些参数一起使用,它会显示文件名 OK
我建议您在 /etc/profile 中放置一个 ls 别名:
alias ls='ls -F --color=auto --show-control-chars'
在 WinXP 上的 msys 中适用于我。
If you use ls with certain arg it is showing file names OK
I suggest you put an ls alias in /etc/profile:
alias ls='ls -F --color=auto --show-control-chars'
Works for me in msys on a WinXP.
rxvt 不支持 unicode,因此如果您登录到使用 UTF-8 进行编码的机器,则无法使其正常工作。 您可以对 iso-8859-1/15 使用 rxvt,但现在大多数机器都是 UTF-8。
Cygwin 中 rxvt 的 unicode 替代品是 urxvt,Cygwin 下的包名称是 rxvt-unicode-X。 urxvt 还有其他不错的功能,例如许多可下载的插件 - 包括为每个窗口提供多个选项卡的插件,以及客户端/服务器架构,如果您有很多窗口,则可以使用更少的资源(
urxvtc
/urxvtd
)。您可能还需要确保您的 readline 变量指定您的 shell 应传递 8 位字符,即将其添加到您的
$HOME/.bashrc
或$HOME/.profile:
您必须在
$HOME/.Xdefaults
中设置正确的资源:特别是您需要一种具有所需字符的字体。 urxvt 的资源组名称是URxvt
。 注意大小写,这很重要!我还建议设置:
此资源决定
$TERM
环境变量的值。 除非正确设置,否则无法找到正确的 termcap 文件,从而导致less
等程序发出以下样式的警告:警告:终端功能不全
。 不幸的是,许多 Linux 发行版都不知道 rxvt-unicode 的默认 termName,因此如果您经常 ssh 到远程计算机,就会遇到问题。 解决方案是将termName
设置为更常见的名称(例如xterm
),或者将 rxvt-unicode 的 termcap 文件上传到您登录的所有服务器。rxvt is incapable of unicode, so you can not make it work correctly if you log into machines that use UTF-8 for encoding. You can use rxvt for iso-8859-1/15, but most machines now are UTF-8.
The unicode replacement for rxvt in Cygwin is urxvt, the package name under Cygwin is rxvt-unicode-X. urxvt also has other nice features, such as many downloadable plugins - including one that gives you multiple tabs per window, and a client/server architecture that makes it use a lot less resources if you have many windows (
urxvtc
/urxvtd
).You may also need to make sure your readline variables specify that your shell should pass through 8-bit characters, i.e. add this to your
$HOME/.bashrc
or$HOME/.profile
:You will have to set the right resources in
$HOME/.Xdefaults
: in particular you will need a font that has the characters you want. The resource group name for urxvt isURxvt
. Note the capitalization, it matters!I also recommend setting:
This resource decides the value of the
$TERM
environment variable. Unless it is correctly set, the right termcap file can not be found, causing programs likeless
to emit warnings in the style of:WARNING: terminal is not fully functional
. Unfortunately, the default termName ofrxvt-unicode
isn't known under many Linux distributions, so if you often ssh to remote machines, you will run into the problem. The solution is to either settermName
to something more common (likexterm
), or upload a termcap-file for rxvt-unicode to all the servers you log into.由于标题在某种程度上具有误导性,并且搜索结果多次将我带到这里,因此我只会回答阅读标题。
我喜欢在 Windows 上使用 Babun 作为 Cygwin 环境,它对我来说几乎是完美的。
Since the title is somehow misleading, and search results brought me here many times, I'll just answer reading the title.
I like using Babun on Windows as Cygwin Environment, it's almost perfect for me.
请尝试 ConEmu,它是一款带有选项卡的开源控制台模拟器,它将多个控制台和简单的 GUI 应用程序表示为一个可自定义的 GUI 窗口。
https://conemu.github.io/
Please try ConEmu which is an opensource console emulator with tabs, which represents multiple consoles and simple GUI applications as one customizable GUI window.
https://conemu.github.io/
xfce4-terminal(可从 Cygwin
setup.exe
获得)对我来说是最好的,因为它看起来很棒(易于阅读),并且如果使用 XLaunch 启动(也可从>setup.exe
),我可以从中启动其他 cygwin GUI 应用程序。 由于某种原因,我无法从mintty
启动 GUI 应用程序。 我发现这个线程正在寻找一个比 xterm 更不丑陋的终端(它可以很好地启动 GUI 应用程序)。 最后,我通过在 setup.exe 中的终端上搜索找到了最好的一个(xfce4-terminal
)。 7 年多以来,xfce4-terminal 一直是我最喜欢的 Linux 之一。Guake 也可在
setup.exe
中使用,但我必须从另一个终端启动它并单击该另一个终端,然后再使用击键来关闭 Guake。 所以,这并不像在 Linux 上那么实用。xfce4-terminal (available from Cygwin
setup.exe
) is the best for me because it looks great (easy to read) and if started with XLaunch (also available fromsetup.exe
), I can start other cygwin GUI applications from it. For some reason, I can't launch GUI applications frommintty
. I found this thread looking for a less ugly terminal thanxterm
(which works fine for launching GUI applications). In the end, I found the best one (xfce4-terminal
) just by searching on terminal in setup.exe. xfce4-terminal has been one of my favorites on Linux for more than 7 years now.Guake is also available in
setup.exe
, but I have to launch it from another terminal and click that other terminal before using keystrokes to bring down Guake. So, that's not so practical as it is on Linux.