Improved preview window for fzf

This commit is contained in:
Ajeet D'Souza 2022-07-27 14:01:14 +05:30
parent 1306fba4ac
commit e4b9e12b0f
3 changed files with 15 additions and 5 deletions

View File

@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fish: change fuzzy completion prefix to `z!`.
- Zsh: allow `z` to navigate dirstack via `+n` and `-n`.
- Fzf: improved preview window.
## [0.8.2] - 2022-06-26

View File

@ -54,8 +54,17 @@ impl Fzf {
"--bind=ctrl-z:ignore",
]);
if cfg!(unix) {
command.env("SHELL", "sh");
command.args(&[r"--preview=\command -p ls -p {2..}", "--preview-window=down"]);
// Non-POSIX args are only available on certain operating systems.
const LS_ARGS: &str = if cfg!(target_os = "linux") {
"--color=always --group-directories-first"
} else if cfg!(target_os = "macos") {
"--color=always"
} else {
""
};
command
.args(&[&format!(r"--preview=\command -p ls -Cp {LS_ARGS} {{2..}}"), "--preview-window=down,30%"])
.env("SHELL", "sh");
}
}

View File

@ -114,14 +114,14 @@ end
{%- when Some with (cmd) %}
abbr --erase {{cmd}} &>/dev/null
complete -c {{cmd}} -e
complete --command {{cmd}} --erase
function {{cmd}}
__zoxide_z $argv
end
complete -c {{cmd}} -f -a '(__zoxide_z_complete)'
complete --command {{cmd}} --no-files --arguments '(__zoxide_z_complete)'
abbr --erase {{cmd}}i &>/dev/null
complete -c {{cmd}}i -e
complete --command {{cmd}}i --erase
function {{cmd}}i
__zoxide_zi $argv
end