Skip to content

Commit

Permalink
feat: can open multiple files in splits or tabs
Browse files Browse the repository at this point in the history
Just select multiple files and hit c-v, c-s or c-t
  • Loading branch information
mikavilpas committed Apr 14, 2024
1 parent 0e37883 commit e6878ed
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lua/yazi/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,31 @@ end
function M.default_set_keymappings_function(yazi_buffer, config)
vim.keymap.set({ 't' }, '<c-v>', function()
config.open_file_function = openers.open_file_in_vertical_split
config.hooks.yazi_opened_multiple_files = function(chosen_files)
for _, chosen_file in ipairs(chosen_files) do
config.open_file_function(chosen_file, config)
end
end
M.select_current_file_and_close_yazi()
end, { buffer = yazi_buffer })

vim.keymap.set({ 't' }, '<c-s>', function()
config.open_file_function = openers.open_file_in_horizontal_split
config.hooks.yazi_opened_multiple_files = function(chosen_files)
for _, chosen_file in ipairs(chosen_files) do
config.open_file_function(chosen_file, config)
end
end
M.select_current_file_and_close_yazi()
end, { buffer = yazi_buffer })

vim.keymap.set({ 't' }, '<c-t>', function()
config.open_file_function = openers.open_file_in_tab
config.hooks.yazi_opened_multiple_files = function(chosen_files)
for _, chosen_file in ipairs(chosen_files) do
config.open_file_function(chosen_file, config)
end
end
M.select_current_file_and_close_yazi()
end, { buffer = yazi_buffer })
end
Expand Down

0 comments on commit e6878ed

Please sign in to comment.