Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function fzf-default() {
- fzf --multi --ansi --select-1 --exit-0 --reverse --height '40%'
- }
- function fzf-cd() {
- local DIR=$(fd --type d | fzf +m --ansi --select-1 --reverse)
- if [ -n "$DIR" ]; then
- cd $DIR
- fi
- }
- function fzf-ag() {
- if [ -z "$1" ]; then
- echo 'Usage: agg PATTERN'
- return 0
- fi
- local result=`ag $1 | fzf`
- local line=`echo "$result" | awk -F ':' '{print $2}'`
- local file=`echo "$result" | awk -F ':' '{print $1}'`
- if [ -n "$file" ]; then
- vi $file +$line
- fi
- }
- function fzf-vi() {
- fd ${1:-.} | fzf-default | xargs -o vi
- }
- alias d='fzf-cd'
- alias g="fzf-ag"
- alias v='fzf-vi'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement