fixed the fzf history

This commit is contained in:
Rouven Seifert 2023-04-21 20:32:30 +02:00
parent bfd108d5a7
commit 84c821c66a
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09

View file

@ -34,18 +34,9 @@
theme = "agnoster"; theme = "agnoster";
}; };
interactiveShellInit = shellInit =
'' ''
source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh
function c() {
if [ $# -eq 0 ]; then
cd $(find -maxdepth 4 -not -path '*[cC]ache*' -not -path '*[tT]rash*' -type d | fzf --preview '${pkgs.tree}/bin/tree -C {}')
else
$1 $(find -maxdepth 5 -not -path '*[cC]ache*' -not -path '*[tT]rash*' | fzf --preview '${pkgs.tree}/bin/tree -C {}')
fi
}
function svpn() { function svpn() {
unit=$(systemctl list-unit-files | grep "openconnect\|wg-quick\|wireguard\|openvpn" | cut -d "." -f1 | fzf --preview 'systemctl status {}') unit=$(systemctl list-unit-files | grep "openconnect\|wg-quick\|wireguard\|openvpn" | cut -d "." -f1 | fzf --preview 'systemctl status {}')
if [ $(systemctl is-active $unit) = "inactive" ]; then if [ $(systemctl is-active $unit) = "inactive" ]; then
@ -60,6 +51,13 @@
} }
cat ${../images/cat.sixel} cat ${../images/cat.sixel}
''; '';
# Hacky way to bind Ctrl+R to fzf. Otherwise it will be overridden
promptInit =
''
source ${pkgs.fzf}/share/fzf/completion.zsh
source ${pkgs.fzf}/share/fzf/key-bindings.zsh
'';
}; };
} }