m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-19 17:13:42 -05:00

Updated Examples (markdown)

Junegunn Choi
2015-03-01 12:43:26 +09:00
parent af8d8a705a
commit fffe64811c

@@ -83,12 +83,12 @@ writecmd() {
# fh - repeat history # fh - repeat history
fh() { fh() {
([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s | sed -re 's/^\s*[0-9]+\s*//' | writecmd -run ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed -re 's/^\s*[0-9]+\s*//' | writecmd -run
} }
# fhe - repeat history edit # fhe - repeat history edit
fhe() { fhe() {
([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s | sed -re 's/^\s*[0-9]+\s*//' | writecmd ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed -re 's/^\s*[0-9]+\s*//' | writecmd
} }
``` ```
@@ -115,7 +115,7 @@ fkill() {
fbr() { fbr() {
local branches branch local branches branch
branches=$(git branch) && branches=$(git branch) &&
branch=$(echo "$branches" | fzf +s +m) && branch=$(echo "$branches" | fzf +m) &&
git checkout $(echo "$branch" | sed "s/.* //") git checkout $(echo "$branch" | sed "s/.* //")
} }
``` ```
@@ -125,7 +125,7 @@ fbr() {
fco() { fco() {
local commits commit local commits commit
commits=$(git log --pretty=oneline --abbrev-commit --reverse) && commits=$(git log --pretty=oneline --abbrev-commit --reverse) &&
commit=$(echo "$commits" | fzf +s +m -e) && commit=$(echo "$commits" | fzf --tac +m -e) &&
git checkout $(echo "$commit" | sed "s/ .*//") git checkout $(echo "$commit" | sed "s/ .*//")
} }
``` ```
@@ -189,7 +189,7 @@ arguments but displays an fzf prompt when used without.
unalias z 2> /dev/null unalias z 2> /dev/null
z() { z() {
if [[ -z "$*" ]]; then if [[ -z "$*" ]]; then
cd "$(_z -l 2>&1 | fzf +s | sed 's/^[0-9,.]* *//')" cd "$(_z -l 2>&1 | fzf +s --tac | sed 's/^[0-9,.]* *//')"
else else
_z "$@" _z "$@"
fi fi
@@ -203,7 +203,7 @@ for the previous command as the default input by using zz
unalias z unalias z
z() { z() {
if [[ -z "$*" ]]; then if [[ -z "$*" ]]; then
cd "$(_z -l 2>&1 | fzf +s | sed 's/^[0-9,.]* *//')" cd "$(_z -l 2>&1 | fzf +s --tac | sed 's/^[0-9,.]* *//')"
else else
_last_z_args="$@" _last_z_args="$@"
_z "$@" _z "$@"
@@ -228,4 +228,4 @@ alias jj=zz
# fsfzf - browse file system # fsfzf - browse file system
# https://github.com/D630/gist-bin-pub/tree/master/fsfzf # https://github.com/D630/gist-bin-pub/tree/master/fsfzf
% . fsfzf.sh <ARG> % . fsfzf.sh <ARG>
``` ```