Trims fat and renames files
This commit is contained in:
parent
6021ad3194
commit
4563550969
40 changed files with 233 additions and 352 deletions
29
functions/vim_functions.sh
Normal file
29
functions/vim_functions.sh
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Easily search for strings within the files within the current directory.
|
||||
# Specify file extensions and directories to exclude to improve accuracy.
|
||||
# The file selected from fzf will be opened in vim.
|
||||
function vfzopen() {
|
||||
echo -n "Search Term: "
|
||||
read search_query
|
||||
echo -n "Filename: "
|
||||
read filetype
|
||||
echo -n "Exclude Directory: "
|
||||
read exclude_dir
|
||||
|
||||
if [ ! -z "$exclude_dirs" ]; then
|
||||
filename=$(find . -type f -name "$filetype" | \
|
||||
xargs grep -l "$search_query" | fzf)
|
||||
else
|
||||
filename=$(find . -type f -name "$filetype" -not -path "./${exclude_dir}/*" \
|
||||
| xargs grep -l "$search_query" | fzf)
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -z "$filename" ]; then
|
||||
vim "$filename"
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue