extend cdf and pwdf ignore patterns
This commit is contained in:
parent
fe63681d7c
commit
883810a8b2
1 changed files with 10 additions and 3 deletions
|
|
@ -1,5 +1,12 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
fdIgnorePatterns = [
|
||||||
|
"Documents/app-state"
|
||||||
|
"Library"
|
||||||
|
];
|
||||||
|
fdExcludes = lib.concatMapStrings (p: "-E ${lib.escapeShellArg p} ") fdIgnorePatterns;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -93,7 +100,7 @@
|
||||||
function cdf() {
|
function cdf() {
|
||||||
local search_dir="''${1:-~}"
|
local search_dir="''${1:-~}"
|
||||||
local target
|
local target
|
||||||
target=$(echo "" | fzf --bind "change:reload:fd --follow -E Documents/app-state {q} ''$search_dir 2>/dev/null || true" --header="Type to search, Enter to cd" --preview '([[ -d {} ]] && ls -la {}) || ([[ -f {} ]] && head -20 {})' --height 40% --ansi)
|
target=$(echo "" | fzf --bind "change:reload:fd --follow ${fdExcludes}{q} ''$search_dir 2>/dev/null || true" --header="Type to search, Enter to cd" --preview '([[ -d {} ]] && ls -la {}) || ([[ -f {} ]] && head -20 {})' --height 40% --ansi)
|
||||||
if [[ -n "$target" ]]; then
|
if [[ -n "$target" ]]; then
|
||||||
[[ -d "$target" ]] && cd "$target" || cd "$(dirname "$target")"
|
[[ -d "$target" ]] && cd "$target" || cd "$(dirname "$target")"
|
||||||
fi
|
fi
|
||||||
|
|
@ -103,7 +110,7 @@
|
||||||
function pwdf() {
|
function pwdf() {
|
||||||
local search_dir="''${1:-~}"
|
local search_dir="''${1:-~}"
|
||||||
local target
|
local target
|
||||||
target=$(echo "" | fzf --bind "change:reload:fd --follow -E Documents/app-state {q} ''$search_dir 2>/dev/null || true" --header="Type to search, Enter to print path" --preview '([[ -d {} ]] && ls -la {}) || ([[ -f {} ]] && head -20 {})' --height 40% --ansi)
|
target=$(echo "" | fzf --bind "change:reload:fd --follow ${fdExcludes}{q} ''$search_dir 2>/dev/null || true" --header="Type to search, Enter to print path" --preview '([[ -d {} ]] && ls -la {}) || ([[ -f {} ]] && head -20 {})' --height 40% --ansi)
|
||||||
if [[ -n "$target" ]]; then
|
if [[ -n "$target" ]]; then
|
||||||
echo "$target"
|
echo "$target"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue