fzf functions
This commit is contained in:
parent
1deba07f82
commit
87ec731549
|
@ -138,7 +138,7 @@
|
||||||
stty -ixon
|
stty -ixon
|
||||||
|
|
||||||
function generate () { gopass generate -s -p $1 $((RANDOM % 14 + 45)) }
|
function generate () { gopass generate -s -p $1 $((RANDOM % 14 + 45)) }
|
||||||
function fcd { cd $(fd -L --max-depth=''${1:-1} --type=d 2>/dev/null | fzf-tmux) }
|
function fcd { cd $(fd -L --max-depth=''${1:-4} --type=d 2>/dev/null | fzf-tmux) }
|
||||||
|
|
||||||
fif() {
|
fif() {
|
||||||
if [ ! "$#" -gt 0 ]; then
|
if [ ! "$#" -gt 0 ]; then
|
||||||
|
@ -148,6 +148,25 @@
|
||||||
rg --files-with-matches --no-messages "$1" | fzf $FZF_PREVIEW_WINDOW --preview "rg --ignore-case --pretty --context 10 '$1' {}"
|
rg --files-with-matches --no-messages "$1" | fzf $FZF_PREVIEW_WINDOW --preview "rg --ignore-case --pretty --context 10 '$1' {}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fe() {
|
||||||
|
IFS=$'\n' files=($(fzf-tmux --query="$1" --multi --select-1 --exit-0))
|
||||||
|
[[ -n "$files" ]] && ''${EDITOR:-vim} "''${files[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
..() {
|
||||||
|
local declare dirs=()
|
||||||
|
get_parent_dirs() {
|
||||||
|
if [[ -d "''${1}" ]]; then dirs+=("$1"); else return; fi
|
||||||
|
if [[ "''${1}" == '/' ]]; then
|
||||||
|
for _dir in "''${dirs[@]}"; do echo $_dir; done
|
||||||
|
else
|
||||||
|
get_parent_dirs $(dirname "$1")
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
local DIR=$(get_parent_dirs $(realpath "$PWD/..") | fzf-tmux)
|
||||||
|
cd "$DIR"
|
||||||
|
}
|
||||||
|
|
||||||
tre () { command tre "$@" -e && source "/tmp/tre_aliases_$USER" 2>/dev/null; }
|
tre () { command tre "$@" -e && source "/tmp/tre_aliases_$USER" 2>/dev/null; }
|
||||||
|
|
||||||
function gcd () {
|
function gcd () {
|
||||||
|
|
Loading…
Reference in New Issue