mirror of
https://github.com/atuinsh/atuin.git
synced 2025-08-04 18:58:13 +00:00
fix: atuin.nu
enchancements (#2778)
Some checks failed
Codespell / Check for spelling errors (push) Has been cancelled
build-docker / publish_x86 (push) Has been cancelled
build-docker / publish_aarch64 (push) Has been cancelled
Install / install (macos-14) (push) Has been cancelled
Install / install (ubuntu-latest) (push) Has been cancelled
Nix / check (push) Has been cancelled
Nix / build-test (push) Has been cancelled
Rust / build (macos-14) (push) Has been cancelled
Rust / build (ubuntu-latest) (push) Has been cancelled
Rust / cross-compile (x86_64-unknown-illumos) (push) Has been cancelled
Rust / unit-test (macos-14) (push) Has been cancelled
Rust / unit-test (ubuntu-latest) (push) Has been cancelled
Rust / check (macos-14) (push) Has been cancelled
Rust / check (ubuntu-latest) (push) Has been cancelled
Rust / integration-test (push) Has been cancelled
Rust / clippy (push) Has been cancelled
Rust / format (push) Has been cancelled
Shellcheck / shellcheck (push) Has been cancelled
build-docker / publish_manifest (push) Has been cancelled
Some checks failed
Codespell / Check for spelling errors (push) Has been cancelled
build-docker / publish_x86 (push) Has been cancelled
build-docker / publish_aarch64 (push) Has been cancelled
Install / install (macos-14) (push) Has been cancelled
Install / install (ubuntu-latest) (push) Has been cancelled
Nix / check (push) Has been cancelled
Nix / build-test (push) Has been cancelled
Rust / build (macos-14) (push) Has been cancelled
Rust / build (ubuntu-latest) (push) Has been cancelled
Rust / cross-compile (x86_64-unknown-illumos) (push) Has been cancelled
Rust / unit-test (macos-14) (push) Has been cancelled
Rust / unit-test (ubuntu-latest) (push) Has been cancelled
Rust / check (macos-14) (push) Has been cancelled
Rust / check (ubuntu-latest) (push) Has been cancelled
Rust / integration-test (push) Has been cancelled
Rust / clippy (push) Has been cancelled
Rust / format (push) Has been cancelled
Shellcheck / shellcheck (push) Has been cancelled
build-docker / publish_manifest (push) Has been cancelled
This commit is contained in:
parent
2814c2031c
commit
2e26f34687
1 changed files with 20 additions and 16 deletions
|
@ -1,5 +1,14 @@
|
|||
# Source this in your ~/.config/nushell/config.nu
|
||||
$env.ATUIN_SESSION = (atuin uuid)
|
||||
# minimum supported version = 0.93.0
|
||||
module compat {
|
||||
export def --wrapped "random uuid -v 7" [...rest] { atuin uuid }
|
||||
}
|
||||
use (if not (
|
||||
(version).major > 0 or
|
||||
(version).minor >= 103
|
||||
) { "compat" }) *
|
||||
|
||||
$env.ATUIN_SESSION = (random uuid -v 7 | str replace -a "-" "")
|
||||
hide-env -i ATUIN_HISTORY_ID
|
||||
|
||||
# Magic token to make sure we don't record commands run by keybindings
|
||||
|
@ -24,32 +33,27 @@ let _atuin_pre_prompt = {||
|
|||
return
|
||||
}
|
||||
with-env { ATUIN_LOG: error } {
|
||||
do { atuin history end $'--exit=($last_exit)' -- $env.ATUIN_HISTORY_ID } | complete
|
||||
if (version).minor >= 104 or (version).major > 0 {
|
||||
job spawn -t atuin {
|
||||
^atuin history end $'--exit=($env.LAST_EXIT_CODE)' -- $env.ATUIN_HISTORY_ID | complete
|
||||
} | ignore
|
||||
} else {
|
||||
do { atuin history end $'--exit=($last_exit)' -- $env.ATUIN_HISTORY_ID } | complete
|
||||
}
|
||||
|
||||
}
|
||||
hide-env ATUIN_HISTORY_ID
|
||||
}
|
||||
|
||||
def _atuin_search_cmd [...flags: string] {
|
||||
let nu_version = do {
|
||||
let version = version
|
||||
let major = $version.major?
|
||||
if $major != null {
|
||||
# These members are only available in versions > 0.92.2
|
||||
[$major $version.minor $version.patch]
|
||||
} else {
|
||||
# So fall back to the slower parsing when they're missing
|
||||
$version.version | split row '.' | into int
|
||||
}
|
||||
}
|
||||
[
|
||||
$ATUIN_KEYBINDING_TOKEN,
|
||||
([
|
||||
`with-env { ATUIN_LOG: error, ATUIN_QUERY: (commandline) } {`,
|
||||
(if $nu_version.0 <= 0 and $nu_version.1 <= 90 { 'commandline' } else { 'commandline edit' }),
|
||||
(if $nu_version.1 >= 92 { '(run-external atuin search' } else { '(run-external --redirect-stderr atuin search' }),
|
||||
'commandline edit',
|
||||
'(run-external atuin search',
|
||||
($flags | append [--interactive] | each {|e| $'"($e)"'}),
|
||||
(if $nu_version.1 >= 92 { ' e>| str trim)' } else {' | complete | $in.stderr | str substring ..-1)'}),
|
||||
' e>| str trim)',
|
||||
`}`,
|
||||
] | flatten | str join ' '),
|
||||
] | str join "\n"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue