I did install for ubuntu 14.04 using this command
$ sudo add-apt-repository ppa:aacebedo/fasd
$ sudo apt-get update
$ sudo apt-get install fasd
Then I tried to execute the example, but it shows no result
$ touch example.txt
$ fasd example
$
Did I install it wrongly? Or the command I execute is not correct?
mine has the same problem, it just not working for some time.
Have you included the initialization code (eval "$(fasd --init auto)"
) in your shell's rc (e.g. your .bashrc
or .zshrc
) and run a new instance of your shell?
Yes I did, I could be able to relocate the output log yet tried the general init code eval "$(fasd --init auto)", after start another zsh session or restart iterm and typing fasd/ fasd -a/, it just shows nothing.
Here’s a snippet about what’s is the log:
(eval):2: command not found: fasd
COMMAND -c -tn
DEFAULT -f -tn
FIRST
COMMAND -c -tn
DEFAULT -f -tn
FIRST
fasd -U -V fasd -K _fasd_zsh_cmd_complete -x 'C[-1,-e] , s[-] n[1,e]' -c - 'c[-1,-A][-1,-D]' -f
fasd_cd -U -V fasd -K _fasd_zsh_cmd_complete -x 'C[-1,-e] , s[-] n[1,e]' -c - 'c[-1,-A][-1,-D]' -f
COMMAND -c -tn
DEFAULT -f -tn
FIRST
I even tried "/usr/local/bin/fasd -a" and nothing shows up, I just have no idea why it cannot find the command since my $PATH variable has /usr/local/bin.
On Dec 18, 2017, at 08:15, Euan Kemp <[email protected] notifications@github.com> wrote:
Have you included the initialization code (eval "$(fasd --init auto)") in your shell's rc (e.g. your .bashrc or .zshrc) and run a new instance of your shell?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/clvv/fasd/issues/117#issuecomment-352297827, or mute the thread https://github.com/notifications/unsubscribe-auth/ADKNgnXANOaoBoWsmKj82G3Cfuiln8yrks5tBa6jgaJpZM4QxsoO.
By the way, the only thing works is "fasd -h" which confirms at least zsh can find out where the command is, so I’ve no idea why the loca cannot find the command.
On Dec 18, 2017, at 09:18, Xiao-Meng Wang <[email protected] xiaomengwong@gmail.com> wrote:
Yes I did, I could be able to relocate the output log yet tried the general init code eval "$(fasd --init auto)", after start another zsh session or restart iterm and typing fasd/ fasd -a/, it just shows nothing.
Here’s a snippet about what’s is the log:
(eval):2: command not found: fasd
COMMAND -c -tn
DEFAULT -f -tn
FIRST
COMMAND -c -tn
DEFAULT -f -tn
FIRST
fasd -U -V fasd -K _fasd_zsh_cmd_complete -x 'C[-1,-e] , s[-] n[1,e]' -c - 'c[-1,-A][-1,-D]' -f
fasd_cd -U -V fasd -K _fasd_zsh_cmd_complete -x 'C[-1,-e] , s[-] n[1,e]' -c - 'c[-1,-A][-1,-D]' -f
COMMAND -c -tn
DEFAULT -f -tn
FIRSTI even tried "/usr/local/bin/fasd -a" and nothing shows up, I just have no idea why it cannot find the command since my $PATH variable has /usr/local/bin.
On Dec 18, 2017, at 08:15, Euan Kemp <[email protected] notifications@github.com> wrote:
Have you included the initialization code (eval "$(fasd --init auto)") in your shell's rc (e.g. your .bashrc or .zshrc) and run a new instance of your shell?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/clvv/fasd/issues/117#issuecomment-352297827, or mute the thread https://github.com/notifications/unsubscribe-auth/ADKNgnXANOaoBoWsmKj82G3Cfuiln8yrks5tBa6jgaJpZM4QxsoO.
The same problem, my env is Ubuntu subsystem on Windows 10
Please provide a minimal reproduction.
It may help to change the fasd init code to the following for debugging purposes:
set -x
eval "$(fasd --init auto)"
set +x
Or to include set -x
before the command that errors out.
I'm unable to reproduce these issues. Here are the steps I can run in order to have a working fasd installation under bash (which, if you wish to check work on your system, can narrow down whether the issue lies in your bashrc configuration or elsewhere):
$ testhome=$(mktemp -d)
$ mkdir -p ${testhome}/bin
$ curl -sSL -o "${testhome}/bin/fasd" https://raw.githubusercontent.com/clvv/fasd/master/fasd
$ chmod +x ${testhome}/bin/fasd
$ cat > "${testhome}/.bashrc" <<EOF
export PATH=$PATH:${testhome}/bin
# Ensure history is not blank; fasd grabs commands to process from history
# (https://github.com/clvv/fasd/blob/90b531a5daaa545c74c7d98974b54cbdb92659fc/fasd#L127-L130)
# and, if history is empty, will error out
echo "echo hello world" >> ~/.bash_history
eval "\$(fasd --init auto)"
EOF
$ env -i HOME=${testhome} bash
$ cd ~/bin
$ cd ~/bin
$ cd ~
$ z bin && pwd
$ touch example.txt
$ fasd example
Note: the above must be run under an interactive shell for fasd to work, not a bash script. With only minor modifications, (replacing 'bash' with 'zsh') the above should work for zsh too.
The above for me works as I'd expect (printing out /tmp/tmp.zKxt6nvlxj/bin
and 6 /tmp/tmp.zKxt6nvlxj/bin/example.txt
).
Please provide any of the following if you can:
fasd example
or fasd --init
after applying set -x
to the shell)Hi Euan for the instruction, here’s some output that I’ve got.
first part, I’ve no idea what’s going on:
This is in zsh
~ ➤ set -x git:master*
eval "$(fasd --init auto)"
set +x
+zsh:2> fasd --init auto
+zsh:2> eval $'{ if [ "$ZSH_VERSION" ] && compctl; then # zsh\n eval "$(fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install \n zsh-wcomp zsh-wcomp-install)"\n elif [ "$BASH_VERSION" ] && complete; then # bash\n eval "$(fasd --init posix-alias bash-hook bash-ccomp bash-ccomp-install)"\n else # posix shell\n eval "$(fasd --init posix-alias posix-hook)"\n fi\n} >> "/Users/Administrator/.config/fasd/fasd.log" 2>&1'
+(eval):1> [ 5.3 ']'
+(eval):1> compctl
+(eval):2> fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install
+(eval):2> eval $'alias a=\'fasd -a\'\nalias s=\'fasd -si\'\nalias sd=\'fasd -sid\'\nalias sf=\'fasd -sif\'\nalias d=\'fasd -d\'\nalias f=\'fasd -f\'\n# function to execute built-in cd\nfasd_cd() {\n if [ $# -le 1 ]; then\n fasd "$@"\n else\n local _fasd_ret="$(fasd -e \'printf %s\' "$@")"\n [ -z "$_fasd_ret" ] && return\n [ -d "$_fasd_ret" ] && cd "$_fasd_ret" || printf %s\n "$_fasd_ret"\n fi\n}\nalias z=\'fasd_cd -d\'\nalias zz=\'fasd_cd -d -i\'\n\n# add zsh hook\n_fasd_preexec() {\n { eval "fasd --proc $(fasd --sanitize $1)"; } >> "/Users/Administrator/.config/fasd/fasd.log" 2>&1\n}\nautoload -Uz add-zsh-hook\nadd-zsh-hook preexec _fasd_preexec\n\n# zsh command mode completion\n_fasd_zsh_cmd_complete() {\n local compl\n read -c compl\n (( $+compstate )) && compstate[insert]=menu # no expand if compsys loaded\n reply=(${(f)"$(fasd --complete "$compl")"})\n}\n\n# enbale command mode completion\ncompctl -U -K _fasd_zsh_cmd_complete -V fasd -x \'C[-1,-e],s[-]n[1,e]\' -c - \n \'c[-1,-A][-1,-D]\' -f -- fasd fasd_cd\n\n(( $+functions[compdef] )) && {\n # zsh word mode completion\n _fasd_zsh_word_complete() {\n [ "$2" ] && local _fasd_cur="$2"\n [ -z "$_fasd_cur" ] && local _fasd_cur="${words[CURRENT]}"\n local fnd="${_fasd_cur//,/ }"\n local typ=${1:-e}\n fasd --query $typ "$fnd" 2>> "/Users/Administrator/.config/fasd/fasd.log" | \n sort -nr | sed \'s/^[^ ][ ]//\' | while read -r line; do\n compadd -U -V fasd "$line"\n done\n compstate[insert]=menu # no expand\n }\n _fasd_zsh_word_complete_f() { _fasd_zsh_word_complete f ; }\n _fasd_zsh_word_complete_d() { _fasd_zsh_word_complete d ; }\n _fasd_zsh_word_complete_trigger() {\n local _fasd_cur="${words[CURRENT]}"\n eval $(fasd --word-complete-trigger _fasd_zsh_word_complete $_fasd_cur)\n }\n # define zle widgets\n zle -C fasd-complete complete-word _generic\n zstyle \':completion:fasd-complete:\' completer _fasd_zsh_word_complete\n zstyle \':completion:fasd-complete:\' menu-select\n\n zle -C fasd-complete-f complete-word _generic\n zstyle \':completion:fasd-complete-f:\' completer _fasd_zsh_word_complete_f\n zstyle \':completion:fasd-complete-f:\' menu-select\n\n zle -C fasd-complete-d complete-word _generic\n zstyle \':completion:fasd-complete-d:\' completer _fasd_zsh_word_complete_d\n zstyle \':completion:fasd-complete-d:\' menu-select\n}\n\n(( $+functions[compdef] )) && {\n # enable word mode completion\n orig_comp="$(zstyle -L \':completion:*\' completer 2>> "/Users/Administrator/.config/fasd/fasd.log")"\n if [ "$orig_comp" ]; then\n case $orig_comp in\n *_fasd_zsh_word_complete_trigger);;\n ) eval "$orig_comp _fasd_zsh_word_complete_trigger";;\n esac\n else\n zstyle \':completion:\' completer _complete _fasd_zsh_word_complete_trigger\n fi\n unset orig_comp\n}'
+(eval):1> alias 'a=fasd -a'
+(eval):2> alias 's=fasd -si'
+(eval):3> alias 'sd=fasd -sid'
+(eval):4> alias 'sf=fasd -sif'
+(eval):5> alias 'd=fasd -d'
+(eval):6> alias 'f=fasd -f'
+(eval):17> alias 'z=fasd_cd -d'
+(eval):18> alias 'zz=fasd_cd -d -i'
+(eval):24> autoload -Uz add-zsh-hook
+(eval):25> add-zsh-hook preexec _fasd_preexec
+zsh:3> set +x
second part, I cannot write the example file so I changed to root and in this minimal env, fasd works. I did not create the .bashrc file yet.
bash-3.2$ sudo su
Password:
sh-3.2# testhome=$(mktemp -d)
sh-3.2# mkdir -p ${testhome}/bin
sh-3.2# cd ${testhome}/bin
sh-3.2# ls
sh-3.2# pwd
/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.SFwFn0r6/bin
sh-3.2# curl -sSL -o "${testhome}/bin/fasd" https://raw.githubusercontent.com/clvv/fasd/master/fasd;chmod https://raw.githubusercontent.com/clvv/fasd/master/fasd;chmod +x ${testhome}/bin/fasd;
sh-3.2# ls -al
total 40
drwxr-xr-x 3 root wheel 96 Dec 28 16:51 .
drwx------ 3 root wheel 96 Dec 28 16:50 ..
-rwxr-xr-x 1 root wheel 20195 Dec 28 16:51 fasd
bash-3.2# eval "$(./bin/fasd --init auto)"
bash-3.2# fasd
bash-3.2# ls
.viminfo bin example.txt
bash-3.2# echo "echo hello world" >> ~/.bash_history
bash-3.2# ls
.bash_history .viminfo bin example.txt
bash-3.2# export PATH=$PATH:${testhome}/bin
bash-3.2# ls
.bash_history .fasd .viminfo bin example.txt
bash-3.2# v .fasd
bash: v: command not found
bash-3.2# cat .fasd
/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.SFwFn0r6/.fasd|1|1514451952
bash-3.2# ./bin/fasd
12 /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.SFwFn0r6/.fasd
bash-3.2# ./bin/fasd example
bash-3.2# rm example.txt
bash-3.2# touch example.txt
bash-3.2# ./bin/fasd example
6 /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.SFwFn0r6/example.txt
On Dec 28, 2017, at 02:37, Euan Kemp <[email protected] notifications@github.com> wrote:
Please provide a minimal reproduction.
It may help to change the fasd init code to the following for debugging purposes:
set -x
eval "$(fasd --init auto)"
set +x
Or to include set -x before the command that errors out.I'm unable to reproduce these issues. Here are the steps I can run in order to have a working fasd installation under bash (which, if you wish to check work on your system, can narrow down whether the issue lies in your bashrc configuration or elsewhere):
$ testhome=$(mktemp -d)
$ mkdir -p ${testhome}/bin
$ curl -sSL -o "${testhome}/bin/fasd" https://raw.githubusercontent.com/clvv/fasd/master/fasd https://raw.githubusercontent.com/clvv/fasd/master/fasd
$ chmod +x ${testhome}/bin/fasd$ cat > "${testhome}/.bashrc" <
export PATH=$PATH:${testhome}/bin Ensure history is not blank; fasd grabs commands to process from history
(https://github.com/clvv/fasd/blob/90b531a5daaa545c74c7d98974b54cbdb92659fc/fasd#L127-L130 https://github.com/clvv/fasd/blob/90b531a5daaa545c74c7d98974b54cbdb92659fc/fasd#L127-L130)
and, if history is empty, will error out
echo "echo hello world" >> ~/.bash_history
eval "$(fasd --init auto)"
EOF$ env -i HOME=${testhome} bash
$ cd ~/bin
$ cd ~/bin
$ cd ~$ z bin && pwd
$ touch example.txt
$ fasd example
Note: the above must be run under an interactive shell for fasd to work, not a bash script. With only minor modifications, the above should work for zsh too.The above for me works as I'd expect (printing out /tmp/tmp.zKxt6nvlxj/bin and 6 /tmp/tmp.zKxt6nvlxj/bin/example.txt).
Please provide any of the following if you can:
more details about what's breaking (e.g. the output of fasd example or fasd --init after applying set -x to the shell)
Whether you can reproduce it in a minimal environment like the above.
An actual minimal reproduction that isn't just "on my machine it doesn't work"
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/clvv/fasd/issues/117#issuecomment-354156542, or mute the thread https://github.com/notifications/unsubscribe-auth/ADKNgl5x1H3BscF4Pa3-fIjkOr9WFjjWks5tEo53gaJpZM4QxsoO.https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png https://github.com/clvv/fasd https://raw.githubusercontent.com/clvv/fasd/master/fasd/r/n$ https://github.com/clvv/fasd/blob/90b531a5daaa545c74c7d98974b54cbdb92659fc/fasd#L127-L130 https://github.com/clvv/fasd/issues/117#issuecomment-354156542
My zsh init code is shown as follows:
fasd_cache="$HOME/.config/fasd/fasd-init-zsh"
if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
fasd --init posix-alias posix-hook zsh-hook zsh-ccomp zsh-ccomp-install zsh-ccomp zsh-ccomp-install >| "$fasd_cache"
fi
source "$fasd_cache"
unset fasd_cache
Where the fasd-init-zsh is:
fasd ➤ cat fasd-init-zsh git:master*
alias a='fasd -a'
alias s='fasd -si'
alias sd='fasd -sid'
alias sf='fasd -sif'
alias d='fasd -d'
alias f='fasd -f'
fasd_cd() {
if [ $# -le 1 ]; then
fasd "$@"
else
local _fasd_ret="$(fasd -e 'printf %s' "$@")"
[ -z "$_fasd_ret" ] && return
[ -d "$_fasd_ret" ] && cd "$_fasd_ret" || printf %s\n "$_fasd_ret"
fi
}
alias z='fasd_cd -d'
alias zz='fasd_cd -d -i'
_fasd_prompt_func() {
eval "fasd --proc $(fasd --sanitize $(history 1 | \
sed "s/^[ ][0-9][ ]*//"))" >> "/Users/Administrator/.config/fasd/fasd.log" 2>&1
}
case $PROMPT_COMMAND in
_fasd_prompt_func) ;;
*) PROMPT_COMMAND="_fasd_prompt_func;$PROMPT_COMMAND";;
esac
_fasd_bash_cmd_complete() {
# complete command after "-e"
local cur=${COMP_WORDS[COMP_CWORD]}
[[ ${COMP_WORDS[COMP_CWORD-1]} == -e ]] && \
COMPREPLY=( $(compgen -A command $cur) ) && return
# complete using default readline complete after "-A" or "-D"
case ${COMP_WORDS[COMP_CWORD-1]} in
-A|-D) COMPREPLY=( $(compgen -o default $cur) ) && return;;
esac
# get completion results using expanded aliases
local RESULT=$( fasd --complete "$(alias -p $COMP_WORDS \
2>> "/Users/Administrator/.config/fasd/fasd.log" | sed -n "\$s/^.'\(.\)'/\1/p")
${COMP_LINE# }" | while read -r line; do
quote_readline "$line" 2>/dev/null || \
printf %q "$line" 2>/dev/null && \
printf \n
done)
local IFS=$'\n'; COMPREPLY=( $RESULT )
}
_fasd_bash_hook_cmd_complete() {
for cmd in $*; do
complete -F _fasd_bash_cmd_complete $cmd
done
}
_fasd_bash_hook_cmd_complete fasd a s d f sd sf z zz
In the fasd.log, it mostly talks about:
(eval):2: command not found: fasd
COMMAND -c -tn
DEFAULT -f -tn
FIRST
COMMAND -c -tn
DEFAULT -f -tn
FIRST
COMMAND -c -tn
DEFAULT -f -tn
FIRST
(eval):2: command not found: fasd
COMMAND -c -tn
DEFAULT -f -tn
FIRST
(eval):2: command not found: fasd
COMMAND -c -tn
DEFAULT -f -tn
FIRST
(eval):2: command not found: fasd
COMMAND -c -tn
DEFAULT -f -tn
FIRST
COMMAND -c -tn
DEFAULT -f -tn
FIRST
COMMAND -c -tn
DEFAULT -f -tn
FIRST
COMMAND -c -tn
DEFAULT -f -tn
FIRST
COMMAND -c -tn
But when I type fasd -h, it is working:
~ ➤ fasd -h git:master*
fasd [options] [query ...]
[f|a|s|d|z] [opions] [query ...]
options:
-s list paths with scores
-l list paths without scores
-i interactive mode
-e
-b
-B
-a match files and directories
-d match directories only
-f match files only
-r match by rank only
-t match by recent access only
-R reverse listing order
-h show a brief help message
-[0-9] select the nth entry
fasd [-A|-D] [paths ...]
-A add paths
-D delete paths
~ ➤ git:master*
On Dec 28, 2017, at 17:15, Xiao-Meng Wang
xiaomengwong@gmail.com> wrote: Hi Euan for the instruction, here’s some output that I’ve got.
first part, I’ve no idea what’s going on:
This is in zsh~ ➤ set -x git:master*
eval "$(fasd --init auto)"
set +x+zsh:2> fasd --init auto
+zsh:2> eval $'{ if [ "$ZSH_VERSION" ] && compctl; then # zsh\n eval "$(fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install \n zsh-wcomp zsh-wcomp-install)"\n elif [ "$BASH_VERSION" ] && complete; then # bash\n eval "$(fasd --init posix-alias bash-hook bash-ccomp bash-ccomp-install)"\n else # posix shell\n eval "$(fasd --init posix-alias posix-hook)"\n fi\n} >> "/Users/Administrator/.config/fasd/fasd.log" 2>&1'
+(eval):1> [ 5.3 ']'
+(eval):1> compctl
+(eval):2> fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install
+(eval):2> eval $'alias a=\'fasd -a\'\nalias s=\'fasd -si\'\nalias sd=\'fasd -sid\'\nalias sf=\'fasd -sif\'\nalias d=\'fasd -d\'\nalias f=\'fasd -f\'\n# function to execute built-in cd\nfasd_cd() {\n if [ $# -le 1 ]; then\n fasd "$@"\n else\n local _fasd_ret="$(fasd -e \'printf %s\' "$@")"\n [ -z "$_fasd_ret" ] && return\n [ -d "$_fasd_ret" ] && cd "$_fasd_ret" || printf %s\n "$_fasd_ret"\n fi\n}\nalias z=\'fasd_cd -d\'\nalias zz=\'fasd_cd -d -i\'\n\n# add zsh hook\n_fasd_preexec() {\n { eval "fasd --proc $(fasd --sanitize $1)"; } >> "/Users/Administrator/.config/fasd/fasd.log" 2>&1\n}\nautoload -Uz add-zsh-hook\nadd-zsh-hook preexec _fasd_preexec\n\n# zsh command mode completion\n_fasd_zsh_cmd_complete() {\n local compl\n read -c compl\n (( $+compstate )) && compstate[insert]=menu # no expand if compsys loaded\n reply=(${(f)"$(fasd --complete "$compl")"})\n}\n\n# enbale command mode completion\ncompctl -U -K _fasd_zsh_cmd_complete -V fasd -x \'C[-1,-e],s[-]n[1,e]\' -c - \n \'c[-1,-A][-1,-D]\' -f -- fasd fasd_cd\n\n(( $+functions[compdef] )) && {\n # zsh word mode completion\n _fasd_zsh_word_complete() {\n [ "$2" ] && local _fasd_cur="$2"\n [ -z "$_fasd_cur" ] && local _fasd_cur="${words[CURRENT]}"\n local fnd="${_fasd_cur//,/ }"\n local typ=${1:-e}\n fasd --query $typ "$fnd" 2>> "/Users/Administrator/.config/fasd/fasd.log" | \n sort -nr | sed \'s/^[^ ][ ]//\' | while read -r line; do\n compadd -U -V fasd "$line"\n done\n compstate[insert]=menu # no expand\n }\n _fasd_zsh_word_complete_f() { _fasd_zsh_word_complete f ; }\n _fasd_zsh_word_complete_d() { _fasd_zsh_word_complete d ; }\n _fasd_zsh_word_complete_trigger() {\n local _fasd_cur="${words[CURRENT]}"\n eval $(fasd --word-complete-trigger _fasd_zsh_word_complete $_fasd_cur)\n }\n # define zle widgets\n zle -C fasd-complete complete-word _generic\n zstyle \':completion:fasd-complete:\' completer _fasd_zsh_word_complete\n zstyle \':completion:fasd-complete:\' menu-select\n\n zle -C fasd-complete-f complete-word _generic\n zstyle \':completion:fasd-complete-f:\' completer _fasd_zsh_word_complete_f\n zstyle \':completion:fasd-complete-f:\' menu-select\n\n zle -C fasd-complete-d complete-word _generic\n zstyle \':completion:fasd-complete-d:\' completer _fasd_zsh_word_complete_d\n zstyle \':completion:fasd-complete-d:\' menu-select\n}\n\n(( $+functions[compdef] )) && {\n # enable word mode completion\n orig_comp="$(zstyle -L \':completion:*\' completer 2>> "/Users/Administrator/.config/fasd/fasd.log")"\n if [ "$orig_comp" ]; then\n case $orig_comp in\n *_fasd_zsh_word_complete_trigger);;\n ) eval "$orig_comp _fasd_zsh_word_complete_trigger";;\n esac\n else\n zstyle \':completion:\' completer _complete _fasd_zsh_word_complete_trigger\n fi\n unset orig_comp\n}'
+(eval):1> alias 'a=fasd -a'
+(eval):2> alias 's=fasd -si'
+(eval):3> alias 'sd=fasd -sid'
+(eval):4> alias 'sf=fasd -sif'
+(eval):5> alias 'd=fasd -d'
+(eval):6> alias 'f=fasd -f'
+(eval):17> alias 'z=fasd_cd -d'
+(eval):18> alias 'zz=fasd_cd -d -i'
+(eval):24> autoload -Uz add-zsh-hook
+(eval):25> add-zsh-hook preexec _fasd_preexec
+zsh:3> set +xsecond part, I cannot write the example file so I changed to root and in this minimal env, fasd works. I did not create the .bashrc file yet.
bash-3.2$ sudo su
Password:
sh-3.2# testhome=$(mktemp -d)
sh-3.2# mkdir -p ${testhome}/bin
sh-3.2# cd ${testhome}/bin
sh-3.2# ls
sh-3.2# pwd
/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.SFwFn0r6/bin
sh-3.2# curl -sSL -o "${testhome}/bin/fasd" https://raw.githubusercontent.com/clvv/fasd/master/fasd;chmod https://raw.githubusercontent.com/clvv/fasd/master/fasd;chmod +x ${testhome}/bin/fasd;
sh-3.2# ls -al
total 40
drwxr-xr-x 3 root wheel 96 Dec 28 16:51 .
drwx------ 3 root wheel 96 Dec 28 16:50 ..
-rwxr-xr-x 1 root wheel 20195 Dec 28 16:51 fasd
bash-3.2# eval "$(./bin/fasd --init auto)"
bash-3.2# fasd
bash-3.2# ls
.viminfo bin example.txt
bash-3.2# echo "echo hello world" >> ~/.bash_history
bash-3.2# ls
.bash_history .viminfo bin example.txt
bash-3.2# export PATH=$PATH:${testhome}/bin
bash-3.2# ls
.bash_history .fasd .viminfo bin example.txt
bash-3.2# v .fasd
bash: v: command not found
bash-3.2# cat .fasd
/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.SFwFn0r6/.fasd|1|1514451952
bash-3.2# ./bin/fasd
12 /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.SFwFn0r6/.fasd
bash-3.2# ./bin/fasd example
bash-3.2# rm example.txt
bash-3.2# touch example.txt
bash-3.2# ./bin/fasd example
6 /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.SFwFn0r6/example.txtOn Dec 28, 2017, at 02:37, Euan Kemp
notifications@github.com> wrote: Please provide a minimal reproduction.
It may help to change the fasd init code to the following for debugging purposes:
set -x
eval "$(fasd --init auto)"
set +x
Or to include set -x before the command that errors out.I'm unable to reproduce these issues. Here are the steps I can run in order to have a working fasd installation under bash (which, if you wish to check work on your system, can narrow down whether the issue lies in your bashrc configuration or elsewhere):
$ testhome=$(mktemp -d)
$ mkdir -p ${testhome}/bin
$ curl -sSL -o "${testhome}/bin/fasd" https://raw.githubusercontent.com/clvv/fasd/master/fasd https://raw.githubusercontent.com/clvv/fasd/master/fasd
$ chmod +x ${testhome}/bin/fasd$ cat > "${testhome}/.bashrc" <
export PATH=$PATH:${testhome}/bin Ensure history is not blank; fasd grabs commands to process from history
(https://github.com/clvv/fasd/blob/90b531a5daaa545c74c7d98974b54cbdb92659fc/fasd#L127-L130 https://github.com/clvv/fasd/blob/90b531a5daaa545c74c7d98974b54cbdb92659fc/fasd#L127-L130)
and, if history is empty, will error out
echo "echo hello world" >> ~/.bash_history
eval "\$(fasd --init auto)"
EOF$ env -i HOME=${testhome} bash
$ cd ~/bin
$ cd ~/bin
$ cd ~$ z bin && pwd
$ touch example.txt
$ fasd example
Note: the above must be run under an interactive shell for fasd to work, not a bash script. With only minor modifications, the above should work for zsh too.The above for me works as I'd expect (printing out /tmp/tmp.zKxt6nvlxj/bin and 6 /tmp/tmp.zKxt6nvlxj/bin/example.txt).
Please provide any of the following if you can:
more details about what's breaking (e.g. the output of fasd example or fasd --init after applying set -x to the shell)
Whether you can reproduce it in a minimal environment like the above.
An actual minimal reproduction that isn't just "on my machine it doesn't work"
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/clvv/fasd/issues/117#issuecomment-354156542, or mute the thread https://github.com/notifications/unsubscribe-auth/ADKNgl5x1H3BscF4Pa3-fIjkOr9WFjjWks5tEo53gaJpZM4QxsoO.https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png https://github.com/clvv/fasd https://github.com/clvv/fasd https://raw.githubusercontent.com/clvv/fasd/master/fasd/r/n$ https://raw.githubusercontent.com/clvv/fasd/master/fasd/r/n$ https://github.com/clvv/fasd/blob/90b531a5daaa545c74c7d98974b54cbdb92659fc/fasd#L127-L130 https://github.com/clvv/fasd/blob/90b531a5daaa545c74c7d98974b54cbdb92659fc/fasd#L127-L130 https://github.com/clvv/fasd/issues/117#issuecomment-354156542 https://github.com/clvv/fasd/issues/117#issuecomment-354156542
Not sure if it's related. But I find that https://github.com/jimhester/per-directory-history conflicts with fasd. I have the same issue that fasd does not track any files or directories. After disabling the per-directory-history plugin fasd works fine.
Also got this on subsystem for windows (might be the issue here), with both bash
and zsh
.
even tried disabling all other things in the rc
files, but the fasd
lists are always empty.
I also tried using both fasd
from the repo as well as installing it with a package manager, results didn't change.
set -x
eval "$(fasd --init auto)"
set +x
+-zsh:2> fasd --init auto
+-zsh:2> eval $'{ if [ "$ZSH_VERSION" ] && compctl; then # zsh\n eval "$(fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install \\\n zsh-wcomp zsh-wcomp-install)"\n elif [ "$BASH_VERSION" ] && complete; then # bash\n eval "$(fasd --init posix-alias bash-hook bash-ccomp bash-ccomp-install)"\n else # posix shell\n eval "$(fasd --init posix-alias posix-hook)"\n fi\n} >> "/dev/null" 2>&1'
+(eval):1> [ 5.5.1 ']'
+(eval):1> compctl
+(eval):2> fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install
+(eval):2> eval $'alias a=\'fasd -a\'\nalias s=\'fasd -si\'\nalias sd=\'fasd -sid\'\nalias sf=\'fasd -sif\'\nalias d=\'fasd -d\'\nalias f=\'fasd -f\'\n# function to execute built-in cd\nfasd_cd() {\n if [ $# -le 1 ]; then\n fasd "$@"\n else\n local _fasd_ret="$(fasd -e \'printf %s\' "$@")"\n [ -z "$_fasd_ret" ] && return\n [ -d "$_fasd_ret" ] && cd "$_fasd_ret" || printf %s\\n "$_fasd_ret"\n fi\n}\nalias z=\'fasd_cd -d\'\nalias zz=\'fasd_cd -d -i\'\n\n# add zsh hook\n_fasd_preexec() {\n { eval "fasd --proc $(fasd --sanitize $1)"; } >> "/dev/null" 2>&1\n}\nautoload -Uz add-zsh-hook\nadd-zsh-hook preexec _fasd_preexec\n\n# zsh command mode completion\n_fasd_zsh_cmd_complete() {\n local compl\n read -c compl\n (( $+compstate )) && compstate[insert]=menu # no expand if compsys loaded\n reply=(${(f)"$(fasd --complete "$compl")"})\n}\n\n# enbale command mode completion\ncompctl -U -K _fasd_zsh_cmd_complete -V fasd -x \'C[-1,-*e],s[-]n[1,e]\' -c - \\\n \'c[-1,-A][-1,-D]\' -f -- fasd fasd_cd\n\n(( $+functions[compdef] )) && {\n # zsh word mode completion\n _fasd_zsh_word_complete() {\n [ "$2" ] && local _fasd_cur="$2"\n [ -z "$_fasd_cur" ] && local _fasd_cur="${words[CURRENT]}"\n local fnd="${_fasd_cur//,/ }"\n local typ=${1:-e}\n fasd --query $typ "$fnd" 2>> "/dev/null" | \\\n sort -nr | sed \'s/^[^ ]*[ ]*//\' | while read -r line; do\n compadd -U -V fasd "$line"\n done\n compstate[insert]=menu # no expand\n }\n _fasd_zsh_word_complete_f() { _fasd_zsh_word_complete f ; }\n _fasd_zsh_word_complete_d() { _fasd_zsh_word_complete d ; }\n _fasd_zsh_word_complete_trigger() {\n local _fasd_cur="${words[CURRENT]}"\n eval $(fasd --word-complete-trigger _fasd_zsh_word_complete $_fasd_cur)\n }\n # define zle widgets\n zle -C fasd-complete complete-word _generic\n zstyle \':completion:fasd-complete:*\' completer _fasd_zsh_word_complete\n zstyle \':completion:fasd-complete:*\' menu-select\n\n zle -C fasd-complete-f complete-word _generic\n zstyle \':completion:fasd-complete-f:*\' completer _fasd_zsh_word_complete_f\n zstyle \':completion:fasd-complete-f:*\' menu-select\n\n zle -C fasd-complete-d complete-word _generic\n zstyle \':completion:fasd-complete-d:*\' completer _fasd_zsh_word_complete_d\n zstyle \':completion:fasd-complete-d:*\' menu-select\n}\n\n(( $+functions[compdef] )) && {\n # enable word mode completion\n orig_comp="$(zstyle -L \':completion:\\*\' completer 2>> "/dev/null")"\n if [ "$orig_comp" ]; then\n case $orig_comp in\n *_fasd_zsh_word_complete_trigger*);;\n *) eval "$orig_comp _fasd_zsh_word_complete_trigger";;\n esac\n else\n zstyle \':completion:*\' completer _complete _fasd_zsh_word_complete_trigger\n fi\n unset orig_comp\n}'
+(eval):1> alias 'a=fasd -a'
+(eval):2> alias 's=fasd -si'
+(eval):3> alias 'sd=fasd -sid'
+(eval):4> alias 'sf=fasd -sif'
+(eval):5> alias 'd=fasd -d'
+(eval):6> alias 'f=fasd -f'
+(eval):17> alias 'z=fasd_cd -d'
+(eval):18> alias 'zz=fasd_cd -d -i'
+(eval):24> autoload -Uz add-zsh-hook
+(eval):25> add-zsh-hook preexec _fasd_preexec
+-zsh:3> set +x
Not sure if the ranking is supposed to be in ~/.fasd
, but the file seems to be always empty.
For me it helped to fix it to run it as root, extracting the part fasd --init posix-alias bash-hook bash-ccomp bash-ccomp-install
from
fasd --init auto
command and surround it with eval, eval "$(fasd --init posix-alias bash-hook bash-ccomp bash-ccomp-install)" and applying into root's /root/.bashrc , maybe extracting the init command was not necessary and all enough was running it as a root, but didn't have more time to confirm that but I think I remember it didn't work for me just like so only by a mean of root - I had to extract bash part of init command too I think .
For future readers, I had a similar issue because the rights of my ~/.fasd folder was 600 (rw for root only). Removing this folder and sourcing my ~/.zshrc solved the issue.
For future readers, I had a similar issue because the rights of my ~/.fasd folder was 600 (rw for root only). Removing this folder and sourcing my ~/.zshrc solved the issue.
This was the issue for me too
For me it was 100% https://github.com/clvv/fasd/issues/117#issuecomment-357458043.
Most helpful comment
Not sure if it's related. But I find that https://github.com/jimhester/per-directory-history conflicts with fasd. I have the same issue that fasd does not track any files or directories. After disabling the per-directory-history plugin fasd works fine.