From 5d6c3501663e4a2779e3c529a8940da0d16dd115 Mon Sep 17 00:00:00 2001
From: Ahmad Awais <mrahmadawais@gmail.com>
Date: Mon, 15 Aug 2016 05:55:02 +0500
Subject: [PATCH] =?UTF-8?q?Enhancement:=20Show/Hide=20OSX=20hidden=20files?=
 =?UTF-8?q?=20=F0=9F=92=AF=20(#5275)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 plugins/osx/README.md      | 22 ++++++++++++----------
 plugins/osx/osx.plugin.zsh |  4 ++++
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/plugins/osx/README.md b/plugins/osx/README.md
index a06184a45..6de2b061e 100644
--- a/plugins/osx/README.md
+++ b/plugins/osx/README.md
@@ -15,13 +15,15 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
 
 ## Commands
 
-| Command       | Description                                    |
-|:--------------|:-----------------------------------------------|
-| `tab`         | Open the current directory in a new tab        |
-| `ofd`         | Open the current directory in a Finder window  |
-| `pfd`         | Return the path of the frontmost Finder window |
-| `pfs`         | Return the current Finder selection            |
-| `cdf`         | `cd` to the current Finder directory           |
-| `pushdf`      | `pushd` to the current Finder directory        |
-| `quick-look`  | Quick-Look a specified file                    |
-| `man-preview` | Open a specified man page in Preview app       |
+| Command         | Description                                      |
+| :-------------- | :----------------------------------------------- |
+| `tab`           | Open the current directory in a new tab          |
+| `ofd`           | Open the current directory in a Finder window    |
+| `pfd`           | Return the path of the frontmost Finder window   |
+| `pfs`           | Return the current Finder selection              |
+| `cdf`           | `cd` to the current Finder directory             |
+| `pushdf`        | `pushd` to the current Finder directory          |
+| `quick-look`    | Quick-Look a specified file                      |
+| `man-preview`   | Open a specified man page in Preview app         |
+| `showfiles`     | Show hidden files                                |
+| `hidefiles`     | Hide the hidden files                            |
diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
index 4dbc75787..f69bd7e5d 100644
--- a/plugins/osx/osx.plugin.zsh
+++ b/plugins/osx/osx.plugin.zsh
@@ -260,3 +260,7 @@ EOF
 	esac
 	osascript -e "tell application \"iTunes\" to $opt"
 }
+
+# Show/hide hidden files in the Finder
+alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
+alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"