ilk*_*chu 34
许多编辑器支持命令行上的选项直接跳转到NNN行。幸运的是,如果给定的行号超过文件末尾,它似乎会跳到末尾,因此您可以使用以下内容:+NNNnano
nano +999999 file
Run Code Online (Sandbox Code Playgroud)
这也适用于joe,但不适用于例如less或 VIM,他们抱怨超过 EOF。(至少是我系统上的那些。less +G file并vi +$ file在其中工作。)
当然,类似的东西$EDITOR +$(wc -l file) file可能在大多数编辑器中都可以使用,但这有点愚蠢,并且涉及两次读取文件。
小智 24
来自内置 Nano 帮助 ( ^G):
M-\ (^Home) Go to the first line of the file
M-/ (^End) Go to the last line of the file
Run Code Online (Sandbox Code Playgroud)
因此,按Alt+\转到第一行或按Alt+/转到最后一行。
/靠近键盘底部和\靠近顶部的方式。如果您想要一个命令,您可以在您的.bashrc或.bash_aliases使用以下行数中编写一个函数wc:
M-\ (^Home) Go to the first line of the file
M-/ (^End) Go to the last line of the file
Run Code Online (Sandbox Code Playgroud)
现在只需键入nano-end filename即可将文件打开到最后一行!
Ctrl+End正在工作,如果您有最新(编译)版本的nano编辑器。
如果你不知道怎么做,你可以阅读Compiling Nano editor with options
请注意,在较新的系统中,例如基于 Ubuntu 18.04,已经有这样的版本。
从变更日志:
...使 ^Home 和 ^End 转到文件的开头和结尾(在支持这些按键的终端上)...
我没有安装 PuTTY,这里我们必须依赖其他声明,这些组合键在 Windows 10 + PuTTY + SSH + nano > 2.8.1 中不起作用。
另一方面,我有 Cygwin,Windows 10 + Cygwin + SSH + nano > 2.8.1 工作正常。
| 归档时间: |
|
| 查看次数: |
158660 次 |
| 最近记录: |