2017-08-04 3 views
0

nach dem Dokument, !! sollte auf den letzten Befehl erweitern, wenn Sie <tab> danach drücken. Dies ist jedoch nicht der Fall für mein Setup (ich habe standardmäßig oh-my-zsh verwendet). Hier ein Beispiel: $ echo 1 1 $ echo 2 2 $ !!<tab> $ echo 1 Geschichte Erweiterung in zsh

Darüber hinaus erweitert !# nicht, was in der aktuellen Zeile eingegeben werden. Stattdessen expandiert es bis zum letzten Befehl $ echo 1 1 $ echo 2 2 $ echo 3 !#<tab> $ echo 3 echo 2

Gibt es eine Option steuert dies?

Antwort

0

Ich habe die Standard-oh-my-zsh Abschlusseinstellungen auf github und es sieht aus wie Parameter Erweiterung ist nicht standardmäßig aktiviert. Gemäß oh-my-zshdocumentation sollten alle Überschreibungen in das Verzeichnis custom/ in Dateien mit der Endung *.zsh gehen. Erste Parameter Expansion Arbeit sollte so einfach sein wie fallen dort eine Datei mit etwas wie folgt aus:

zstyle ':completion:*' completer _expand _complete 

Die completer Funktion Sie suchen _expand genannt wird, hier ist das, was man zshcompsys dazu zu sagen hat:

_expand 

This completer function does not really perform completion, but instead 
checks if the word on the command line is eligible for 
expansion and, if it is, gives detailed control over how this 
expansion is done. For this to happen, the completion system needs to 
be invoked with complete-word, not expand-or-complete (the default 
binding for TAB), as otherwise the string will be expanded by the 
shell's internal mechanism before the completion system is started. 
Note also this completer should be called before the _complete 
completer function. 

The tags used when generating expansions are all-expansions for the 
string containing all possible expansions, expansions when adding the 
possible expansions as single matches and original when adding the 
original string from the line. The order in which these strings are 
generated, if at all, can be controlled by the group-order and 
tag-order styles, as usual. 

The format string for all-expansions and for expansions may contain 
the sequence '%o' which will be replaced by the original string from 
the line. 

The kind of expansion to be tried is controlled by the substitute, 
glob and subst-globs-only styles. 

It is also possible to call _expand as a function, in which case the 
different modes may be selected with options: -s for substitute, -g 
for glob and -o for subst-globs-only.