aboutsummaryrefslogtreecommitdiffstats
path: root/src/shell
diff options
context:
space:
mode:
authorConrad Ludgate <conradludgate@gmail.com>2021-12-11 09:48:53 +0000
committerGitHub <noreply@github.com>2021-12-11 09:48:53 +0000
commit87df7d80eca0ede9e149d1ef533e71650e4b919a (patch)
tree389e2c5b32208a8a05259d308af857f7a61cb7f9 /src/shell
parentBump serde_json from 1.0.64 to 1.0.72 (#219) (diff)
downloadatuin-87df7d80eca0ede9e149d1ef533e71650e4b919a.zip
Fish importing (#234)
* make a start on fish * fix * test * enable fish * fmt * update histpath set up fish init script * update readme * cover edge case * fmt * fix session variables Co-authored-by: PJ <me@panekj.dev> * respect NOBIND Co-authored-by: PJ <me@panekj.dev> * fix env var setting Co-authored-by: PJ <me@panekj.dev> * fix whitespace Co-authored-by: PJ <me@panekj.dev> * add fish to supported shells Co-authored-by: PJ <me@panekj.dev>
Diffstat (limited to 'src/shell')
-rw-r--r--src/shell/atuin.fish28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/shell/atuin.fish b/src/shell/atuin.fish
new file mode 100644
index 00000000..5d59d01d
--- /dev/null
+++ b/src/shell/atuin.fish
@@ -0,0 +1,28 @@
+
+set -gx ATUIN_SESSION (atuin uuid)
+set -gx ATUIN_HISTORY (atuin history list)
+
+function _atuin_preexec --on-event fish_preexec
+ set -gx ATUIN_HISTORY_ID (atuin history start "$argv[1]")
+end
+
+function _atuin_postexec --on-event fish_postexec
+ set s $status
+ if test -n "$ATUIN_HISTORY_ID"
+ RUST_LOG=error atuin history end $ATUIN_HISTORY_ID --exit $s &; disown
+ end
+end
+
+function _atuin_search
+ set h (RUST_LOG=error atuin search -i (commandline -b) 3>&1 1>&2 2>&3)
+ commandline -f repaint
+ if test -n "$h"
+ commandline -r $h
+ end
+end
+
+if test -z $ATUIN_NOBIND
+ bind -k up '_atuin_search'
+ bind \eOA '_atuin_search'
+ bind \e\[A '_atuin_search'
+end