个人工具

NanoHowto

来自Ubuntu中文

跳转至: 导航, 搜索
翻译人员:speme、luojie-dune

如何使用nano

介绍

这里提供了nano的一些基本信息,并提供相关站点的链接。

nano是什么?

Nano是一个简单的没有花梢及华丽效果的文本编辑器。Nano与文本编辑器pico (pine邮件客户端自带) 几乎完全相同。Nano在做简单文本文件编辑时相当不错。但不要希望用它来做复杂的编辑工作。其它的编辑器诸如"emacs"、"vim"、"gedit"都提供了文本着色以及自动文本格式化等更先进的功能,而Nano只做最基本的编辑操作。

如何运行nano

开始一次常规nano会话

bash:~$ nano -w <文件名>


这将打开<文件名>所指的文件并进入编辑状态。你可以新建一个文件或是编辑一个已经存在的文件。"-w"参数用来取消文本自动换行。文本自动换行在打开某些特殊格式的文件时可能导致某些问题。

如何使用nano

The basic controls for nano are shown on the bottom of the screen. The <sup> mark means to hold the control key and press the letter following it. For example, </sup>X (quit) means hold control and press X. To see more nano commands, hit control-G. On the help screen, M- before a letter means to hold down Meta or Alt and press it. So M-M (enable mouse support) means hold alt and press M. nano uses some odd conventions: nano的基本操作显示在屏幕的下方。<sup>的意思是按下ctrl键的同时按下后面跟着的键。例如,</sup>X(退出)的意思是在按ctrl键的同时按X键。要知道更多的nano快捷键,可以敲control-G来获取相关信息。在帮助屏幕中,M-显示在某个字符的前面意味着在按META键或是ALT键的同时按下随后的键。就像M-M(提供鼠标支持)表示按ALT时按M键。nano使用的快捷键中比较奇怪的有:

  • WriteOut (control-O) - 保存
  • Cur Pos (control-C) - tells you what line and letter the cursor is on告诉你光标在哪一行的哪个位置
  • Read File (control-R) - inserts the contents of another file插入其它文件的内容
  • pressing Alt-F after control-R behaves just like an Open command in other text editors.在其他文本编辑器中表现象一个开放命令
  • Where Is (control-W) - searches for some text in the file在文件中查找文本

帮助中非常好地解释众多使用方法。请按CTRL-G来阅读。

链接