Open nicoulaj opened 13 years ago
I'm very sorry. It seems that auto-fu needs some more coordination codes to play nice more with zsh-syntax-highlighting.
I will work on it.
I hope this happens soon; this looks like it would be cool to use if it weren't incompatible.
This is the thing stopping me from using auto fu. Any progress to report?
Hi! Thank you for your interest!
You can play with it in the branch thb
or pu
.
It may have some minor bugs, especially I don't have time to play it without zsh-syntax-highlighting environment. I will merge it into master if I'm sure it is in a good shape which do not break without zsh-syntax-highlighting.
I'm very sorry for the inconvenience.
Please note that both these branches other than master
will be
rewind sometime as you can see (as with git itself).
I can confirm that both of those branches work well with zsh-syntax-highlighting. Thank you very much! I will set it all up at work tomorrow so I can use it "in anger" and give it some real testing :) Thanks again!
I just tried both branches and they make zsh and the Terminal crash. Any progress on that please?
Hi @AzizLight, thank you very much for your interest.
Please show your zsh setup. I cannot reproduce any crashes here. I did this possibly simplest procedure to get it working.
% echo "PS1='%% '" >| .zshrc
% exec ${SHELL} ${SHELL_ARGS-} "$@"
% echo $ZSH_VERSION
5.0.2
% git clone -q -n https://github.com/hchbaw/auto-fu.zsh.git
% (cd auto-fu.zsh && git checkout -q origin/pu)
% git clone -q https://github.com/zsh-users/zsh-syntax-highlighting.git
% cat - <<'EOT' >> .zshrc
heredoc> autoload -Uz compinit; compinit
heredoc> . ./zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
heredoc> . ./auto-fu.zsh/auto-fu.zsh
heredoc> zle-line-init () auto-fu-init; zle -N zle-line-init
heredoc> EOT
% exec ${SHELL} ${SHELL_ARGS-} "$@"
% ls
-azfu-
ls lsb_release lscpu lsmod lspgpot
lsar lsblk lshal lsof lssu
lsattr lscp lsinitramfs lspci lsusb
In this example, I've got ls
at the command line is colored and completion choices are shown.
So it seems working.
Hi @hchbaw
Thanks for the fast answer. I should have read the README before posting a stupid comment, Sorry! I had forgotten to add the zle-line-init () auto-fu-init; zle -N zle-line-init
line to my .zshrc
...
However, there is still some odd behaviour. For instance, when I type l
it autocompletes to LANG=
and then if I type s
it completes to LANG=sk_SK
so I can't use ls
anymore... Any ideas on what I'm missing please?
Hi @AzizLight, thankyou reporting back.
Ugh, I have not heard such a wired behavior.
Theoretically, auto-fu.zsh
does the almost same thing that it just hits the TAB
after each input at the command line. So, it should help to do a same thing without auto-fu.zsh
; just enter an l
letter, then hit TAB
and watching the result could help to identify problems.
It seems to me that the first completion match has been actually automatically inserted on the command line.
It could help to see the completion system setup. If you don't mind, please show your zstyle -L ':completion:*'
.
Hi @hchbaw
Thanks a lot for you patience and your support :+1:
What you are saying makes a lot of sense. I am using zshuery
,
which is a drastically more lightweight version of oh-my-zsh
. When I press l<TAB>
without auto-fu
,
I see the same behaviour.
My ZSH skills are dire, but I think that's the snippet of code from zshuery
that sets up completion:
# Completion
load_completion() {
# http://www.reddit.com/r/commandline/comments/kbeoe/you_can_make_readline_and_bash_much_more_user/
# https://wiki.archlinux.org/index.php/Zsh
autoload -U compinit
fpath=($* $fpath)
fignore=(.DS_Store $fignore)
compinit -i
zmodload -i zsh/complist
setopt complete_in_word
setopt auto_remove_slash
unsetopt always_to_end
has_brew && compctl -K _gimme gimme
[[ -f ~/.ssh/known_hosts ]] && hosts=(`awk '{print $1}' ~/.ssh/known_hosts | tr ',' '\n' `)
[[ -f ~/.ssh/config ]] && hosts=($hosts `grep '^Host' ~/.ssh/config | sed s/Host\ // | egrep -v '^\*$'`)
[[ -f /var/lib/misc/ssh_known_hosts ]] && hosts=($hosts `awk -F "[, ]" '{print $1}' /var/lib/misc/ssh_known_hosts | sort -u`)
zstyle ':completion:*' insert-tab pending
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
highlights='${PREFIX:+=(#bi)($PREFIX:t)(?)*==31=1;32}':${(s.:.)LS_COLORS}}
highlights2='=(#bi) #([0-9]#) #([^ ]#) #([^ ]#) ##*($PREFIX)*==1;31=1;35=1;33=1;32=}'
zstyle -e ':completion:*' list-colors 'if [[ $words[1] != kill && $words[1] != strace ]]; then reply=( "'$highlights'" ); else reply=( "'$highlights2'" ); fi'
unset highlights
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*' squeeze-slashes true
zstyle ':completion:*' expand 'yes'
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric
zstyle ':completion:*:hosts' hosts $hosts
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path ./cache/
zstyle ':completion:*:cd:*' ignore-parents parent pwd
zstyle ':completion:*:mpg321:*' file-patterns '*.(mp3|MP3):mp3\ files *(-/):directories'
zstyle ':completion:*:ogg123:*' file-patterns '*.(ogg|OGG):ogg\ files *(-/):directories'
zstyle ':completion:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
zstyle ':completion:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
}
I also have this line in my .zshrc
:
# ...so that I can select the completions with the arrow
# keys after the first press of tab
zstyle ':completion:*:*:*:*:*' menu yes select
Hope it helps. I will investigate the problem myself as well.
Again, thanks a lot
Aziz
@hchbaw Thanks for your patience and your support! :+1:
With the help of guys in the #zsh
IRC channel on Freenode, I managed to fix the problem. I just removed the following line from my .zshrc
and it worked fine:
# ...so that I can select the completions with the arrow
# keys after the first press of tab
zstyle ':completion:*:*:*:*:*' menu yes select
Again thanks a lot :+1:
Aziz
I know this is a pretty old issue, and in fact one of the first, but I just wanted to confirm that this is still working on the latest versions of all of these plugins, with zsh-syntaxhighlighting, zsh-autocompletion, and this. worked perfectly when sourced and setup in the correct order in your zshrc. syntax first, autocompl, next and then auto-fu finally and perfect results. Great job on this.
No such luck here. :sob:
Loading zsh-syntax-highlighting before auto-fu (in both tbh
and pu
branches) gives me this error:
$ zsh -f
yantram% source bundle/1/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
yantram% source bundle/3/auto-fu.zsh
yantram% with-afu-zle-rebinding:10: command not found: afu-zle-aysce-install
-azfu-
Loading zsh-syntax-highlighting before auto-fu (in master
branch) gives me this error:
$ zsh -f
yantram% source bundle/1/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
yantram% source bundle/3/auto-fu.zsh
Cannot rebind self-insert: user:_zsh_highlight_widget_self-insert
Cannot rebind backward-delete-char: user:_zsh_highlight_widget_backward-delete-char
Cannot rebind backward-kill-word: user:_zsh_highlight_widget_backward-kill-word
Cannot rebind kill-line: user:_zsh_highlight_widget_kill-line
Cannot rebind kill-whole-line: user:_zsh_highlight_widget_kill-whole-line
Cannot rebind kill-word: user:_zsh_highlight_widget_kill-word
Cannot rebind magic-space: user:_zsh_highlight_widget_magic-space
yantram%
-azfu-
In contrast, loading auto-fu (in master
branch) by itself works correctly:
$ zsh -f
yantram% source bundle/3/auto-fu.zsh
yantram% z
-azfu-
zcat zegrep zformat zipdetails zjsdecode zmodload zsh
zcmp zeisstopnm zgrep zipgrep zle zmore zsh4
zcompile zenity zic zipinfo zle-line-init znew zsh5
zdiff zfgrep zip zipnote zless zparseopts zstyle
zdump zforce zipcloak zipsplit zlib-flate zregexparse
How did you make this work? :scream: Could you share your exact config files?
Definitely as soon as I am home and get a chance tonight. But did you follow the process in hchbaws comment? Try this:
as hchbaw stated above
git clone -q -n https://github.com/hchbaw/auto-fu.zsh.git
% (cd auto-fu.zsh && git checkout -q origin/pu)
% git clone -q https://github.com/zsh-users/zsh-syntax-highlighting.git
% cat - <<'EOT' >> .zshrc
heredoc> autoload -Uz compinit; compinit
heredoc> . ./zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
heredoc> . ./auto-fu.zsh/auto-fu.zsh
heredoc> zle-line-init () auto-fu-init; zle -N zle-line-init
heredoc> EOT
Finally restart zsh or simply source your zshrc.
You could also try this. Based on memory this was how my zshrc was setup.
source ~/zsh/dir/zsh-syntax-highlighting.zsh
autoload -Uz compinit; compinit
source ~/zsh/dir/auto-fu.zsh
zle-line-init () auto-fu-init; zle -N zle-line-init
Of coarse adjust accordingly to your directories. I checked out pu branch as well. I also used antigen to DL and load syntax-highlighting plugin as well as a bunch more. But the last three lines are how my zshrc looks at the very bottom. Try that.
@sunaku
here is my zshrc file
https://github.com/CJD14/dotfiles/blob/master/zshrc
I also added hchbaw's list-colors.zsh plugin as well to this and just got it working, so that's what you see at very bottom of file now.
Hi, Did you get auto-fu working with zsh-syntax-highlighting ? I tried activating both but it seems highlighting takes precedence over auto-fu. Do you need us to make some change to improve compatibility ?