Cygwin/Windows 的最佳终端环境?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/701895/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Best terminal environment for Cygwin/Windows?
提问by Anders Sandvig
Today I run Cygwin with rxvt
using the following startup line:
今天,我rxvt
使用以下启动行运行 Cygwin :
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.
这给了我一个可调整大小的原生 Windows 窗口,它比默认cygwin.bat
提供的标准“DOS 框”要好得多。
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.).
- 我无法在终端窗口中输入非 ASCII 字符(即 ?, ?, ? and ?, ?, ?如果我粘贴像“b?lle”(挪威语为“bulley”)这样的字符串,我得到的只是“blle”。
- 我无法渲染 UTF-8 字符,它们只显示为 ?,即使它们受字体支持(即在 ISO-8859-1 中渲染相同的字符时,它们显示得很好。)。
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.
我正在运行英语 Windows Vista,语言环境和键盘布局设置为挪威语(ISO-8859-1 字符集?),但我在 Windows 2000 和 XP 上遇到了完全相同的问题。
Anyone knows how to fix this (i.e. a better way to configure rxvt)?
任何人都知道如何解决这个问题(即配置 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?
除了上面提到的问题,我对 非常满意rxvt
,所以如果我找到了解决它们的方法,我想继续使用它。但是,如果问题不能(容易)解决,那么 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.
Andy 和 Mattias 提供的解决方案(编辑.inputrc
文件)确实解决了输入问题,但输出渲染仍然是一个问题。当我在 ISO-8859-1 中渲染时输出很好,但是当使用 UTF-8 时我只得到 ? 对于非 ASCII 字符。此行为在rxvt
、urxvt
(在 Cygwin XFree X Server 下)mintty
和 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)?
是否有类似的配置文件可以设置输出编码(即相当于在 Linux 系统上设置输出区域设置)?
采纳答案by debugme
Add the following two lines to the readline config file ~/.inputrc
将以下两行添加到 readline 配置文件 ~/.inputrc
set convert-meta off
set output-meta on
Should work both in rxvt and mintty. More here:
应该在 rxvt 和 mintty 中工作。更多在这里:
http://www.gnu.org/software/bash/manual/bashref.html#Readline-Init-File-Syntax
http://www.gnu.org/software/bash/manual/bashref.html#Readline-Init-File-Syntax
回答by debugme
minTTY is also pretty good. You can find it in cygwin's setup. Supports re-sizing, pasting, and transparency.
minTTY 也不错。您可以在 cygwin 的设置中找到它。支持重新调整大小、粘贴和透明度。
回答by debugme
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:
我目前正在使用 PuttyCyg ( http://code.google.com/p/puttycyg/)。我不确定它是否会包含您需要的修复程序,但它还有其他几个很酷的功能,例如存储到典型 putty 配置文件的配置,可以像这样调用:putty -load mycygwin1。这样的配置文件可以配置如下内容:
- logging sessions to a file,
- character sequences for delete, home, and other keys,
- window colors and fonts.
- 将会话记录到文件中,
- 删除、home 和其他键的字符序列,
- 窗口颜色和字体。
Edit:it is possible to enter chars you mentioned. UTF-8 support is also provided (it has to be turned on in configuration).
编辑:可以输入您提到的字符。还提供了 UTF-8 支持(必须在配置中打开)。
回答by Mattias Kihlstr?m
I'm using Consoleas 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:
为了能够使用非 ASCII 字符,我将以下内容放入主目录的 .inputrc 文件中:
set meta-flag on
set convert-meta off
set output-meta on
set completion-ignore-case on
回答by Martin Dorey
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.
四岁了,在撰写本文时,问题的实质已经消失:默认的 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 端口。
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://code.google.com/p/jessies/wiki/Terminator, which was written for UTF-8, possibly from day one, though its main selling point, imo, is the Find feature.
甚至标题中的问题也没有以前那么重要,因为 mintty 不像旧的 Windows 命令控制台子系统窗口那样令人讨厌。尽管如此,我还是会插入我共同维护的项目:https: //code.google.com/p/jessies/wiki/Terminator,它是为 UTF-8 编写的,可能从第一天开始,尽管它的主要卖点是, imo,是查找功能。
回答by Matt
You may need to set the codepage.
您可能需要设置代码页。
Check your current :
检查您的当前:
$ set | grep CYGWIN
CYGWIN='codepage:oem nodosfilewarning'
If you have not the codepage, then add to your ~/.bashrc file:
如果您没有代码页,请添加到您的 ~/.bashrc 文件中:
CYGWIN='codepage:oem nodosfilewarning'
The contents of my Cygwin batch (Cygwin.bat) file, started by a shortcut, are:
由快捷方式启动的 Cygwin 批处理 (Cygwin.bat) 文件的内容是:
start C:\cygwin\bin\rxvt.exe -sb -sl 3000 -fg gray -bg black -fn "Lucida Console-14" -e /bin/bash --login -i
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 }.
请注意,对于 CYGWIN 环境变量,您可以有多个项目,每个项目由一个空格分隔。可以使用的其他项目:{ tty binmode title }。
More info can be read here: http://www.cygwin.com/cygwin-ug-net/setup-env.html
更多信息可以在这里阅读: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.
相关说明:您还可以将 mrxvt 用于 Cygwin。它需要一个 X 服务器,一个不错的可靠/轻量级解决方案是使用 Xming。我编译了 mrxvt 并安装了它——这并不难,而且效果很好。
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.
我使用 rxvt 作为初始窗口,然后使用别名命令将 mrxvt 作为与 rxvt 分开的进程启动,然后关闭 rxvt。这使 mrxvt 成为自己的父进程,并且没有附加 cmd 会话。
I made an alias to do this:
我做了一个别名来做到这一点:
alias mrx='export DISPLAY="127.0.0.1:0.0"; $(/usr/local/bin/mrxvt &); echo -e "3c"'
For ease I created a batch file to start Xming and rxvt:
为方便起见,我创建了一个批处理文件来启动 Xming 和 rxvt:
@echo off
start C:\cygwin\bin\rxvt.exe -sb -sl 3000 -fg gray -bg black -fn "Lucida Console-14" -e /bin/bash --login -i
start C:\Xming\Xming.exe :0 -clipboard -multiwindow -trayicon
exit
This batch file is launched by a windows shortcut. This has worked well for me.
此批处理文件由 Windows 快捷方式启动。这对我来说效果很好。
回答by Dan Vinton
回答by Dan Dyer
回答by spoulson
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.
带有 xterm 的标准 Cygwin/X 对我来说已经足够了。安装 Cygwin X.org 包,然后运行脚本C:\cygwin\bin\startxwin.bat
(假设默认安装路径)。它将启动 X,然后是 xterm。
I updated my .Xdefaults
with these options for better usability:
我更新.Xdefaults
了这些选项以获得更好的可用性:
*VT100*scrollbar.width: 14
*VT100*scrollbar.background: gray60
*VT100*scrollbar.foreground: rgb:a/5/5
*VT100*scrollbar.borderWidth: 0
*VT100*scrollbar.displayList:\
foreground gray90;\
lines 1,-1,-1,-1,-1,1;\
foreground gray60;\
lines -1,1,1,1,1,-1
*VT100*rightScrollBar: true
*VT100*scrollBar: true
*VT100*scrollLines: 1000
xterm*toolBar: false
回答by AFIRAN
If you use ls with certain arg it is showing file names OK I suggest you put an ls alias in /etc/profile:
如果您将 ls 与某些 arg 一起使用,它会显示文件名 OK 我建议您在 /etc/profile 中放置一个 ls 别名:
alias ls='ls -F --color=auto --show-control-chars'
alias ls='ls -F --color=auto --show-control-chars'
Works for me in msys on a WinXP.
在 WinXP 上的 msys 中对我来说有效。