From e6878ed78f373d0b93a0a8418f67034177f2072b Mon Sep 17 00:00:00 2001 From: Mika Vilpas Date: Sun, 14 Apr 2024 17:23:15 +0300 Subject: [PATCH] feat: can open multiple files in splits or tabs Just select multiple files and hit c-v, c-s or c-t --- lua/yazi/config.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lua/yazi/config.lua b/lua/yazi/config.lua index 2ae92ae6..036a9512 100644 --- a/lua/yazi/config.lua +++ b/lua/yazi/config.lua @@ -26,16 +26,31 @@ end function M.default_set_keymappings_function(yazi_buffer, config) vim.keymap.set({ 't' }, '', 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' }, '', 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' }, '', 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