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 "*$@*" find -iname "*$@*"
} }
function ws { function wf {
if [[ "$@" != "" ]]; then if [[ "$@" != "" ]]; then
local fzf_args="-q $@" local fzf_args="-q $@"
fi fi
# fd --type f --search-path ~/wiki -x cat | grep -v "^ *$" | \fzf $fzf_args 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/:.*//')"
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/:.*//')" }
function ws {
local filename="$(wf $@)"
if [[ "$filename" != "" ]]; then if [[ "$filename" != "" ]]; then
vim ~/wiki/$filename vim $filename
fi fi
} }
@ -100,3 +103,7 @@ alias ls='ls --color=auto -F -w 80'
alias du='du -sh' alias du='du -sh'
alias tags='ctags --exclude=node_modules -f newtags -R . && mv newtags tags' alias tags='ctags --exclude=node_modules -f newtags -R . && mv newtags tags'
if [[ "$@" != "" ]]; then
$@
fi