aboutsummaryrefslogtreecommitdiffstats
path: root/src/shell
diff options
context:
space:
mode:
Diffstat (limited to 'src/shell')
-rw-r--r--src/shell/atuin.bash34
-rw-r--r--src/shell/atuin.fish40
-rw-r--r--src/shell/atuin.nu44
-rw-r--r--src/shell/atuin.zsh57
4 files changed, 0 insertions, 175 deletions
diff --git a/src/shell/atuin.bash b/src/shell/atuin.bash
deleted file mode 100644
index 1056dcf5..00000000
--- a/src/shell/atuin.bash
+++ /dev/null
@@ -1,34 +0,0 @@
-ATUIN_SESSION=$(atuin uuid)
-export ATUIN_SESSION
-
-_atuin_preexec() {
- local id
- id=$(atuin history start -- "$1")
- export ATUIN_HISTORY_ID="${id}"
-}
-
-_atuin_precmd() {
- local EXIT="$?"
-
- [[ -z "${ATUIN_HISTORY_ID}" ]] && return
-
- (RUST_LOG=error atuin history end --exit "${EXIT}" -- "${ATUIN_HISTORY_ID}" &) >/dev/null 2>&1
-}
-
-__atuin_history() {
- tput rmkx
- # shellcheck disable=SC2048,SC2086
- HISTORY="$(RUST_LOG=error atuin search $* -i -- "${READLINE_LINE}" 3>&1 1>&2 2>&3)"
- tput smkx
-
- READLINE_LINE=${HISTORY}
- READLINE_POINT=${#READLINE_LINE}
-}
-
-if [[ -n "${BLE_VERSION-}" ]]; then
- blehook PRECMD-+=_atuin_precmd
- blehook PREEXEC-+=_atuin_preexec
-else
- precmd_functions+=(_atuin_precmd)
- preexec_functions+=(_atuin_preexec)
-fi
diff --git a/src/shell/atuin.fish b/src/shell/atuin.fish
deleted file mode 100644
index de90b156..00000000
--- a/src/shell/atuin.fish
+++ /dev/null
@@ -1,40 +0,0 @@
-set -gx ATUIN_SESSION (atuin uuid)
-
-function _atuin_preexec --on-event fish_preexec
- if not test -n "$fish_private_mode"
- set -gx ATUIN_HISTORY_ID (atuin history start -- "$argv[1]")
- end
-end
-
-function _atuin_postexec --on-event fish_postexec
- set s $status
- if test -n "$ATUIN_HISTORY_ID"
- RUST_LOG=error atuin history end --exit $s -- $ATUIN_HISTORY_ID &>/dev/null &
- disown
- end
-end
-
-function _atuin_search
- set h (RUST_LOG=error atuin search $argv -i -- (commandline -b) 3>&1 1>&2 2>&3)
- commandline -f repaint
- if test -n "$h"
- commandline -r $h
- end
-end
-
-function _atuin_bind_up
- # Fallback to fish's builtin up-or-search if we're in search or paging mode
- if commandline --search-mode; or commandline --paging-mode
- up-or-search
- return
- end
-
- # Only invoke atuin if we're on the top line of the command
- set -l lineno (commandline --line)
- switch $lineno
- case 1
- _atuin_search --shell-up-key-binding
- case '*'
- up-or-search
- end
-end
diff --git a/src/shell/atuin.nu b/src/shell/atuin.nu
deleted file mode 100644
index d76cba91..00000000
--- a/src/shell/atuin.nu
+++ /dev/null
@@ -1,44 +0,0 @@
-# Source this in your ~/.config/nushell/config.nu
-let-env ATUIN_SESSION = (atuin uuid)
-
-# Magic token to make sure we don't record commands run by keybindings
-let ATUIN_KEYBINDING_TOKEN = $"# (random uuid)"
-
-let _atuin_pre_execution = {||
- let cmd = (commandline)
- if ($cmd | is-empty) {
- return
- }
- if not ($cmd | str starts-with $ATUIN_KEYBINDING_TOKEN) {
- let-env ATUIN_HISTORY_ID = (atuin history start -- $cmd)
- }
-}
-
-let _atuin_pre_prompt = {||
- let last_exit = $env.LAST_EXIT_CODE
- if 'ATUIN_HISTORY_ID' not-in $env {
- return
- }
- with-env { RUST_LOG: error } {
- atuin history end $'--exit=($last_exit)' -- $env.ATUIN_HISTORY_ID | null
- }
-}
-
-def _atuin_search_cmd [...flags: string] {
- [
- $ATUIN_KEYBINDING_TOKEN,
- ([
- `commandline (RUST_LOG=error run-external --redirect-stderr atuin search`,
- ($flags | append [--interactive, --] | each {|e| $'"($e)"'}),
- `(commandline) | complete | $in.stderr | str substring ..-1)`,
- ] | flatten | str join ' '),
- ] | str join "\n"
-}
-
-let-env config = (
- $env.config | upsert hooks (
- $env.config.hooks
- | upsert pre_execution ($env.config.hooks.pre_execution | append $_atuin_pre_execution)
- | upsert pre_prompt ($env.config.hooks.pre_prompt | append $_atuin_pre_prompt)
- )
-)
diff --git a/src/shell/atuin.zsh b/src/shell/atuin.zsh
deleted file mode 100644
index b0e160ff..00000000
--- a/src/shell/atuin.zsh
+++ /dev/null
@@ -1,57 +0,0 @@
-# shellcheck disable=SC2034,SC2153,SC2086,SC2155
-
-# Above line is because shellcheck doesn't support zsh, per
-# https://github.com/koalaman/shellcheck/wiki/SC1071, and the ignore: param in
-# ludeeus/action-shellcheck only supports _directories_, not _files_. So
-# instead, we manually add any error the shellcheck step finds in the file to
-# the above line ...
-
-# Source this in your ~/.zshrc
-autoload -U add-zsh-hook
-
-export ATUIN_SESSION=$(atuin uuid)
-export ATUIN_HISTORY="atuin history list"
-
-_atuin_preexec() {
- local id
- id=$(atuin history start -- "$1")
- export ATUIN_HISTORY_ID="$id"
-}
-
-_atuin_precmd() {
- local EXIT="$?"
-
- [[ -z "${ATUIN_HISTORY_ID}" ]] && return
-
- (RUST_LOG=error atuin history end --exit $EXIT -- $ATUIN_HISTORY_ID &) >/dev/null 2>&1
-}
-
-_atuin_search() {
- emulate -L zsh
- zle -I
-
- # Switch to cursor mode, then back to application
- echoti rmkx
- # swap stderr and stdout, so that the tui stuff works
- # TODO: not this
- # shellcheck disable=SC2048
- output=$(RUST_LOG=error atuin search $* -i -- $BUFFER 3>&1 1>&2 2>&3)
- echoti smkx
-
- if [[ -n $output ]]; then
- RBUFFER=""
- LBUFFER=$output
- fi
-
- zle reset-prompt
-}
-
-_atuin_up_search() {
- _atuin_search --shell-up-key-binding
-}
-
-add-zsh-hook preexec _atuin_preexec
-add-zsh-hook precmd _atuin_precmd
-
-zle -N _atuin_search_widget _atuin_search
-zle -N _atuin_up_search_widget _atuin_up_search