You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tips.md
+24-1Lines changed: 24 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -121,6 +121,30 @@ run = "plugin smart-tab"
121
121
desc = "Create a tab and enter the hovered directory"
122
122
```
123
123
124
+
## Switch & create tabs: {#switch-create-tab}
125
+
126
+
Save these lines as `~/.config/yazi/plugins/switch-create-tab.yazi/init.lua`:
127
+
128
+
```lua
129
+
localfunctionentry(_, args)
130
+
for_=#cx.tabs, args[1] do
131
+
ya.manager_emit("tab_create", { current=true })
132
+
end
133
+
ya.manager_emit("tab_switch", { args[1] })
134
+
end
135
+
136
+
return { entry=entry }
137
+
```
138
+
139
+
Then bind it for <kbd>2</kbd> key or any number key, in your `keymap.toml`:
140
+
141
+
```toml
142
+
[[manager.prepend_keymap]]
143
+
on = [ "2" ]
144
+
run = "plugin --sync switch-create-tab --args=1"
145
+
desc = "Create a new tab using the current path and switch to it"
146
+
```
147
+
124
148
## Folder-specific rules {#folder-rules}
125
149
126
150
You can subscribe to directory change events through the [`cd` event provided by DDS](/docs/dds#cd), and then do any action you want, such as setting different sorting methods for specific directories.
0 commit comments