Browse Source

add example rc files

Daniel Sheffield 4 months ago
parent
commit
cd3948ebb8
2 changed files with 50 additions and 0 deletions
  1. 44 0
      .shrc
  2. 6 0
      .zshrc

+ 44 - 0
.shrc

@@ -0,0 +1,44 @@
+#TODO: path must be the install dir
+alias capture="$HOME/git/recall/capture.sh"
+alias recall="$HOME/git/recall/recall.sh"
+
++ (){
+	capture "$@"
+}
+@ (){
+	recall "$@"
+}
+- (){
+  ++
+}
+++ () {
+	# handle recursive call (ie, bash)
+	[ -n "$BASH_VERSION" ] && [ "$zle_prefix" ] && return
+
+
+	# handle zero args
+	if [ "$#" == "0" ]
+	then
+		[ -n "$ZSH_VERSION" ] && zle_prefix=''
+		return
+	fi
+
+	if [ -n "$ZSH_VERSION" ]
+	then
+		zle_prefix="$* "
+		return
+	elif [ -n "$BASH_VERSION" ]
+	then
+		zle_prefix="$*"
+	fi
+	while read -p "$* > " -ra c
+	do
+		if [ "${c[0]}" = "exit" ]
+		then
+			zle_prefix=''
+			break
+		fi
+		"$zle_prefix" "${c[@]}"
+		history -s "$zle_prefix" "${c[@]}"
+	done
+}

+ 6 - 0
.zshrc

@@ -0,0 +1,6 @@
+#TODO: path must be the install dir
+. "$HOME"/git/recall/.shrc # all posix shells
+
+zle-line-init() if [[ $CONTEXT = start ]] LBUFFER=$zle_prefix$LBUFFER
+zle -N zle-line-init
+zle_prefix=''