Make aliases executable.

Add separate wf function for wiki work.
This commit is contained in:
Sage Vaillancourt 2022-01-30 23:12:32 -05:00
parent 3627eac40d
commit bcc462e5d2
1 changed files with 11 additions and 4 deletions

15
.shell_aliases Normal file → Executable file
View File

@ -4,14 +4,17 @@ function fin {
find -iname "*$@*"
}
function ws {
function wf {
if [[ "$@" != "" ]]; then
local fzf_args="-q $@"
fi
# fd --type f --search-path ~/wiki -x cat | grep -v "^ *$" | \fzf $fzf_args
local filename="$(rg --with-filename --no-heading . ~/wiki | sed 's@/home/sage/wiki/@@' | fzf $fzf_args -1 --preview='bat ~/wiki/$(echo {} | sed "s/:.*//")' | sed 's/:.*//')"
echo ~/wiki/"$(rg --with-filename --no-heading . ~/wiki | sed 's@/home/sage/wiki/@@' | fzf $fzf_args -1 --preview='bat ~/wiki/$(echo {} | sed "s/:.*//")' | sed 's/:.*//')"
}
function ws {
local filename="$(wf $@)"
if [[ "$filename" != "" ]]; then
vim ~/wiki/$filename
vim $filename
fi
}
@ -100,3 +103,7 @@ alias ls='ls --color=auto -F -w 80'
alias du='du -sh'
alias tags='ctags --exclude=node_modules -f newtags -R . && mv newtags tags'
if [[ "$@" != "" ]]; then
$@
fi