Add goto and search functions

This commit is contained in:
Augusto Gunsch
2021-12-14 13:53:50 -03:00
parent 1f2e6d6540
commit 5d737ff9ff
2 changed files with 15 additions and 5 deletions

View File

@@ -28,7 +28,7 @@ alias feh="feh -."
alias info="info --vi-keys"
# grepa
alias grepa="grep -n --color=always -r --exclude-dir=venv"
alias grepa="grep -I -n --color=always -r --exclude-dir=venv"
# less
alias less="less -R"
@@ -42,6 +42,16 @@ alias sl="ls"
#la
alias la="ls -a"
finder() {
grepa "$1" | less
search() {
grepa "$@" . | sed -nE '/^.{,200}$/p'
}
goto() {
open="$(search "$@" | fzf --ansi)"
if [ ! -z "$open" ]; then
file="$(echo "$open" | cut -d: -f1 -)"
line="$(echo "$open" | cut -d: -f2 -)"
vim "$file" -c "normal! $line"gg
fi
}