Fixes for elvish 0.16.0 (#255)

This commit is contained in:
Ajeet D'Souza 2021-08-24 02:00:34 +05:30 committed by GitHub
parent bc57339473
commit 6be3998bb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 8 deletions

View File

@ -7,6 +7,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Fixed
- Elvish: unable to `z` into directories by path.
- Elvish: don't show traceback when `z` or `zi` fails.
## [0.7.4] - 2020-08-15
### Fixed

View File

@ -149,6 +149,8 @@ Add this to your configuration (usually `~/.elvish/rc.elv`):
eval (zoxide init elvish | slurp)
```
Note that zoxide only supports elvish v0.16.0+.
</details>
<details>
@ -163,7 +165,7 @@ zoxide init fish | source
</details>
<details>
<summary><code>nushell v0.33+</code></summary>
<summary><code>nushell</code></summary>
Add this to your configuration (find it by running `config path` in Nushell):
@ -172,7 +174,8 @@ prompt = "__zoxide_hook;__zoxide_prompt"
startup = ["zoxide init nushell --hook prompt | save ~/.zoxide.nu", "source ~/.zoxide.nu"]
```
You can replace `__zoxide_prompt` with a custom prompt.
You can replace `__zoxide_prompt` with a custom prompt. Note that zoxide only
supports Nushell v0.33.0+.
</details>

View File

@ -1,7 +1,7 @@
let
rust = import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/ad311f5bb5c5ef475985f1e0f264e831470a8510.tar.gz");
pkgs = import <nixpkgs> { overlays = [ rust ]; };
pkgs-latest = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/1359293549af4f8ca536716d0432f3cdd0afe0c6.tar.gz") {};
pkgs-latest = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/b4692e4197869c42c46d77e31af7e687e1892f55.tar.gz") {};
pkgs-python = pkgs-latest.python3.withPackages (pkgs: [ pkgs.black pkgs.mypy pkgs.pylint ]);
in
pkgs.mkShell {

View File

@ -49,17 +49,29 @@ fn __zoxide_z [@rest]{
__zoxide_cd ~
} elif (builtin:eq [-] $rest) {
__zoxide_cd (builtin:get-env __zoxide_oldpwd)
} elif (and (builtin:eq (builtin:count $rest) 1) (path:is-dir $rest[0])) {
} elif (and ('builtin:==' (builtin:count $rest) 1) (path:is-dir &follow-symlink=$true $rest[0])) {
__zoxide_cd $rest[0]
} else {
__zoxide_cd (zoxide query --exclude $pwd -- $@rest)
var path
try {
path = (zoxide query --exclude $pwd -- $@rest)
} except {
} else {
__zoxide_cd $path
}
}
}
edit:add-var __zoxide_z~ $__zoxide_z~
# Jump to a directory using interactive search.
fn __zoxide_zi [@rest]{
__zoxide_cd (zoxide query -i -- $@rest)
var path
try {
path = (zoxide query -i -- $@rest)
} except {
} else {
__zoxide_cd $path
}
}
edit:add-var __zoxide_zi~ $__zoxide_zi~
@ -83,4 +95,6 @@ edit:add-var zi~ $__zoxide_zi~
# To initialize zoxide, add this to your configuration (usually
# ~/.elvish/rc.elv):
#
# eval (zoxide init elvish | slurp)
# eval (zoxide init elvish | slurp)
#
# Note that zoxide only supports elvish v0.16.0+.

View File

@ -101,4 +101,5 @@ alias {{cmd}}i = __zoxide_zi
# prompt = '__zoxide_hook;__zoxide_prompt'
# startup = ['zoxide init nushell --hook prompt | save ~/.zoxide.nu', 'source ~/.zoxide.nu']
#
# You can replace __zoxide_prompt with a custom prompt.
# You can replace __zoxide_prompt with a custom prompt. Note that zoxide only
# supports Nushell v0.33.0+.