Macbook 修改最近路徑列表 Recent Places 數量

Macbook Pro 打開文件時,會保存最近使用的路徑列表 —— Recent Places

有時候需要整理 Recent Places,清空或者設置最大保存長度,非常方便的保存最近的常用目錄,不必逐級選目錄

設置最近路徑列表 Recent Places 數量(NSNavRecentPlacesLimit),沒必要進入 root 權限(sudo -s),當前用戶即可

原文請參見米撲博客:Macbook Pro 如何清空/修改最近路徑列表 Recent Places 數量

 

一、清空 Recent Places

清空命令:

defaults delete -g NSNavRecentPlaces (慎用,最好不用)

清空後,最近路徑列表,將全部被清除了,包含最近默認5條路徑,也被清除了,即徹底空白

 

二、修改 Recent Places 的最大保存數量

設置最近路徑列表 Recent Places 數量(NSNavRecentPlacesLimit),沒必要進入 root 權限(sudo -s),當前用戶即可

1、查看保存數量

defaults read -g NSNavRecentPlacesLimit

查看示例:

$ defaults read -g NSNavRecentPlacesLimit 
30

 

2、設置保存數量(核心)

defaults write -g NSNavRecentPlacesLimit -int NUM

說明:NUM 就是要設置的最大保存數量,

例如:defaults write -g NSNavRecentPlacesLimit -int 30 (保存最近30個路徑列表,默認爲5個)

例如,保存最近路徑爲30條:

$ defaults write -g NSNavRecentPlacesLimit -int 30
$ defaults read -g NSNavRecentPlacesLimit         
30

 

3、取消最大保存數量設置 

defaults delete -g NSNavRecentPlacesLimit

使用示例:

$ defaults write -g NSNavRecentPlacesLimit -int 30      ### 設置
$ defaults read -g NSNavRecentPlacesLimit               ### 查看
30
$ 
$ defaults delete -g NSNavRecentPlacesLimit             ### 刪除
$ defaults read -g NSNavRecentPlacesLimit               ### 已刪除,再查看,報錯(已不存在)
2019-01-28 17:24:09.033 defaults[18540:20626393] 
The domain/default pair of (kCFPreferencesAnyApplication, NSNavRecentPlacesLimit) does not exist
$ 
$ defaults delete -g NSNavRecentPlacesLimit             ### 已刪除,再刪除,報錯(已不存在)
2019-10-28 17:24:10.993 defaults[18542:20626404] 
Domain (kCFPreferencesAnyApplication) not found.
Defaults have not been changed.
$ 
$ defaults write -g NSNavRecentPlacesLimit -int 30      ### 最後設置
$ defaults read -g NSNavRecentPlacesLimit               ### 查看 
30

 

How to Clear and Manage “Recent Places” In OS X

Whenever you save files to a specific location on your Mac, OS X will save this location in a “Recent Places” listing which will be available the next time you save another file. This feature allows quick access to the folders you commonly use and hence saves a lot of your precious work time.

By default, the recent places list will show you the past five most recently accessed folders. Now, while this may be convenient for some, it can become annoying, especially if you would just like to clear an item or the entire list. Unfortunately, the only way to do so via the OS X interface is to save items in at least five new locations, thus forcing the one you want to remove from the list.

 

This isn’t quite the best approach out there, and if you prefer to use another method, then you can use Terminal to remove the saved recent place entries from your OS X account. To do this:

1. Open Terminal on your OS X System.

 

2. Enter the following command to remove all the saved recent places:

defaults delete -g NSNavRecentPlaces

With this command, the Recent Places drop-down menu in the saved windows will be emptied and will then begin to populate with new folders as you save files to them.

Another tip for you is that you can also adjust the number of recent items that the system stores.

By default the number of items is five, but you can adjust this to a value of your liking with the following command:

defaults write -g NSNavRecentPlacesLimit -int NUM

Example:

defaults write -g NSNavRecentPlacesLimit -int 30

Here, simply replace NUM will the number of entries you want. Entering Zero will disable the recent places list.

 

Additionally, you can run the following command to remove the limit:

defaults delete -g NSNavRecentPlacesLimit

 

Did this work for you?

Be sure to tell us in the comments below!

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章