commit fb74a60ff7f28969f7dd04efa4e00541d6bc637f
parent 7c150aa73d6bdfc24dbbc28ff7f907b83fae154a
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Thu, 19 Nov 2020 13:14:21 -0800
Remove locate alias module
Move function declorations below alias block and remove `locate'
module putting the fp function into `main' and fl into a script of the
same name.
Diffstat:
3 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/modules/aliases/.config/aliases/locate b/modules/aliases/.config/aliases/locate
@@ -1,17 +0,0 @@
-# file locating shell alias and functions
-
-# edit executable file in PATH
-fp() {
- local bin=`which $@ 2>/dev/null`
- f ${bin:?No such file or directory}
-}
-
-# edit locate's findings
-fl() {
- local files="$(locate $@)"
- if test `echo "$files" | wc -l` -gt 1; then
- echo "$files"
- elif test ${#files} -gt 0; then
- f $files
- fi
-}
diff --git a/modules/aliases/.config/aliases/main b/modules/aliases/.config/aliases/main
@@ -10,16 +10,6 @@ include() {
# Must be included here for ncpu.
include openbsd
-doin() { (builtin cd ${1:?No directory} && shift && eval $@) ;}
-fed() { doin "$FEED_DIR" feed $@ ;}
-fman() { groff -man -Tascii $@ | l ;}
-lsc() { ls $* | rs ;}
-lsm() { ls ${ALIASES:?unset} ;}
-note() { doin $HOME/own/text/note/ $@ ;}
-np() { unset ALL_PROXY; unset HTTP_PROXY ;}
-reload() { . ~/.profile && include main ;}
-vol() { sndioctl output.level=$@ ;}
-
alias ap="apropos"
alias apf="apropos -f"
alias doas="doas -- "
@@ -42,11 +32,25 @@ alias f="$EDITOR"
alias l="$PAGER"
alias t="tmux"
+doin() { (builtin cd ${1:?No directory} && shift && eval $@) ;}
+fed() { doin "$FEED_DIR" feed $@ ;}
+fman() { groff -man -Tascii $@ | l ;}
+lsc() { ls $* | rs ;}
+lsm() { ls ${ALIASES:?unset} ;}
+note() { doin $HOME/own/text/note/ $@ ;}
+np() { unset ALL_PROXY; unset HTTP_PROXY ;}
+reload() { . ~/.profile && include main ;}
+vol() { sndioctl output.level=$@ ;}
+
+fp() {
+ local bin=`which $@ 2>/dev/null`
+ f ${bin:?No such file or directory}
+}
+
include cd
include complex
include git
include history
-include locate
include mpc
include private
include xorg
diff --git a/modules/scripts/.local/bin/fl b/modules/scripts/.local/bin/fl
@@ -0,0 +1,13 @@
+#!/usr/local/bin/rc -e
+# Edit locate(1)'s findings
+
+# A flaw of this method is that you cannot anchor the match.
+match = `{ locate $* }
+
+if (test $#match -eq 0) {
+ if (test -n $match) {
+ $EDITOR $match
+ }
+} else {
+ echo $match
+}