|
|
@ -13,3 +13,31 @@ export FZF_DEFAULT_OPTS='--height 40% --reverse --border'
|
|
|
|
p(){
|
|
|
|
p(){
|
|
|
|
cd {{ .projectdir }} && `__fzf_cd__`
|
|
|
|
cd {{ .projectdir }} && `__fzf_cd__`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# open any file with default editor (or vim if none)
|
|
|
|
|
|
|
|
fzvim() {
|
|
|
|
|
|
|
|
IFS=$'\n' files=($(fzf --query="$1" --multi --select-1 --exit-0))
|
|
|
|
|
|
|
|
[[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# open any file with vscode
|
|
|
|
|
|
|
|
fzcode() {
|
|
|
|
|
|
|
|
IFS=$'\n' files=($(fzf --query="$1" --multi --select-1 --exit-0))
|
|
|
|
|
|
|
|
[[ -n "$files" ]] && code "${files[@]}"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# grep with silver searcher (https://github.com/ggreer/the_silver_searcher)
|
|
|
|
|
|
|
|
# install debian : sudo apt-get install silversearcher-ag
|
|
|
|
|
|
|
|
vg() {
|
|
|
|
|
|
|
|
local file
|
|
|
|
|
|
|
|
local line
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
read -r file line <<<"$(ag --nobreak --noheading $@ | fzf -0 -1 | awk -F: '{print $1, $2}')"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [[ -n $file ]]
|
|
|
|
|
|
|
|
then
|
|
|
|
|
|
|
|
vim $file +$line
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|