From 4751bb83586eaf71d625b090aeedfe8fa0dbbd42 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Sat, 28 Dec 2024 23:56:09 -0800 Subject: [PATCH] feat: add vault quick access script --- reference/users/youwen/hm.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/reference/users/youwen/hm.nix b/reference/users/youwen/hm.nix index 7690e99..8a15215 100644 --- a/reference/users/youwen/hm.nix +++ b/reference/users/youwen/hm.nix @@ -60,4 +60,23 @@ text/html; ${pkgs.w3m}/bin/w3m %s; nametemplate=%s.html; needsterminal text/html; ${pkgs.w3m}/bin/w3m -v -F -T text/html -dump %s; copiousoutput ''; + + programs.fish.functions = { + vault = '' + set vault_dir $HOME/Documents/vaults/vault + + if test -d $vault_dir + cd $vault_dir + git pull + vim + else + echo "Vault is not yet cloned. Cloning repository now." + mkdir -p $HOME/Documents/vaults + cd $HOME/Documents/vaults + git clone git@code.youwen.dev:youwen5/vault.git + cd $vault_dir + vim + end + ''; + }; }