From 9bb15d681a3734108e92b1b59a93acec5c8a5198 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 10 Sep 2026 04:48:50 -0700 Subject: [PATCH] fix(common-aliases): open documents with the platform's opener (#14051) --- plugins/common-aliases/README.md | 21 +++++++++++-------- .../common-aliases/common-aliases.plugin.zsh | 9 +++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/plugins/common-aliases/README.md b/plugins/common-aliases/README.md index 79e3d0d0f..83d86edff 100644 --- a/plugins/common-aliases/README.md +++ b/plugins/common-aliases/README.md @@ -99,18 +99,21 @@ $ find . -type f 2>/dev/null ## File extension aliases These are special aliases that are triggered when a file name is passed as the command. For example, -if the pdf file extension is aliased to `acroread` (a popular Linux pdf reader), when running `file.pdf` -that file will be open with `acroread`. +if the pdf file extension is aliased to `open_command`, running `file.pdf` opens that file with +whatever application your system uses for PDFs. ### Reading Docs -| Alias | Command | Description | -| ----- | ---------- | ---------------------------------- | -| pdf | `acroread` | Opens up a document using acroread | -| ps | `gv` | Opens up a .ps file using gv | -| dvi | `xdvi` | Opens up a .dvi file using xdvi | -| chm | `xchm` | Opens up a .chm file using xchm | -| djvu | `djview` | Opens up a .djvu file using djview | +These use `open_command`, which picks the right opener for your platform: `open` on macOS, +`xdg-open` on Linux, `cygstart` on Cygwin. + +| Alias | Command | Description | +| ----- | -------------- | ----------------------------------------------- | +| pdf | `open_command` | Opens up a .pdf file in your default viewer | +| ps | `open_command` | Opens up a .ps file in your default viewer | +| dvi | `open_command` | Opens up a .dvi file in your default viewer | +| chm | `open_command` | Opens up a .chm file in your default viewer | +| djvu | `open_command` | Opens up a .djvu file in your default viewer | ### Listing files inside a packed file diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index 8db4b9557..21587eafd 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -71,12 +71,9 @@ if is-at-least 4.2.0; then _media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm) for ft in $_media_fts; do alias -s $ft=mplayer; done - #read documents - alias -s pdf=acroread - alias -s ps=gv - alias -s dvi=xdvi - alias -s chm=xchm - alias -s djvu=djview + # read documents with the platform's default application + _doc_fts=(pdf ps dvi chm djvu) + for ft in $_doc_fts; do alias -s $ft=open_command; done #list what's inside packed file alias -s zip="unzip -l"