想要简单的 linux 控制台文本编辑器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5607352/
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
Simple linux console text editor wanted
提问by Nigel Alderton
I'm a linux newbie coming from a Windows background and I am trying to find a simple full-screen console-based plain-text editor. Something that emulates the look and feel of the Windows edit.com would be perfect.
我是一个来自 Windows 背景的 linux 新手,我试图找到一个简单的全屏基于控制台的纯文本编辑器。模拟 Windows edit.com 的外观和感觉的东西将是完美的。
Specifically, I'm looking for;
具体来说,我正在寻找;
- A plain text editor.
- Console-based not GUI-based.
- Full-screen not command line.
- Menus to tell me what my options are. I don't want to have to find out and remember a complex set of keystrokes specific to that one application.
- An application that is in the default apt-get / yum repositories, or failing that is easy for a newbie to install.
- 纯文本编辑器。
- 基于控制台而不是基于 GUI。
- 全屏不是命令行。
- 菜单告诉我我的选择是什么。我不想找出并记住特定于该应用程序的一组复杂的击键。
- 默认 apt-get / yum 存储库中的应用程序,或者如果失败,新手很容易安装。
I'm using small-footprint versions of Ubuntu 904 and Centos 5.5.
我正在使用 Ubuntu 904 和 Centos 5.5 的小型版本。
edit:
编辑:
I suppose what I'm looking for is a console editor that conforms to the normal keystrokes used by GUI editors, ie. cursor keys to move up/down/left/right, pg-up / pg-down keys to move up and down a page, home / end keys to move to the start or end of a line etc etc. In other words, the keys we all use without thinking, in any GUI environment, be it Windows or Linux.
我想我正在寻找的是一个控制台编辑器,它符合 GUI 编辑器使用的正常击键,即。光标键向上/向下/向左/向右移动,pg-up/pg-down 键向上和向下移动页面,home/end 键移动到行的开头或结尾等。换句话说,在任何 GUI 环境中,无论是 Windows 还是 Linux,我们都会不假思索地使用键。
采纳答案by chronos
For the "GUI-shortcuts", try Diakonoseditor (it is in the repositories). One of the author's goals is actually to provide similar keyboard-shortcuts interface, so that ^O, ^S, ^W, F1 etc do exactly what you would expect from a GUI editor.
对于“GUI 快捷方式”,请尝试Diakonos编辑器(它在存储库中)。作者的目标之一实际上是提供类似的键盘快捷键界面,以便 ^O、^S、^W、F1 等完全符合您对 GUI 编辑器的期望。
Another good choice is jed(also in the repositories). It has emacs-like shortcuts, but it also has a menu row, allowing to visually navigate through commands (and the menu also does show the shortcuts). Jed also has some nice features for programmers. Overall, I like jed more than diakonos - give it a try.
另一个不错的选择是jed(也在存储库中)。它有类似 emacs 的快捷方式,但它也有一个菜单行,允许直观地浏览命令(菜单也确实显示了快捷方式)。Jed 还为程序员提供了一些不错的功能。总的来说,我比 diakonos 更喜欢 jed - 试一试。
It is also worth mentioning that almost always keyboard shortcuts are configurable. That is still an inconvenience (esp. when working with multiple PCs), but an option.
还值得一提的是,几乎总是键盘快捷键是可配置的。这仍然是一个不便(尤其是在使用多台 PC 时),而是一种选择。
回答by Erik
pico
or nano
should do fine - joe
is also pretty straight forward. vi/vim
and emacs
have somewhat of a learning curve, but both are worth the invested time.
pico
或者nano
应该做得很好 -joe
也很简单。vi/vim
并且emacs
有一定的学习曲线,但两者都值得投入时间。
回答by mpapis
I'm a big fan of mcedit
it is shipped with Midnight Commander a Total Commander like file manager, additionally in the package you get mcview
for viewing files with multiple options.
我是mcedit
它的忠实粉丝,它与 Midnight Commander 一起提供,是一个像文件管理器一样的 Total Commander,另外在您获得的包中,您可以mcview
使用多个选项查看文件。
回答by Nigel Alderton
mcedit
编辑
@mpapis I got mcedit going and learned a lot in the process. For the benefit of other linux newbies I would like to share what I learned.
@mpapis 我开始使用 mcedit 并在此过程中学到了很多东西。为了其他linux新手的利益,我想分享我学到的东西。
This is how I installed mcedit on my system which is a Centos 5.5 minimum build running in a VPS.
这就是我在我的系统上安装 mcedit 的方式,它是在 VPS 中运行的 Centos 5.5 最低版本。
Starting mcedit
启动 mcedit
To start mcedit from a console, do;
要从控制台启动 mcedit,请执行;
mcedit
If mcedit is installed it will start and your screen will look like the screenshot above. But if you get an error message like;
如果安装了 mcedit,它将启动,您的屏幕将与上面的屏幕截图类似。但是,如果您收到类似的错误消息;
No such file or directory
then you need to install mcedit.
那么你需要安装mcedit。
Installing mcedit
安装 mcedit
mcedit is part of a package called mc. To install mcedit you must install mc. To install mc do;
mcedit 是名为 mc 的软件包的一部分。要安装 mcedit,您必须安装 mc。安装 mc do;
apt-get install mc
If apt-get knows about mc, then you will be asked a question like;
如果 apt-get 知道 mc,那么你会被问到类似的问题;
After this operation, 17.4MB of additional disk space will be used.
Do you want to continue [Y/n]?
Go ahead and install it by pressing the 'y' key then then the 'enter' key.
继续并通过按“y”键然后按“enter”键来安装它。
But if you get an error message like;
但是,如果您收到类似的错误消息;
Package mc has no installation candidate
then apt-get doesn't know about mc, so you have to tell apt-get about mc. mc is stored in the universerepository. To tell apt-get about mc, you need to tell apt-get where the universerepository is. The universerepository is a popular and safe ubuntu repository.
那么 apt-get 不知道 mc,所以你必须告诉 apt-get 关于 mc。mc 存储在Universe存储库中。要告诉 apt-get 关于 mc,您需要告诉 apt-get Universe存储库在哪里。在宇宙资源库是一个受欢迎的和安全的Ubuntu的存储库。
Tell apt-get about the universe repository
告诉 apt-get 有关 Universe 存储库的信息
The /etc/apt/sources.list file tells apt-get what repositories are where. You can view sources.list by doing;
/etc/apt/sources.list 文件告诉 apt-get 哪些存储库在哪里。您可以通过执行查看sources.list;
more /etc/apt/sources.list
For apt-get to know about the universe repository, the sources.list file must contain the line;
要 apt-get 了解 Universe 存储库,sources.list 文件必须包含以下行;
deb http://archive.ubuntu.com/ubuntu/ jaunty universe
Add the above line to the sources.list file by doing;
通过执行将上述行添加到 sources.list 文件;
echo deb http://archive.ubuntu.com/ubuntu/ jaunty universe >> /etc/apt/sources.list
The ">>" means append the preceding text to the specified file.
“>>”表示将前面的文本附加到指定的文件中。
To check whether the above has worked, show sources.list by doing;
要检查上述是否有效,请通过执行显示 sources.list;
more /etc/apt/sources.list
If it worked, the last line of the file will be;
如果它有效,文件的最后一行将是;
deb http://us.archive.ubuntu.com/ubuntu/ jaunty universe
Now tell apt-get about the change you just made to the sources.list file by doing;
现在告诉 apt-get 您刚刚对 sources.list 文件所做的更改;
apt-get update
You should see;
你应该看到;
Reading package lists... Done
So you can now do;
所以你现在可以做;
apt-get install mc
Then run mcedit by doing;
然后通过执行运行 mcedit;
mcedit
And you should see the screenshot above.
您应该会看到上面的屏幕截图。