From bcc462e5d2b62a1fd82427fd63c3c06f7fab6cda Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Sun, 30 Jan 2022 23:12:32 -0500 Subject: [PATCH] Make aliases executable. Add separate wf function for wiki work. --- .shell_aliases | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) mode change 100644 => 100755 .shell_aliases diff --git a/.shell_aliases b/.shell_aliases old mode 100644 new mode 100755 index a1d2d66..5505c44 --- a/.shell_aliases +++ b/.shell_aliases @@ -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