Fast jump tool — a brief introduction to FASD

Time:2021-10-21

preface

FASD is a command line acceleration tool. It provides fast access to files and folders. It’s very similar to autojmp, Z, V. It will record the folders and files you have visited, and then you can access them directly by short names.
FASD will sort the accessed files and folders by frequency of use, and then list all files and folders by frequency

install

git clone https://github.com/clvv/fasd.git
cd fasd
make install

Then put the following statement under your. Bashrc or. Zshrc

eval "$(fasd --init auto)"

command

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 <cmd>  set command to execute on the result file
    -b <name>  only use <name> backend
    -B <name>  add additional backend <name>
    -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

Such as inputfasd -RThe returned result is

$ fasd -R
75.3984    /home/harriszh/dw/dev/dw_fp_mult/src
63.423    /home/harriszh/dw/work_version/sim_ver.2015
44.8636    /home/harriszh/avip/axi3_master_tlm_slave_tlm
43.8288    /home/harriszh/.fzf
37.4402    /home/harriszh/.zshrc
35.572    /home/harriszh/dw/dev/dw_fp_mult
26.0366    /home/harriszh/.fzf/shell
25.6842    /home/harriszh/.vim/bundle
...

to configure

ZSH:

# fasd
fasd_cache="$HOME/.fasd-init-zsh"
if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
  fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install >| "$fasd_cache"
fi
source "$fasd_cache"
unset fasd_cache

BASH:

fasd_cache="$HOME/.fasd-init-bash"
if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
  fasd --init posix-alias bash-hook bash-ccomp bash-ccomp-install >| "$fasd_cache"
fi
source "$fasd_cache"
unset fasd_cache

aliases

From the following aliases

alias a=’fasd -a’ # any
alias s=’fasd -si’ # show / search / select
alias d=’fasd -d’ # directory
alias f=’fasd -f’ # file
alias sd=’fasd -sid’ # interactive directory selection
alias sf=’fasd -sif’ # interactive file selection
alias z=’fasd_cd -d’ # cd, same functionality as j in autojump
alias zz=’fasd_cd -d -i’ # cd with interactive selection
It is recommended to comment out Z and ZZ, because they will be implemented later with FZF + FASD

use

Use the following:

# list recent files matching foo
f foo
# list recent files and directories matching foo and bar             
a foo bar  
# list recent files that ends in js    
f js$ 
# run vim on the most frecent file matching foo              
f -e vim foo  
# run mplayer on the most frecent file matching bar     
mplayer `f bar`
# cd into the most frecent directory matching foo    
z foo
# interact               
open `sf pdf`  

problem

This error often occurs when used with FZF in Zsh

fasd_cd:1: maximum nested function level reached

At this time, you should check whether FASD is used by other scripts alias

an account of happenings after the event being told

FASD is also very powerful when used alone, but it will be more powerful when combined with FZF, so FASD is only one of the three swordsmen, and the other two swordsmen are riggrep and FZF

Recommended Today

Swift advanced (XV) extension

The extension in swift is somewhat similar to the category in OC Extension can beenumeration、structural morphology、class、agreementAdd new features□ you can add methods, calculation attributes, subscripts, (convenient) initializers, nested types, protocols, etc What extensions can’t do:□ original functions cannot be overwritten□ you cannot add storage attributes or add attribute observers to existing attributes□ cannot add parent […]