m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 08:13:40 -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() {
([ -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() {
([ -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() {
local branches branch
branches=$(git branch) &&
branch=$(echo "$branches" | fzf +s +m) &&
branch=$(echo "$branches" | fzf +m) &&
git checkout $(echo "$branch" | sed "s/.* //")
}
```
@@ -125,7 +125,7 @@ fbr() {
fco() {
local commits commit
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/ .*//")
}
```
@@ -189,7 +189,7 @@ arguments but displays an fzf prompt when used without.
unalias z 2> /dev/null
z() {
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
_z "$@"
fi
@@ -203,7 +203,7 @@ for the previous command as the default input by using zz
unalias z
z() {
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
_last_z_args="$@"
_z "$@"
@@ -228,4 +228,4 @@ alias jj=zz
# fsfzf - browse file system
# https://github.com/D630/gist-bin-pub/tree/master/fsfzf
% . fsfzf.sh <ARG>
```
```