Use better defaults for fzf
This commit is contained in:
parent
c392a8bb75
commit
3e03ccccd6
|
|
@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Better defaults for `fzf`.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- PowerShell: use global scope for aliases.
|
- PowerShell: use global scope for aliases.
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.44"
|
version = "1.0.51"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "61604a8f862e1d5c3229fdd78f8b02c68dcf73a4c4b05fd636d12240aaa242c1"
|
checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arrayvec"
|
name = "arrayvec"
|
||||||
|
|
@ -112,9 +112,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitvec"
|
name = "bitvec"
|
||||||
version = "0.19.5"
|
version = "0.19.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8942c8d352ae1838c9dda0b0ca2ab657696ef2232a20147cf1b30ae1a9cb4321"
|
checksum = "55f93d0ef3363c364d5976646a38f04cf67cfe1d4c8d160cdea02cab2c116b33"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"funty",
|
"funty",
|
||||||
"radium",
|
"radium",
|
||||||
|
|
@ -206,20 +206,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8"
|
checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dirs-next"
|
name = "dirs"
|
||||||
version = "2.0.0"
|
version = "4.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
|
checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"dirs-sys",
|
||||||
"dirs-sys-next",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dirs-sys-next"
|
name = "dirs-sys"
|
||||||
version = "0.1.2"
|
version = "0.3.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
|
checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"redox_users",
|
"redox_users",
|
||||||
|
|
@ -368,9 +367,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.104"
|
version = "0.2.108"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7b2f96d100e1cf1929e7719b7edb3b90ab5298072638fccd77be9ce942ecdfce"
|
checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
|
|
@ -435,15 +434,15 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ppv-lite86"
|
name = "ppv-lite86"
|
||||||
version = "0.2.14"
|
version = "0.2.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c3ca011bd0129ff4ae15cd04c4eef202cadf6c51c21e47aba319b4e0501db741"
|
checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "predicates"
|
name = "predicates"
|
||||||
version = "2.0.3"
|
version = "2.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5c6ce811d0b2e103743eec01db1c50612221f173084ce2f7941053e94b6bb474"
|
checksum = "95e5a7689e456ab905c22c2b48225bb921aba7c8dfa58440d68ba13f6222a715"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"difflib",
|
"difflib",
|
||||||
"itertools",
|
"itertools",
|
||||||
|
|
@ -492,9 +491,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.30"
|
version = "1.0.32"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "edc3358ebc67bc8b7fa0c007f945b0b18226f78437d61bec735a9eb96b61ee70"
|
checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|
@ -629,9 +628,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ryu"
|
name = "ryu"
|
||||||
version = "1.0.5"
|
version = "1.0.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
|
checksum = "3c9613b5a66ab9ba26415184cfc41156594925a9cf3a2057e57f31ff145f6568"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "same-file"
|
name = "same-file"
|
||||||
|
|
@ -688,9 +687,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.80"
|
version = "1.0.82"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d010a1623fbd906d51d650a9916aaefc05ffa0e4053ff7fe601167f3e715d194"
|
checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
@ -728,9 +727,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "termtree"
|
name = "termtree"
|
||||||
version = "0.2.1"
|
version = "0.2.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "78fbf2dd23e79c28ccfa2472d3e6b3b189866ffef1aeb91f17c2d968b6586378"
|
checksum = "13a4ec180a2de59b57434704ccfad967f789b12737738798fa08798cd5824c16"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "textwrap"
|
name = "textwrap"
|
||||||
|
|
@ -867,7 +866,7 @@ dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"clap_generate",
|
"clap_generate",
|
||||||
"clap_generate_fig",
|
"clap_generate_fig",
|
||||||
"dirs-next",
|
"dirs",
|
||||||
"dunce",
|
"dunce",
|
||||||
"glob",
|
"glob",
|
||||||
"ordered-float",
|
"ordered-float",
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ anyhow = "1.0.32"
|
||||||
askama = { version = "0.10.3", default-features = false }
|
askama = { version = "0.10.3", default-features = false }
|
||||||
bincode = "1.3.1"
|
bincode = "1.3.1"
|
||||||
clap = "=3.0.0-beta.5"
|
clap = "=3.0.0-beta.5"
|
||||||
dirs-next = "2.0.0"
|
dirs = "4.0.0"
|
||||||
dunce = "1.0.1"
|
dunce = "1.0.1"
|
||||||
glob = "0.3.0"
|
glob = "0.3.0"
|
||||||
ordered-float = "2.0.0"
|
ordered-float = "2.0.0"
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ Alternatively, you can use a package manager:
|
||||||
| Manjaro | | `pacman -S zoxide` |
|
| Manjaro | | `pacman -S zoxide` |
|
||||||
| NixOS | [nixpkgs] | `nix-env -iA nixpkgs.zoxide` |
|
| NixOS | [nixpkgs] | `nix-env -iA nixpkgs.zoxide` |
|
||||||
| Parrot OS | | `apt install zoxide` |
|
| Parrot OS | | `apt install zoxide` |
|
||||||
|
| Raspbian 11+ | [Raspbian Packages] | `apt install zoxide` |
|
||||||
| Ubuntu 21.04+ | [Ubuntu Packages] | `apt install zoxide` |
|
| Ubuntu 21.04+ | [Ubuntu Packages] | `apt install zoxide` |
|
||||||
| Void Linux | [Void Linux Packages] | `xbps-install -S zoxide` |
|
| Void Linux | [Void Linux Packages] | `xbps-install -S zoxide` |
|
||||||
|
|
||||||
|
|
@ -376,6 +377,7 @@ They must be set before `zoxide init` is called.
|
||||||
[pkgsrc]: https://pkgsrc.se/sysutils/zoxide
|
[pkgsrc]: https://pkgsrc.se/sysutils/zoxide
|
||||||
[ranger-zoxide]: https://github.com/jchook/ranger-zoxide
|
[ranger-zoxide]: https://github.com/jchook/ranger-zoxide
|
||||||
[ranger]: https://github.com/ranger/ranger
|
[ranger]: https://github.com/ranger/ranger
|
||||||
|
[raspbian packages]: https://archive.raspbian.org/raspbian/pool/main/r/rust-zoxide/
|
||||||
[releases]: https://github.com/ajeetdsouza/zoxide/releases
|
[releases]: https://github.com/ajeetdsouza/zoxide/releases
|
||||||
[scoop]: https://github.com/ScoopInstaller/Main/tree/master/bucket/zoxide.json
|
[scoop]: https://github.com/ScoopInstaller/Main/tree/master/bucket/zoxide.json
|
||||||
[telescope-zoxide]: https://github.com/jvgrootveld/telescope-zoxide
|
[telescope-zoxide]: https://github.com/jvgrootveld/telescope-zoxide
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use std::ffi::OsString;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use anyhow::{bail, Context, Result};
|
use anyhow::{bail, Context, Result};
|
||||||
use dirs_next as dirs;
|
use dirs;
|
||||||
use glob::Pattern;
|
use glob::Pattern;
|
||||||
|
|
||||||
use crate::db::Rank;
|
use crate::db::Rank;
|
||||||
|
|
|
||||||
13
src/fzf.rs
13
src/fzf.rs
|
|
@ -19,6 +19,19 @@ impl Fzf {
|
||||||
command.arg("-n2..").stdin(Stdio::piped()).stdout(Stdio::piped());
|
command.arg("-n2..").stdin(Stdio::piped()).stdout(Stdio::piped());
|
||||||
if let Some(fzf_opts) = config::fzf_opts() {
|
if let Some(fzf_opts) = config::fzf_opts() {
|
||||||
command.env("FZF_DEFAULT_OPTS", fzf_opts);
|
command.env("FZF_DEFAULT_OPTS", fzf_opts);
|
||||||
|
} else {
|
||||||
|
command.args(&[
|
||||||
|
"--bind=ctrl-z:ignore",
|
||||||
|
"--exit-0",
|
||||||
|
"--height=35%",
|
||||||
|
"--inline-info",
|
||||||
|
"--no-sort",
|
||||||
|
"--reverse",
|
||||||
|
"--select-1",
|
||||||
|
]);
|
||||||
|
if cfg!(unix) {
|
||||||
|
command.arg("--preview=ls -p {2}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let child = match command.spawn() {
|
let child = match command.spawn() {
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,5 @@
|
||||||
use crate::app::InitHook;
|
use crate::app::InitHook;
|
||||||
|
|
||||||
const FZF_COMPLETE_OPTS: &str = "\
|
|
||||||
--bind=ctrl-z:ignore \
|
|
||||||
--exit-0 \
|
|
||||||
--height=35% \
|
|
||||||
--inline-info \
|
|
||||||
--no-sort \
|
|
||||||
--reverse \
|
|
||||||
--select-1";
|
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Debug, Eq, PartialEq)]
|
||||||
pub struct Opts<'a> {
|
pub struct Opts<'a> {
|
||||||
pub cmd: Option<&'a str>,
|
pub cmd: Option<&'a str>,
|
||||||
|
|
|
||||||
|
|
@ -127,10 +127,8 @@ if [[ :"${SHELLOPTS}": =~ :(vi|emacs): && ${TERM} != 'dumb' ]]; then
|
||||||
# If there is a space after the last word, use interactive selection.
|
# If there is a space after the last word, use interactive selection.
|
||||||
elif [[ -z ${COMP_WORDS[-1]} ]]; then
|
elif [[ -z ${COMP_WORDS[-1]} ]]; then
|
||||||
\local result
|
\local result
|
||||||
result="$(
|
result="$(\builtin command zoxide query -i -- "${COMP_WORDS[@]:1}")" &&
|
||||||
_ZO_FZF_OPTS='{{ crate::shell::FZF_COMPLETE_OPTS }}' \
|
COMPREPLY=("${__zoxide_z_prefix}${result}")
|
||||||
\builtin command zoxide query -i -- "${COMP_WORDS[@]:1}"
|
|
||||||
)" && COMPREPLY=("${__zoxide_z_prefix}${result}")
|
|
||||||
\builtin printf '\e[5n'
|
\builtin printf '\e[5n'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ function __zoxide_z_complete
|
||||||
else
|
else
|
||||||
# Otherwise, use interactive selection.
|
# Otherwise, use interactive selection.
|
||||||
set -l query $tokens[2..-1]
|
set -l query $tokens[2..-1]
|
||||||
set -l result (_ZO_FZF_OPTS='{{ crate::shell::FZF_COMPLETE_OPTS }}' zoxide query -i -- $query)
|
set -l result (zoxide query -i -- $query)
|
||||||
and commandline -p "$tokens[1] "(string escape $result)
|
and commandline -p "$tokens[1] "(string escape $result)
|
||||||
commandline -f repaint
|
commandline -f repaint
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue