Как увеличить количество последних файлов в Sublime Text 3?
Возможно ли увеличить количество последних файлов, появившихся в меню "Файл → Открыть" в Sublime Text 3 (Ubuntu)?
Я уже прочитал Увеличить количество последних проектов в Sublime Text 2?
И я не могу найти эту папку ~/Library на своем ПК. Я могу найти ~/.config/sublime-text-3/Packages, но внутри не существует подпапки Default.
Ответы
Ответ 1
Пакет по умолчанию в Sublime Text 3 в Linux сохраняется (если вы использовали установщик .deb) /opt/sublime_text/Packages/Default.sublime-package
.
Default.sublime-package
- это ZIP файл, если вы его открываете и извлекаете из него Main.sublime-menu
файл в ~/.config/sublime-text-3/Packages/Default/Main.sublime-menu
, его можно отредактировать так же, как описывается связанный ответ.
В качестве альтернативы выполните следующие команды, которые создадут каталог по умолчанию и извлекут в него файл Main.sublime-menu
:
mkdir ~/.config/sublime-text-3/Packages/Default/
unzip -p /opt/sublime_text/Packages/Default.sublime-package Main.sublime-menu > ~/.config/sublime-text-3/Packages/Default/Main.sublime-menu
Ответ 2
В OSX, по крайней мере, пакет Default.sublime находится в самом приложении: /Applications/Sublime Text.app/Contents/MacOS/Packages/Default.sublime-package
.
Чтобы легко отредактировать конфигурацию без изменений, которые были перезаписаны при обновлении, вам понадобится копия Main.sublime-меню в вашем каталоге пакетов ~/Library/Application Support/Sublime Text 3/Packages/Default/Main.sublime-menu
Самый простой способ добиться этих изменений - установить отличный PackageResourceViewer с помощью skuroda (с помощью управления пакетами), затем:
- Command + Shift + P
- введите "ресурс" и выберите " PackageResourceViewer: открыть ресурс"
- вы видите список доступных пакетов: выберите " По умолчанию"
- выберите ' Main.sublime-menu
- PackageResourceViewer теперь копирует
Main.sublime-menu
в нужное место и открывает новый файл для редактирования.
-
В соответствии с ответом Rufus_12 измените количество выражений open_recent_folder
и open_recent_file
, каждый раз увеличивая индекс.
{ "command": "open_recent_folder", "args": {"index": 0 } },
{ "command": "open_recent_folder", "args": {"index": 1 } },
{ "command": "open_recent_folder", "args": {"index": 2 } },
{ "command": "open_recent_folder", "args": {"index": 3 } },
{ "command": "open_recent_folder", "args": {"index": 4 } },
{ "command": "open_recent_folder", "args": {"index": 5 } },
{ "command": "open_recent_folder", "args": {"index": 6 } },
...continue as many times as necessary...
Ответ 3
Добавьте этот Main.sublime-menu
в папку %APPDATA%\Sublime Text 3\Packages\User
. Вы увидите добавленный дочерний элемент Файл с именем Открыть последние версии, предоставив вам следующее количество последних файлов/папок. (Если бы я мог разместить его в меню, где я хочу его, хотя.)
[
{
"caption": "File",
"mnemonic": "F",
"id": "file",
"children":
[
{
"caption": "Open Recent More",
"mnemonic": "R",
"children":
[
{ "command": "open_recent_file", "args": {"index": 8 } },
{ "command": "open_recent_file", "args": {"index": 9 } },
{ "command": "open_recent_file", "args": {"index": 10 } },
{ "command": "open_recent_file", "args": {"index": 11 } },
{ "command": "open_recent_file", "args": {"index": 12 } },
{ "command": "open_recent_file", "args": {"index": 13 } },
{ "command": "open_recent_file", "args": {"index": 14 } },
{ "command": "open_recent_file", "args": {"index": 15 } },
{ "command": "open_recent_file", "args": {"index": 16 } },
{ "caption": "-" },
{ "command": "open_recent_folder", "args": {"index": 8 } },
{ "command": "open_recent_folder", "args": {"index": 9 } },
{ "command": "open_recent_folder", "args": {"index": 10 } },
{ "command": "open_recent_folder", "args": {"index": 11 } },
{ "command": "open_recent_folder", "args": {"index": 12 } },
{ "command": "open_recent_folder", "args": {"index": 13 } },
{ "command": "open_recent_folder", "args": {"index": 14 } },
{ "command": "open_recent_folder", "args": {"index": 15 } },
{ "command": "open_recent_folder", "args": {"index": 16 } },
{ "caption": "-" }
]
}
]
}
]
Ответ 4
Для тех из вас, кто слишком ленив, чтобы скопировать и вставить, измените цифры, вот 50 из них.
{ "command": "open_recent_file", "args": {"index": 0 } },
{ "command": "open_recent_file", "args": {"index": 1 } },
{ "command": "open_recent_file", "args": {"index": 2 } },
{ "command": "open_recent_file", "args": {"index": 3 } },
{ "command": "open_recent_file", "args": {"index": 4 } },
{ "command": "open_recent_file", "args": {"index": 5 } },
{ "command": "open_recent_file", "args": {"index": 6 } },
{ "command": "open_recent_file", "args": {"index": 7 } },
{ "command": "open_recent_file", "args": {"index": 8 } },
{ "command": "open_recent_file", "args": {"index": 9 } },
{ "command": "open_recent_file", "args": {"index": 10 } },
{ "command": "open_recent_file", "args": {"index": 11 } },
{ "command": "open_recent_file", "args": {"index": 12 } },
{ "command": "open_recent_file", "args": {"index": 13 } },
{ "command": "open_recent_file", "args": {"index": 14 } },
{ "command": "open_recent_file", "args": {"index": 15 } },
{ "command": "open_recent_file", "args": {"index": 16 } },
{ "command": "open_recent_file", "args": {"index": 17 } },
{ "command": "open_recent_file", "args": {"index": 18 } },
{ "command": "open_recent_file", "args": {"index": 19 } },
{ "command": "open_recent_file", "args": {"index": 20 } },
{ "command": "open_recent_file", "args": {"index": 21 } },
{ "command": "open_recent_file", "args": {"index": 22 } },
{ "command": "open_recent_file", "args": {"index": 23 } },
{ "command": "open_recent_file", "args": {"index": 24 } },
{ "command": "open_recent_file", "args": {"index": 25 } },
{ "command": "open_recent_file", "args": {"index": 26 } },
{ "command": "open_recent_file", "args": {"index": 27 } },
{ "command": "open_recent_file", "args": {"index": 28 } },
{ "command": "open_recent_file", "args": {"index": 29 } },
{ "command": "open_recent_file", "args": {"index": 30 } },
{ "command": "open_recent_file", "args": {"index": 31 } },
{ "command": "open_recent_file", "args": {"index": 32 } },
{ "command": "open_recent_file", "args": {"index": 33 } },
{ "command": "open_recent_file", "args": {"index": 34 } },
{ "command": "open_recent_file", "args": {"index": 35 } },
{ "command": "open_recent_file", "args": {"index": 36 } },
{ "command": "open_recent_file", "args": {"index": 37 } },
{ "command": "open_recent_file", "args": {"index": 38 } },
{ "command": "open_recent_file", "args": {"index": 39 } },
{ "command": "open_recent_file", "args": {"index": 40 } },
{ "command": "open_recent_file", "args": {"index": 41 } },
{ "command": "open_recent_file", "args": {"index": 42 } },
{ "command": "open_recent_file", "args": {"index": 43 } },
{ "command": "open_recent_file", "args": {"index": 44 } },
{ "command": "open_recent_file", "args": {"index": 45 } },
{ "command": "open_recent_file", "args": {"index": 46 } },
{ "command": "open_recent_file", "args": {"index": 47 } },
{ "command": "open_recent_file", "args": {"index": 48 } },
{ "command": "open_recent_file", "args": {"index": 49 } },
Ответ 5
В Windows 7 или 8 вы:
-
Откройте следующий файл в утилите ZIP/архива:
C:\Program Files\Sublime Text 3\Packages\Default.sublime-package
-
Извлеките только файл Main.sublime-menu
в:
%APPDATA%\Sublime Text 3\Packages\Default
(При необходимости создайте папку)
Папка иначе известна как:
C:\Users\YourUsername\AppData\Roaming\Sublime Text 3\Packages\Default
-
Откройте Main.sublime-menu
(файл JSON), который вы только что извлекли, и измените количество выражений open_recent_folder
и open_recent_file
, которые появляются, каждый раз увеличивая индекс.
{ "command": "open_recent_folder", "args": {"index": 0 } },
{ "command": "open_recent_folder", "args": {"index": 1 } },
{ "command": "open_recent_folder", "args": {"index": 2 } },
{ "command": "open_recent_folder", "args": {"index": 3 } },
{ "command": "open_recent_folder", "args": {"index": 4 } },
{ "command": "open_recent_folder", "args": {"index": 5 } },
{ "command": "open_recent_folder", "args": {"index": 6 } },
...continue as many times as necessary...
-
Нажмите "Сохранить", и меню должно быть немедленно обновлено.: -)
Вы даже можете переместить свой последний список файлов/папок в корневое меню "Файл", чтобы облегчить доступ.
Ответ 6
Я обнаружил, что вам действительно не нужно переопределять главное меню.
просто добавьте свое собственное меню, которое появится в конце.
Создайте этот новый файл (путь для меня в linux, в Sublime Text 3):
~/.config/sublime-text-3/Packages/User/Main.sublime-menu
В этом файле поместите что-то похожее на предыдущий ответ OdatNurd;
(и я скопирую один и тот же контент в файлы:
Context.sublime-menu
Side Bar.sublime-menu
чтобы там было такое же подменю)
Я только что сделал свое собственное подменю из своих собственных инициалов "elm" и добавил все, что я лично использовал там с различными "детскими" поддеревьями.
В качестве бонуса он автоматически отобразит сочетания клавиш по той же команде за ним,
поэтому я также использую его как напоминание о действиях, которые я не очень часто использую, и забыть сочетание клавиш.
Это работает для Sublime Text 3,
но, возможно, кто-то может проверить, работает ли это для Sublime Text 2?
Мой файл выглядит примерно так:
(также добавил еще несколько идей (помимо множества последних файлов) для вдохновения)
[
{
"caption" : "elm",
"mnemonic": "M",
"children": [
{
"caption": "Open Recent",
"mnemonic": "R",
"children": [
{ "command": "reopen_last_file", "caption": "Reopen Closed File" },
{ "caption": "-" },
{ "command": "open_recent_file", "args": {"index": 0 } },
{ "command": "open_recent_file", "args": {"index": 1 } },
// ... etc.
{ "command": "open_recent_file", "args": {"index": 29 } },
],
},
{
"caption": "Multi Line/Caret editing",
"children": [
{
"caption": "split_selection_into_lines",
"command": "split_selection_into_lines",
},
{
"caption": "Add caret above (select_lines)",
"command": "select_lines",
"args": {"forward": false},
},
{
"caption": "Add caret below (select_lines)",
"command": "select_lines",
"args": {"forward": true},
},
]
},
{
"caption": "Bookmarks",
"children": [
{
"caption": "toggle_bookmark",
"command": "toggle_bookmark",
},
{
"caption": "prev_bookmark",
"command": "prev_bookmark",
},
{
"caption": "next_bookmark",
"command": "next_bookmark",
},
]
},
{
"caption": "paste_from_history",
"command": "paste_from_history",
},
{
"caption": "Jump to matching bracket",
"command": "move_to", "args": {"to": "brackets"},
},
// ... etc. etc.
],
},
]
Отключить тему только для более свежих файлов, но я думал, что этот подход может также улучшить другие аспекты удобства использования и сопровождения:)