From e97279e5a475316112437feacb29b1971129cc88 Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Tue, 29 Jul 2025 21:59:01 +0200 Subject: [PATCH] Revise papis alias --- README.md | 15 +++++++++------ modules/papis.nix | 17 ++++++++++++++--- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index dbeb229..1ff7a82 100644 --- a/README.md +++ b/README.md @@ -463,15 +463,18 @@ papis list --format '{doc[author]} - {doc[title]} ({doc[year]})' **Workflow Aliases:** ```bash # Bibliography formatting -papis-info # List documents with formatted template -papis-info "machine learning" # Search and format specific documents +pals # List documents with formatted template +pals "machine learning" # Search and format specific documents # File operations -papis-add-file filename.pdf [query] # Add file from ~/Downloads/ to existing entry -papis-add-url [url] [query] # Add file from URL to existing entry +pafile filename.pdf [query] # Add file from ~/Downloads/ to existing entry +paurl [url] [query] # Add file from URL to existing entry -# Directory access -papis-finder [query] # Open document directory in Finder +# Directory access (shell function) +pafinder # Open first document directory in Finder +pafinder "query" # Open first matching document directory +pafinder author:einstein # Open first Einstein paper directory +pafinder --sort year smith # Open newest Smith paper directory ``` **Configuration location**: `modules/papis.nix` with embedded configuration diff --git a/modules/papis.nix b/modules/papis.nix index 7da4888..66d7ff9 100644 --- a/modules/papis.nix +++ b/modules/papis.nix @@ -54,8 +54,19 @@ # File operations pafile = "papis addto -f ~/Downloads/"; paurl = "papis addto -u"; - - # Finder integration - pafinder = "open -R $(papis list)"; }; + + # Shell functions for papis workflow + programs.zsh.initExtra = '' + # Papis finder function - open document directory in Finder with query support + pafinder() { + local result=$(papis list "$@" | head -1) + if [ -n "$result" ]; then + open -R "$result" + else + echo "No documents found" + return 1 + fi + } + ''; }