Selaa lähdekoodia

actually working in bash!

Daniel Sheffield 4 kuukautta sitten
vanhempi
sitoutus
39cb1870d7
6 muutettua tiedostoa jossa 53 lisäystä ja 45 poistoa
  1. 3 0
      .gitmodules
  2. 0 44
      .shrc
  3. 27 0
      rc/.bashrc
  4. 21 0
      rc/.shrc
  5. 1 1
      rc/.zshrc
  6. 1 0
      rc/bash-preexec

+ 3 - 0
.gitmodules

@@ -0,0 +1,3 @@
+[submodule "rc/bash-preexec"]
+	path = rc/bash-preexec
+	url = https://github.com/rcaloras/bash-preexec.git

+ 0 - 44
.shrc

@@ -1,44 +0,0 @@
-#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
-}

+ 27 - 0
rc/.bashrc

@@ -0,0 +1,27 @@
+#TODO: path must be install location
+. "$HOME"/git/recall/rc/.shrc
+#. "$HOME"/git/recall/rc/bash-preexec/bash-preexec.sh
+
+insert() {
+	#set -x
+	#bind $'"\u200b":"'$zle_prefix'"'
+	bind $'"\u200b":"'"$zle_prefix"'"'
+	perl -le 'require "sys/ioctl.ph";
+ioctl(STDIN, &TIOCSTI, $_) for split "", join " ", @ARGV' -- "$@"
+}
+#bind "\"\\u200b\":\""$zle_prefix"\""
+PROMPT_COMMAND="[ \"$zle_prefix\" ] && insert $'\u200b'"
+
+writecmd () { 
+	perl -e 'ioctl STDOUT, 0x5412, $_ for split //, do{ chomp($_ = <>); $_ }' ; 
+	#perl -e 'ioctl STDOUT, 0x5412, $_ for split //, "$_"' ; 
+}
+#[ "${OLD_PROMPT_COMMAND+defined}" == "defined" ] || OLD_PROMPT_COMMAND="$PROMPT_COMMAND"
+#PROMPT_COMMAND='$OLD_PROMPT_COMMAND; echo "$zle_prefix" | writecmd'
+#inject (){
+#precmd (){
+#	writecmd <<< "$zle_prefix" || true
+#}
+#PROMPT_COMMAND="inject"
+#PROMPT_COMMAND='writecmd <<< "$zle_prefix" > /dev/null '
+#PROMPT_COMMAND='READLINE_LINE="$zle_prefix$READLINE_LINE"; READLINE_POINT=${#READLINE_LINE}'

+ 21 - 0
rc/.shrc

@@ -0,0 +1,21 @@
+#TODO: path must be the install dir
+alias capture="$HOME/git/recall/capture.sh"
+alias recall="$HOME/git/recall/recall.sh"
+
++ (){
+	capture "$@"
+}
+@ (){
+	recall "$@"
+}
+- () {
+	# handle zero args
+	if [ "$#" == "0" ]
+	then
+		zle_prefix=''
+		return
+	fi
+
+	zle_prefix="$* "
+	return
+}

+ 1 - 1
.zshrc → rc/.zshrc

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

+ 1 - 0
rc/bash-preexec

@@ -0,0 +1 @@
+Subproject commit 8926de0a1f69d17f5b05099cfaaa52d833084c2f