![我可以更改文件完成的显示方式吗?](https://linux22.com/image/117866/%E6%88%91%E5%8F%AF%E4%BB%A5%E6%9B%B4%E6%94%B9%E6%96%87%E4%BB%B6%E5%AE%8C%E6%88%90%E7%9A%84%E6%98%BE%E7%A4%BA%E6%96%B9%E5%BC%8F%E5%90%97%EF%BC%9F.png)
我可以通过执行以下操作来更有用地完成流程zstyle ':completion:*:processes' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
。有没有什么方法可以完成类似的文件完成操作,例如使用ls -l
或exa
之类的东西?
答案1
从洞穴探险zshall(1)
(对于zsh 5.4.2
,不知道何时添加此功能)人们可能会发现
file-list
This style controls whether files completed using the standard
builtin mechanism are to be listed with a long list similar to
ls -l. Note that this feature uses the shell module zsh/stat
for file information; this loads the builtin stat which will
replace any external stat executable. To avoid this the follow-
ing code can be included in an initialization file:
zmodload -i zsh/stat
disable stat
The style may either be set to a `true' value (or `all'), or one
of the values `insert' or `list', indicating that files are to
be listed in long format in all circumstances, or when attempt-
ing to insert a file name, or when listing file names without
attempting to insert one.
因此,使用这个,在最后一个命令的位置ls blah/
tab输入:
$ PS1='%% ' zsh -f
% autoload -U compinit && compinit
% zstyle ':completion:*' file-list all
% mkdir blah
% touch blah/{a,b,c}
% ls blah/
-rw-r--r-- 1 jhqdoe grp 0 Sep 10 08:36 a
-rw-r--r-- 1 jhqdoe grp 0 Sep 10 08:36 b
-rw-r--r-- 1 jhqdoe grp 0 Sep 10 08:36 c