Tcsh中的“自动更正”参数?

问题描述 投票:0回答:1

无论如何在Tcsh中编写类似这样的东西,当你按Tab键时参数会被改变。类似于在iOS / Android上它如何自动完成“在我的路上!”的“omw”。

注意:█是文本光标位置

> script.py imgPath█

* [按Tab键] *

> script.py this/example/file/path/LONG_IMAGE_NAME_█

然后从那里,因为我有完整的路径,我可以使用选项卡执行正常的文件名自动完成。例如,如果我有一个名为LONG_IMAGE_NAME_SCREENSHOT_635.jpg的文件,我可以在agrument的末尾添加S并按正常方式点击标签:

> script.py this/example/file/path/LONG_IMAGE_NAME_S█

* [按Tab键] *

> script.py this/example/file/path/LONG_IMAGE_NAME_SCREENSHOT_635.jpg█

文件链接不适用于此,因为它不添加文件名的开头,别名因文件名也不起作用。

shell csh tcsh
1个回答
0
投票

来自tcsh(1)

       > set local = /usr/local
       > ls $lo[tab]
       > ls $local/[^D]
       bin/ etc/ lib/ man/ src/
       > ls $local/

   Note  that  variables  can also be expanded explicitly with the expand-
   variables editor command.

因此,如示例所示,您可以设置imgPath变量。

expand-variables默认映射到^X$(按^X,然后$),并将$imgPath扩展到它拥有的任何值。

据我所知,没有办法在tcsh中的tab上扩展$imgPath

© www.soinside.com 2019 - 2024. All rights reserved.