mirror of
https://gitea.zaclys.com/yannic/dotfiles.git
synced 2026-06-15 11:11:57 +02:00
fzf function: edit and grep
This commit is contained in:
@@ -16,21 +16,14 @@ p(){
|
|||||||
|
|
||||||
|
|
||||||
# open any file with default editor (or vim if none)
|
# open any file with default editor (or vim if none)
|
||||||
fzvim() {
|
fze() {
|
||||||
IFS=$'\n' files=($(fzf --query="$1" --multi --select-1 --exit-0))
|
IFS=$'\n' files=($(fzf --query="$1" --multi --select-1 --exit-0))
|
||||||
[[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}"
|
[[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# open any file with vscode
|
|
||||||
fzcode() {
|
|
||||||
IFS=$'\n' files=($(fzf --query="$1" --multi --select-1 --exit-0))
|
|
||||||
[[ -n "$files" ]] && code "${files[@]}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# grep with silver searcher (https://github.com/ggreer/the_silver_searcher)
|
# grep with silver searcher (https://github.com/ggreer/the_silver_searcher)
|
||||||
# install debian : sudo apt-get install silversearcher-ag
|
# install debian : sudo apt-get install silversearcher-ag
|
||||||
vg() {
|
fzg() {
|
||||||
local file
|
local file
|
||||||
local line
|
local line
|
||||||
|
|
||||||
@@ -38,6 +31,6 @@ vg() {
|
|||||||
|
|
||||||
if [[ -n $file ]]
|
if [[ -n $file ]]
|
||||||
then
|
then
|
||||||
vim $file +$line
|
${EDITOR:-vim} $file +$line
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user