I cd to a directory with a few files and then "ll ma**" and hit tab. Then I get the error in the subject line. I use fzf on most of my machines, but this one is a limited shell access on a shared host for one of my websites (arvixe) The install seemed to go ok, and oddly it seems to work from vim - but not from zsh.
Which version of zsh are you running? Check if the following code works there.
FOO="BARBAZ"
echo ${FOO:0:-2}
# BARB
Interesting...!
➜ ~ ★ zsh
--version
[0] 0:11:13
zsh 4.3.11 (x86_64-redhat-linux-gnu)
➜ ~ ★
FOO="BARBAZ"
[0] 0:11:17
➜ ~ ★ echo
${FOO:0:-2}
[0] 0:11:49
zsh: invalid length: -2
➜ ~ ★ #
BARB [1]
0:11:56
On 09/19/2016 10:42 PM, Junegunn Choi wrote:
Which version of zsh are you running? Check if the following code
works there.FOO="BARBAZ"
echo ${FOO:0:-2}BARB
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/junegunn/fzf/issues/665#issuecomment-248193447,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFjOQYFAIqHrz42-l2fP6IWZ9S7X2BPXks5qr1YXgaJpZM4KBLhN.
[email protected] PRIVACY, spread the word
public_key: http://amow.com/chris.txt
fingerprint: C242 719D 3252 6309 F5F5 0CC4 EC6B F58D BC2D 2A8A
Yeah, I haven't tested the code with the older versions of zsh. If you're interested in making it work with older versions, please feel free to send me a pull request. Thanks.
Ok, I think that version of zsh was before 2012 (!) so I'll probably just update it. Thank you sir!
For anyone else like me who is stuck with old RHEL6 deployments and zsh-4.3.x, I fixed this with this change:
--- .fzf.zsh.orig 2017-05-05 09:48:08.728843778 -0700
+++ .fzf.zsh 2017-05-05 09:47:36.909289508 -0700
@@ -173,8 +173,8 @@
elif [ ${#tokens} -gt 1 -a "$tail" = "$trigger" ]; then
d_cmds=(${=FZF_COMPLETION_DIR_COMMANDS:-cd pushd rmdir})
- [ -z "$trigger" ] && prefix=${tokens[-1]} || prefix=${tokens[-1]:0:-${#trigger}}
- [ -z "${tokens[-1]}" ] && lbuf=$LBUFFER || lbuf=${LBUFFER:0:-${#tokens[-1]}}
+ [ -z "$trigger" ] && prefix=${tokens[-1]} || prefix=${tokens[-1]%${trigger}}
+ [ -z "${tokens[-1]}" ] && lbuf=$LBUFFER || lbuf=${LBUFFER%${tokens[-1]}}
if eval "type _fzf_complete_${cmd} > /dev/null"; then
eval "prefix=\"$prefix\" _fzf_complete_${cmd} \"$lbuf\""
I haven't read through the code extensively or thought through the subtleties that my version might affect, but it seems to be working fine so far with the stock ** trigger. YMMV
@goodell Thanks! That worked for me. Just to clarify, I made this edit in shell/completion.zsh, and fzf seems to be working for me again.
Most helpful comment
For anyone else like me who is stuck with old RHEL6 deployments and zsh-4.3.x, I fixed this with this change:
I haven't read through the code extensively or thought through the subtleties that my version might affect, but it seems to be working fine so far with the stock
**trigger. YMMV